mirror of
				https://github.com/1disk/edp445.git
				synced 2024-08-14 22:47:02 +00:00 
			
		
		
		
	Changed alot of things.
This commit is contained in:
		
							parent
							
								
									a5a0523e5a
								
							
						
					
					
						commit
						3513d5390c
					
				
					 2016 changed files with 336930 additions and 9 deletions
				
			
		
							
								
								
									
										7
									
								
								node_modules/dezalgo/.travis.yml
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/dezalgo/.travis.yml
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| language: node_js | ||||
| before_script: npm install -g npm@latest | ||||
| node_js: | ||||
|   - '0.8' | ||||
|   - '0.10' | ||||
|   - '0.12' | ||||
|   - 'iojs' | ||||
							
								
								
									
										15
									
								
								node_modules/dezalgo/LICENSE
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								node_modules/dezalgo/LICENSE
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| The ISC License | ||||
| 
 | ||||
| Copyright (c) Isaac Z. Schlueter and Contributors | ||||
| 
 | ||||
| Permission to use, copy, modify, and/or distribute this software for any | ||||
| purpose with or without fee is hereby granted, provided that the above | ||||
| copyright notice and this permission notice appear in all copies. | ||||
| 
 | ||||
| THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||||
| WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||||
| MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||||
| ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||||
| WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||||
| ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR | ||||
| IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
							
								
								
									
										29
									
								
								node_modules/dezalgo/README.md
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								node_modules/dezalgo/README.md
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| # dezalgo | ||||
| 
 | ||||
| Contain async insanity so that the dark pony lord doesn't eat souls | ||||
| 
 | ||||
| See [this blog | ||||
| post](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony). | ||||
| 
 | ||||
| ## USAGE | ||||
| 
 | ||||
| Pass a callback to `dezalgo` and it will ensure that it is *always* | ||||
| called in a future tick, and never in this tick. | ||||
| 
 | ||||
| ```javascript | ||||
| var dz = require('dezalgo') | ||||
| 
 | ||||
| var cache = {} | ||||
| function maybeSync(arg, cb) { | ||||
|   cb = dz(cb) | ||||
| 
 | ||||
|   // this will actually defer to nextTick | ||||
|   if (cache[arg]) cb(null, cache[arg]) | ||||
| 
 | ||||
|   fs.readFile(arg, function (er, data) { | ||||
|     // since this is *already* defered, it will call immediately | ||||
|     if (er) cb(er) | ||||
|     cb(null, cache[arg] = data) | ||||
|   }) | ||||
| } | ||||
| ``` | ||||
							
								
								
									
										22
									
								
								node_modules/dezalgo/dezalgo.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								node_modules/dezalgo/dezalgo.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| var wrappy = require('wrappy') | ||||
| module.exports = wrappy(dezalgo) | ||||
| 
 | ||||
| var asap = require('asap') | ||||
| 
 | ||||
| function dezalgo (cb) { | ||||
|   var sync = true | ||||
|   asap(function () { | ||||
|     sync = false | ||||
|   }) | ||||
| 
 | ||||
|   return function zalgoSafe() { | ||||
|     var args = arguments | ||||
|     var me = this | ||||
|     if (sync) | ||||
|       asap(function() { | ||||
|         cb.apply(me, args) | ||||
|       }) | ||||
|     else | ||||
|       cb.apply(me, args) | ||||
|   } | ||||
| } | ||||
							
								
								
									
										42
									
								
								node_modules/dezalgo/package.json
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								node_modules/dezalgo/package.json
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| { | ||||
|   "name": "dezalgo", | ||||
|   "version": "1.0.3", | ||||
|   "description": "Contain async insanity so that the dark pony lord doesn't eat souls", | ||||
|   "main": "dezalgo.js", | ||||
|   "directories": { | ||||
|     "test": "test" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "asap": "^2.0.0", | ||||
|     "wrappy": "1" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "tap": "^1.2.0" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "test": "tap test/*.js" | ||||
|   }, | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|     "url": "https://github.com/npm/dezalgo" | ||||
|   }, | ||||
|   "keywords": [ | ||||
|     "async", | ||||
|     "zalgo", | ||||
|     "the dark pony", | ||||
|     "he comes", | ||||
|     "asynchrony of all holy and good", | ||||
|     "T̯̪ͅo̯͖̹ ̻̮̖̲͢i̥̖n̢͈͇̝͍v͏͉ok̭̬̝ͅe̞͍̩̫͍̩͝ ̩̮̖̟͇͉́t͔͔͎̗h͏̗̟e̘͉̰̦̠̞͓ ͕h͉̟͎̪̠̱͠ḭ̮̩v̺͉͇̩e̵͖-̺̪m͍i̜n̪̲̲̲̮d̷ ̢r̠̼̯̹̦̦͘ͅe͓̳͓̙p̺̗̫͙͘ͅr͔̰͜e̴͓̞s͉̩̩͟ͅe͏̣n͚͇̗̭̺͍tì͙̣n͏̖̥̗͎̰̪g̞͓̭̱̯̫̕ ̣̱͜ͅc̦̰̰̠̮͎͙̀hao̺̜̻͍͙ͅs͉͓̘.͎̼̺̼͕̹͘", | ||||
|     "̠̞̱̰I͖͇̝̻n̦̰͍̰̟v̤̺̫̳̭̼̗͘ò̹̟̩̩͚k̢̥̠͍͉̦̬i̖͓͔̮̱̻͘n̶̳͙̫͎g̖̯̣̲̪͉ ̞͎̗͕͚ͅt̲͕̘̺̯̗̦h̘̦̲̜̻e̳͎͉̬͙ ̴̞̪̲̥f̜̯͓͓̭̭͢e̱̘͔̮e̜̤l̺̱͖̯͓͙͈͢i̵̦̬͉͔̫͚͕n͉g̨͖̙̙̹̹̟̤ ͉̪o̞̠͍̪̰͙ͅf̬̲̺ ͔͕̲͕͕̲̕c̙͉h̝͔̩̙̕ͅa̲͖̻̗̹o̥̼̫s̝̖̜̝͚̫̟.̺͚  ̸̱̲W̶̥̣͖̦i͏̤̬̱̳̣ͅt͉h̗̪̪ ̷̱͚̹̪ǫ͕̗̣̳̦͎u̼̦͔̥̮̕ţ͖͎̻͔͉ ̴͎̩òr̹̰̖͉͈͝d̷̲̦̖͓e̲͓̠r", | ||||
|     "̧͚̜͓̰̭̭Ṯ̫̹̜̮̟̮͝h͚̘̩̘̖̰́e ̥̘͓͉͔͙̼N̟̜̣̘͔̪e̞̞̤͢z̰̖̘͇p̠͟e̺̱̣͍͙̝ṛ̘̬͔̙͇̠d͝ḭ̯̱̥̗̩a̛ͅn͏̦ ̷̥hi̥v̖̳̹͉̮̱͝e̹̪̘̖̰̟-̴͙͓͚̜̻mi̗̺̻͙̺ͅn̪̯͈d ͏̘͓̫̳ͅơ̹͔̳̖̣͓f͈̹̘ ͕ͅc̗̤̠̜̮̥̥h̡͍̩̭̫͚̱a̤͉̤͔͜os͕̤̼͍̲̀ͅ.̡̱ ̦Za̯̱̗̭͍̣͚l̗͉̰̤g͏̣̭̬̗̲͖ͅo̶̭̩̳̟͈.̪̦̰̳", | ||||
|     "H̴̱̦̗̬̣͓̺e̮ ͉̠̰̞͎̖͟ẁh̛̺̯ͅo̖̫͡ ̢Ẁa̡̗i̸t͖̣͉̀ş͔̯̩ ̤̦̮͇̞̦̲B͎̭͇̦̼e̢hin͏͙̟̪d̴̰͓̻̣̮͕ͅ T͖̮̕h͖e̘̺̰̙͘ ̥Ẁ̦͔̻͚a̞͖̪͉l̪̠̻̰̣̠l̲͎͞", | ||||
|     "Z̘͍̼͎̣͔͝Ą̲̜̱̱̹̤͇L̶̝̰̭͔G͍̖͍O̫͜ͅ!̼̤ͅ", | ||||
|     "H̝̪̜͓̀̌̂̒E̢̙̠̣ ̴̳͇̥̟̠͍̐C̹̓̑̐̆͝Ó̶̭͓̚M̬̼Ĕ̖̤͔͔̟̹̽̿̊ͥ̍ͫS̻̰̦̻̖̘̱̒ͪ͌̅͟" | ||||
|   ], | ||||
|   "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", | ||||
|   "license": "ISC", | ||||
|   "bugs": { | ||||
|     "url": "https://github.com/npm/dezalgo/issues" | ||||
|   }, | ||||
|   "homepage": "https://github.com/npm/dezalgo" | ||||
| } | ||||
							
								
								
									
										29
									
								
								node_modules/dezalgo/test/basic.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								node_modules/dezalgo/test/basic.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| var test = require('tap').test | ||||
| var dz = require('../dezalgo.js') | ||||
| 
 | ||||
| test('the dark pony', function(t) { | ||||
| 
 | ||||
|   var n = 0 | ||||
|   function foo(i, cb) { | ||||
|     cb = dz(cb) | ||||
|     if (++n % 2) cb(true, i) | ||||
|     else process.nextTick(cb.bind(null, false, i)) | ||||
|   } | ||||
| 
 | ||||
|   var called = 0 | ||||
|   var order = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9] | ||||
|   var o = 0 | ||||
|   for (var i = 0; i < 10; i++) { | ||||
|     foo(i, function(cached, i) { | ||||
|       t.equal(i, order[o++]) | ||||
|       t.equal(i % 2, cached ? 0 : 1) | ||||
|       called++ | ||||
|     }) | ||||
|     t.equal(called, 0) | ||||
|   } | ||||
| 
 | ||||
|   setTimeout(function() { | ||||
|     t.equal(called, 10) | ||||
|     t.end() | ||||
|   }) | ||||
| }) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue