summaryrefslogtreecommitdiff
path: root/together/node_modules/dezalgo
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
committerMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
commita2df9a69dcc14cb70118cda2ded499055e7ee358 (patch)
tree6dd283e4e9452d38bce81ddaaae49b5335755842 /together/node_modules/dezalgo
parent84dd0735820b16b60f600284d35183d76547a71f (diff)
downloadpluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.gz
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.bz2
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.zip
m. update
Diffstat (limited to 'together/node_modules/dezalgo')
-rw-r--r--together/node_modules/dezalgo/.travis.yml7
-rw-r--r--together/node_modules/dezalgo/LICENSE15
-rw-r--r--together/node_modules/dezalgo/README.md29
-rw-r--r--together/node_modules/dezalgo/dezalgo.js22
-rw-r--r--together/node_modules/dezalgo/package.json42
-rw-r--r--together/node_modules/dezalgo/test/basic.js29
6 files changed, 144 insertions, 0 deletions
diff --git a/together/node_modules/dezalgo/.travis.yml b/together/node_modules/dezalgo/.travis.yml
new file mode 100644
index 0000000..e1bcee1
--- /dev/null
+++ b/together/node_modules/dezalgo/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+before_script: npm install -g npm@latest
+node_js:
+ - '0.8'
+ - '0.10'
+ - '0.12'
+ - 'iojs'
diff --git a/together/node_modules/dezalgo/LICENSE b/together/node_modules/dezalgo/LICENSE
new file mode 100644
index 0000000..19129e3
--- /dev/null
+++ b/together/node_modules/dezalgo/LICENSE
@@ -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.
diff --git a/together/node_modules/dezalgo/README.md b/together/node_modules/dezalgo/README.md
new file mode 100644
index 0000000..bdfc8ba
--- /dev/null
+++ b/together/node_modules/dezalgo/README.md
@@ -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)
+ })
+}
+```
diff --git a/together/node_modules/dezalgo/dezalgo.js b/together/node_modules/dezalgo/dezalgo.js
new file mode 100644
index 0000000..04fd3ba
--- /dev/null
+++ b/together/node_modules/dezalgo/dezalgo.js
@@ -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)
+ }
+}
diff --git a/together/node_modules/dezalgo/package.json b/together/node_modules/dezalgo/package.json
new file mode 100644
index 0000000..634dd0d
--- /dev/null
+++ b/together/node_modules/dezalgo/package.json
@@ -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"
+}
diff --git a/together/node_modules/dezalgo/test/basic.js b/together/node_modules/dezalgo/test/basic.js
new file mode 100644
index 0000000..da09e72
--- /dev/null
+++ b/together/node_modules/dezalgo/test/basic.js
@@ -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()
+ })
+})