aboutsummaryrefslogtreecommitdiff
path: root/node_modules/wrappy
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
commitabd94a7f5a50f43c797a11b53549ae48fff667c3 (patch)
treeab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/wrappy
parenta0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff)
downloadwallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz
add node_modules to address #4364
Diffstat (limited to 'node_modules/wrappy')
-rw-r--r--node_modules/wrappy/LICENSE15
-rw-r--r--node_modules/wrappy/README.md36
-rw-r--r--node_modules/wrappy/package.json100
-rw-r--r--node_modules/wrappy/wrappy.js33
4 files changed, 184 insertions, 0 deletions
diff --git a/node_modules/wrappy/LICENSE b/node_modules/wrappy/LICENSE
new file mode 100644
index 000000000..19129e315
--- /dev/null
+++ b/node_modules/wrappy/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/node_modules/wrappy/README.md b/node_modules/wrappy/README.md
new file mode 100644
index 000000000..98eab2522
--- /dev/null
+++ b/node_modules/wrappy/README.md
@@ -0,0 +1,36 @@
+# wrappy
+
+Callback wrapping utility
+
+## USAGE
+
+```javascript
+var wrappy = require("wrappy")
+
+// var wrapper = wrappy(wrapperFunction)
+
+// make sure a cb is called only once
+// See also: http://npm.im/once for this specific use case
+var once = wrappy(function (cb) {
+ var called = false
+ return function () {
+ if (called) return
+ called = true
+ return cb.apply(this, arguments)
+ }
+})
+
+function printBoo () {
+ console.log('boo')
+}
+// has some rando property
+printBoo.iAmBooPrinter = true
+
+var onlyPrintOnce = once(printBoo)
+
+onlyPrintOnce() // prints 'boo'
+onlyPrintOnce() // does nothing
+
+// random property is retained!
+assert.equal(onlyPrintOnce.iAmBooPrinter, true)
+```
diff --git a/node_modules/wrappy/package.json b/node_modules/wrappy/package.json
new file mode 100644
index 000000000..f9d69d84e
--- /dev/null
+++ b/node_modules/wrappy/package.json
@@ -0,0 +1,100 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "wrappy@1",
+ "scope": null,
+ "escapedName": "wrappy",
+ "name": "wrappy",
+ "rawSpec": "1",
+ "spec": ">=1.0.0 <2.0.0",
+ "type": "range"
+ },
+ "/home/dold/repos/taler/wallet-webex/node_modules/inflight"
+ ]
+ ],
+ "_from": "wrappy@>=1.0.0 <2.0.0",
+ "_id": "wrappy@1.0.2",
+ "_inCache": true,
+ "_location": "/wrappy",
+ "_nodeVersion": "5.10.1",
+ "_npmOperationalInternal": {
+ "host": "packages-16-east.internal.npmjs.com",
+ "tmp": "tmp/wrappy-1.0.2.tgz_1463527848281_0.037129373755306005"
+ },
+ "_npmUser": {
+ "name": "zkat",
+ "email": "kat@sykosomatic.org"
+ },
+ "_npmVersion": "3.9.1",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "wrappy@1",
+ "scope": null,
+ "escapedName": "wrappy",
+ "name": "wrappy",
+ "rawSpec": "1",
+ "spec": ">=1.0.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/duplexify/once",
+ "/end-of-stream/once",
+ "/inflight",
+ "/once",
+ "/tar-stream/once"
+ ],
+ "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "_shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
+ "_shrinkwrap": null,
+ "_spec": "wrappy@1",
+ "_where": "/home/dold/repos/taler/wallet-webex/node_modules/inflight",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "bugs": {
+ "url": "https://github.com/npm/wrappy/issues"
+ },
+ "dependencies": {},
+ "description": "Callback wrapping utility",
+ "devDependencies": {
+ "tap": "^2.3.1"
+ },
+ "directories": {
+ "test": "test"
+ },
+ "dist": {
+ "shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
+ "tarball": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
+ },
+ "files": [
+ "wrappy.js"
+ ],
+ "gitHead": "71d91b6dc5bdeac37e218c2cf03f9ab55b60d214",
+ "homepage": "https://github.com/npm/wrappy",
+ "license": "ISC",
+ "main": "wrappy.js",
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "zkat",
+ "email": "kat@sykosomatic.org"
+ }
+ ],
+ "name": "wrappy",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/npm/wrappy.git"
+ },
+ "scripts": {
+ "test": "tap --coverage test/*.js"
+ },
+ "version": "1.0.2"
+}
diff --git a/node_modules/wrappy/wrappy.js b/node_modules/wrappy/wrappy.js
new file mode 100644
index 000000000..bb7e7d6fc
--- /dev/null
+++ b/node_modules/wrappy/wrappy.js
@@ -0,0 +1,33 @@
+// Returns a wrapper function that returns a wrapped callback
+// The wrapper function should do some stuff, and return a
+// presumably different callback function.
+// This makes sure that own properties are retained, so that
+// decorations and such are not lost along the way.
+module.exports = wrappy
+function wrappy (fn, cb) {
+ if (fn && cb) return wrappy(fn)(cb)
+
+ if (typeof fn !== 'function')
+ throw new TypeError('need wrapper function')
+
+ Object.keys(fn).forEach(function (k) {
+ wrapper[k] = fn[k]
+ })
+
+ return wrapper
+
+ function wrapper() {
+ var args = new Array(arguments.length)
+ for (var i = 0; i < args.length; i++) {
+ args[i] = arguments[i]
+ }
+ var ret = fn.apply(this, args)
+ var cb = args[args.length-1]
+ if (typeof ret === 'function' && ret !== cb) {
+ Object.keys(cb).forEach(function (k) {
+ ret[k] = cb[k]
+ })
+ }
+ return ret
+ }
+}