fsevents 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/node_modules/are-we-there-yet/LICENSE +5 -0
- package/node_modules/are-we-there-yet/README.md +2 -1
- package/node_modules/are-we-there-yet/README.md~ +183 -0
- package/node_modules/are-we-there-yet/package.json +10 -9
- package/node_modules/async/README.md +14 -10
- package/node_modules/async/dist/async.js +22 -18
- package/node_modules/async/dist/async.min.js +1 -1
- package/node_modules/async/lib/async.js +22 -18
- package/node_modules/async/package.json +11 -10
- package/node_modules/core-util-is/package.json +2 -1
- package/node_modules/dashdash/README.md +6 -3
- package/node_modules/dashdash/lib/dashdash.js +10 -1
- package/node_modules/dashdash/package.json +9 -8
- package/node_modules/escape-string-regexp/index.js +1 -1
- package/node_modules/escape-string-regexp/package.json +17 -15
- package/node_modules/escape-string-regexp/readme.md +4 -4
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +9 -0
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +42 -30
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +9 -9
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +28 -0
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +11 -11
- package/node_modules/graceful-fs/package.json +2 -3
- package/node_modules/isarray/package.json +2 -1
- package/node_modules/mime-db/HISTORY.md +32 -0
- package/node_modules/mime-db/README.md +1 -1
- package/node_modules/mime-db/db.json +78 -0
- package/node_modules/mime-db/package.json +15 -14
- package/node_modules/mime-types/HISTORY.md +12 -0
- package/node_modules/mime-types/package.json +11 -10
- package/node_modules/node-pre-gyp/CHANGELOG.md +8 -0
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +32 -0
- package/node_modules/node-pre-gyp/package.json +8 -8
- package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/.travis.yml +6 -1
- package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/index.js +8 -1
- package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/package.json +13 -12
- package/node_modules/rc/lib/utils.js +1 -1
- package/node_modules/rc/package.json +11 -10
- package/node_modules/readable-stream/README.md +27 -6
- package/node_modules/{bl/node_modules/readable-stream → readable-stream}/doc/stream.markdown +608 -574
- package/node_modules/readable-stream/lib/_stream_duplex.js +18 -25
- package/node_modules/readable-stream/lib/_stream_passthrough.js +2 -21
- package/node_modules/readable-stream/lib/_stream_readable.js +117 -93
- package/node_modules/readable-stream/lib/_stream_transform.js +15 -27
- package/node_modules/readable-stream/lib/_stream_writable.js +140 -88
- package/node_modules/readable-stream/package.json +33 -25
- package/node_modules/readable-stream/readable.js +6 -1
- package/node_modules/rimraf/README.md +58 -0
- package/node_modules/rimraf/node_modules/glob/README.md +27 -45
- package/node_modules/rimraf/node_modules/glob/common.js +7 -26
- package/node_modules/rimraf/node_modules/glob/node_modules/inherits/package.json +1 -1
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +9 -0
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +42 -30
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +9 -9
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +28 -0
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +11 -11
- package/node_modules/rimraf/node_modules/glob/package.json +11 -10
- package/node_modules/rimraf/package.json +12 -11
- package/node_modules/rimraf/rimraf.js +7 -5
- package/node_modules/sshpk/bin/sshpk-conv +1 -1
- package/node_modules/sshpk/lib/dhe.js +1 -2
- package/node_modules/sshpk/lib/ssh-buffer.js +2 -1
- package/node_modules/sshpk/package.json +13 -11
- package/node_modules/string_decoder/package.json +2 -1
- package/node_modules/tar-pack/index.js +1 -2
- package/node_modules/tar-pack/node_modules/rimraf/LICENSE +12 -20
- package/node_modules/tar-pack/node_modules/rimraf/README.md +17 -4
- package/node_modules/tar-pack/node_modules/rimraf/bin.js +11 -4
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/README.md +359 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/common.js +226 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/glob.js +752 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/README.md +37 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +58 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/package.json +67 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/test.js +97 -0
- package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/package.json +3 -3
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/README.md +216 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/minimatch.js +912 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +3 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +122 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +3 -0
- package/node_modules/tar-pack/node_modules/{readable-stream/node_modules/isarray/README.md → rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/LICENSE.md} +0 -33
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +89 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +50 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +79 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +84 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +4 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +90 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +81 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/package.json +66 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/README.md +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +58 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/once.js +21 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/package.json +70 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/index.js +20 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/package.json +78 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/readme.md +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/package.json +79 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/sync.js +460 -0
- package/node_modules/tar-pack/node_modules/rimraf/package.json +28 -40
- package/node_modules/tar-pack/node_modules/rimraf/rimraf.js +138 -53
- package/node_modules/tar-pack/package.json +21 -11
- package/node_modules/tunnel-agent/index.js +2 -0
- package/node_modules/tunnel-agent/package.json +10 -9
- package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/package.json +3 -2
- package/node_modules/verror/package.json +3 -2
- package/package.json +2 -2
- package/CHANGELOG.md +0 -16
- package/node_modules/bl/node_modules/readable-stream/.npmignore +0 -5
- package/node_modules/bl/node_modules/readable-stream/LICENSE +0 -18
- package/node_modules/bl/node_modules/readable-stream/README.md +0 -36
- package/node_modules/bl/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js +0 -82
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js +0 -27
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js +0 -973
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js +0 -197
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js +0 -527
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md +0 -3
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch +0 -604
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json +0 -67
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js +0 -68
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md +0 -54
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js +0 -209
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json +0 -19
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js +0 -3
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json +0 -59
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore +0 -2
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE +0 -20
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md +0 -7
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js +0 -221
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json +0 -60
- package/node_modules/bl/node_modules/readable-stream/package.json +0 -82
- package/node_modules/bl/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/bl/node_modules/readable-stream/readable.js +0 -12
- package/node_modules/bl/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/bl/node_modules/readable-stream/writable.js +0 -1
- package/node_modules/node-pre-gyp/LICENSE +0 -27
- package/node_modules/readable-stream/float.patch +0 -923
- package/node_modules/tar-pack/node_modules/readable-stream/.npmignore +0 -5
- package/node_modules/tar-pack/node_modules/readable-stream/LICENSE +0 -18
- package/node_modules/tar-pack/node_modules/readable-stream/README.md +0 -15
- package/node_modules/tar-pack/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_duplex.js +0 -89
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_passthrough.js +0 -46
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_readable.js +0 -982
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_transform.js +0 -210
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_writable.js +0 -386
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/README.md +0 -3
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/float.patch +0 -604
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/package.json +0 -67
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/test.js +0 -68
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/LICENSE +0 -16
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/README.md +0 -42
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/inherits.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +0 -23
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/package.json +0 -58
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/test.js +0 -25
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/build/build.js +0 -209
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/component.json +0 -19
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/index.js +0 -3
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/package.json +0 -59
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/.npmignore +0 -2
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/LICENSE +0 -20
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/README.md +0 -7
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/index.js +0 -221
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/package.json +0 -60
- package/node_modules/tar-pack/node_modules/readable-stream/package.json +0 -76
- package/node_modules/tar-pack/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/readable.js +0 -8
- package/node_modules/tar-pack/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/writable.js +0 -1
- package/node_modules/tar-pack/node_modules/rimraf/AUTHORS +0 -6
- package/node_modules/tar-pack/node_modules/rimraf/test/run.sh +0 -16
- package/node_modules/tar-pack/node_modules/rimraf/test/setup.sh +0 -47
- package/node_modules/tar-pack/node_modules/rimraf/test/test-async.js +0 -5
- package/node_modules/tar-pack/node_modules/rimraf/test/test-sync.js +0 -3
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/license.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/readme.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/test.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/.travis.yml +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/.zuul.yml +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/doc/wg-meetings/2015-01-30.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/LICENSE +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/README.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/inherits.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/inherits_browser.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/test.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/History.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/LICENSE +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/README.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/browser.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/node.js +0 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
This software is released under the MIT license:
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
concat-map
|
2
|
+
==========
|
3
|
+
|
4
|
+
Concatenative mapdashery.
|
5
|
+
|
6
|
+
[](http://ci.testling.com/substack/node-concat-map)
|
7
|
+
|
8
|
+
[](http://travis-ci.org/substack/node-concat-map)
|
9
|
+
|
10
|
+
example
|
11
|
+
=======
|
12
|
+
|
13
|
+
``` js
|
14
|
+
var concatMap = require('concat-map');
|
15
|
+
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
16
|
+
var ys = concatMap(xs, function (x) {
|
17
|
+
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
18
|
+
});
|
19
|
+
console.dir(ys);
|
20
|
+
```
|
21
|
+
|
22
|
+
***
|
23
|
+
|
24
|
+
```
|
25
|
+
[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]
|
26
|
+
```
|
27
|
+
|
28
|
+
methods
|
29
|
+
=======
|
30
|
+
|
31
|
+
``` js
|
32
|
+
var concatMap = require('concat-map')
|
33
|
+
```
|
34
|
+
|
35
|
+
concatMap(xs, fn)
|
36
|
+
-----------------
|
37
|
+
|
38
|
+
Return an array of concatenated elements by calling `fn(x, i)` for each element
|
39
|
+
`x` and each index `i` in the array `xs`.
|
40
|
+
|
41
|
+
When `fn(x, i)` returns an array, its result will be concatenated with the
|
42
|
+
result array. If `fn(x, i)` returns anything else, that value will be pushed
|
43
|
+
onto the end of the result array.
|
44
|
+
|
45
|
+
install
|
46
|
+
=======
|
47
|
+
|
48
|
+
With [npm](http://npmjs.org) do:
|
49
|
+
|
50
|
+
```
|
51
|
+
npm install concat-map
|
52
|
+
```
|
53
|
+
|
54
|
+
license
|
55
|
+
=======
|
56
|
+
|
57
|
+
MIT
|
58
|
+
|
59
|
+
notes
|
60
|
+
=====
|
61
|
+
|
62
|
+
This module was written while sitting high above the ground in a tree.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module.exports = function (xs, fn) {
|
2
|
+
var res = [];
|
3
|
+
for (var i = 0; i < xs.length; i++) {
|
4
|
+
var x = fn(xs[i], i);
|
5
|
+
if (isArray(x)) res.push.apply(res, x);
|
6
|
+
else res.push(x);
|
7
|
+
}
|
8
|
+
return res;
|
9
|
+
};
|
10
|
+
|
11
|
+
var isArray = Array.isArray || function (xs) {
|
12
|
+
return Object.prototype.toString.call(xs) === '[object Array]';
|
13
|
+
};
|
@@ -0,0 +1,90 @@
|
|
1
|
+
{
|
2
|
+
"_from": "concat-map@0.0.1",
|
3
|
+
"_id": "concat-map@0.0.1",
|
4
|
+
"_location": "/tar-pack/rimraf/glob/minimatch/brace-expansion/concat-map",
|
5
|
+
"_npmUser": {
|
6
|
+
"email": "mail@substack.net",
|
7
|
+
"name": "substack"
|
8
|
+
},
|
9
|
+
"_npmVersion": "1.3.21",
|
10
|
+
"_phantomChildren": {},
|
11
|
+
"_requiredBy": [
|
12
|
+
"/tar-pack/rimraf/glob/minimatch/brace-expansion"
|
13
|
+
],
|
14
|
+
"_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
15
|
+
"_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
16
|
+
"author": {
|
17
|
+
"email": "mail@substack.net",
|
18
|
+
"name": "James Halliday",
|
19
|
+
"url": "http://substack.net"
|
20
|
+
},
|
21
|
+
"bugs": {
|
22
|
+
"url": "https://github.com/substack/node-concat-map/issues"
|
23
|
+
},
|
24
|
+
"dependencies": {},
|
25
|
+
"description": "concatenative mapdashery",
|
26
|
+
"devDependencies": {
|
27
|
+
"tape": "~2.4.0"
|
28
|
+
},
|
29
|
+
"directories": {
|
30
|
+
"example": "example",
|
31
|
+
"test": "test"
|
32
|
+
},
|
33
|
+
"dist": {
|
34
|
+
"shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
35
|
+
"tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
36
|
+
},
|
37
|
+
"homepage": "https://github.com/substack/node-concat-map",
|
38
|
+
"keywords": [
|
39
|
+
"concat",
|
40
|
+
"concatMap",
|
41
|
+
"functional",
|
42
|
+
"higher-order",
|
43
|
+
"map"
|
44
|
+
],
|
45
|
+
"license": "MIT",
|
46
|
+
"main": "index.js",
|
47
|
+
"maintainers": [
|
48
|
+
{
|
49
|
+
"name": "substack",
|
50
|
+
"email": "mail@substack.net"
|
51
|
+
}
|
52
|
+
],
|
53
|
+
"name": "concat-map",
|
54
|
+
"optionalDependencies": {},
|
55
|
+
"readme": "ERROR: No README data found!",
|
56
|
+
"repository": {
|
57
|
+
"type": "git",
|
58
|
+
"url": "git://github.com/substack/node-concat-map.git"
|
59
|
+
},
|
60
|
+
"scripts": {
|
61
|
+
"test": "tape test/*.js"
|
62
|
+
},
|
63
|
+
"testling": {
|
64
|
+
"browsers": {
|
65
|
+
"chrome": [
|
66
|
+
10,
|
67
|
+
22
|
68
|
+
],
|
69
|
+
"ff": [
|
70
|
+
10,
|
71
|
+
15,
|
72
|
+
3.5
|
73
|
+
],
|
74
|
+
"ie": [
|
75
|
+
6,
|
76
|
+
7,
|
77
|
+
8,
|
78
|
+
9
|
79
|
+
],
|
80
|
+
"opera": [
|
81
|
+
12
|
82
|
+
],
|
83
|
+
"safari": [
|
84
|
+
5.1
|
85
|
+
]
|
86
|
+
},
|
87
|
+
"files": "test/*.js"
|
88
|
+
},
|
89
|
+
"version": "0.0.1"
|
90
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
var concatMap = require('../');
|
2
|
+
var test = require('tape');
|
3
|
+
|
4
|
+
test('empty or not', function (t) {
|
5
|
+
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
6
|
+
var ixes = [];
|
7
|
+
var ys = concatMap(xs, function (x, ix) {
|
8
|
+
ixes.push(ix);
|
9
|
+
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
10
|
+
});
|
11
|
+
t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
|
12
|
+
t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
|
13
|
+
t.end();
|
14
|
+
});
|
15
|
+
|
16
|
+
test('always something', function (t) {
|
17
|
+
var xs = [ 'a', 'b', 'c', 'd' ];
|
18
|
+
var ys = concatMap(xs, function (x) {
|
19
|
+
return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
|
20
|
+
});
|
21
|
+
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
22
|
+
t.end();
|
23
|
+
});
|
24
|
+
|
25
|
+
test('scalars', function (t) {
|
26
|
+
var xs = [ 'a', 'b', 'c', 'd' ];
|
27
|
+
var ys = concatMap(xs, function (x) {
|
28
|
+
return x === 'b' ? [ 'B', 'B', 'B' ] : x;
|
29
|
+
});
|
30
|
+
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
31
|
+
t.end();
|
32
|
+
});
|
33
|
+
|
34
|
+
test('undefs', function (t) {
|
35
|
+
var xs = [ 'a', 'b', 'c', 'd' ];
|
36
|
+
var ys = concatMap(xs, function () {});
|
37
|
+
t.same(ys, [ undefined, undefined, undefined, undefined ]);
|
38
|
+
t.end();
|
39
|
+
});
|
@@ -0,0 +1,81 @@
|
|
1
|
+
{
|
2
|
+
"_from": "brace-expansion@^1.0.0",
|
3
|
+
"_id": "brace-expansion@1.1.2",
|
4
|
+
"_location": "/tar-pack/rimraf/glob/minimatch/brace-expansion",
|
5
|
+
"_nodeVersion": "4.2.1",
|
6
|
+
"_npmUser": {
|
7
|
+
"email": "julian@juliangruber.com",
|
8
|
+
"name": "juliangruber"
|
9
|
+
},
|
10
|
+
"_npmVersion": "2.14.7",
|
11
|
+
"_phantomChildren": {},
|
12
|
+
"_requiredBy": [
|
13
|
+
"/tar-pack/rimraf/glob/minimatch"
|
14
|
+
],
|
15
|
+
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz",
|
16
|
+
"_shasum": "f21445d0488b658e2771efd870eff51df29f04ef",
|
17
|
+
"author": {
|
18
|
+
"email": "mail@juliangruber.com",
|
19
|
+
"name": "Julian Gruber",
|
20
|
+
"url": "http://juliangruber.com"
|
21
|
+
},
|
22
|
+
"bugs": {
|
23
|
+
"url": "https://github.com/juliangruber/brace-expansion/issues"
|
24
|
+
},
|
25
|
+
"dependencies": {
|
26
|
+
"balanced-match": "^0.3.0",
|
27
|
+
"concat-map": "0.0.1"
|
28
|
+
},
|
29
|
+
"description": "Brace expansion as known from sh/bash",
|
30
|
+
"devDependencies": {
|
31
|
+
"tape": "4.2.2"
|
32
|
+
},
|
33
|
+
"directories": {},
|
34
|
+
"dist": {
|
35
|
+
"shasum": "f21445d0488b658e2771efd870eff51df29f04ef",
|
36
|
+
"tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz"
|
37
|
+
},
|
38
|
+
"gitHead": "b03773a30fa516b1374945b68e9acb6253d595fa",
|
39
|
+
"homepage": "https://github.com/juliangruber/brace-expansion",
|
40
|
+
"keywords": [],
|
41
|
+
"license": "MIT",
|
42
|
+
"main": "index.js",
|
43
|
+
"maintainers": [
|
44
|
+
{
|
45
|
+
"name": "juliangruber",
|
46
|
+
"email": "julian@juliangruber.com"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"name": "isaacs",
|
50
|
+
"email": "isaacs@npmjs.com"
|
51
|
+
}
|
52
|
+
],
|
53
|
+
"name": "brace-expansion",
|
54
|
+
"optionalDependencies": {},
|
55
|
+
"readme": "ERROR: No README data found!",
|
56
|
+
"repository": {
|
57
|
+
"type": "git",
|
58
|
+
"url": "git://github.com/juliangruber/brace-expansion.git"
|
59
|
+
},
|
60
|
+
"scripts": {
|
61
|
+
"gentest": "bash test/generate.sh",
|
62
|
+
"test": "tape test/*.js"
|
63
|
+
},
|
64
|
+
"testling": {
|
65
|
+
"browsers": [
|
66
|
+
"android-browser/4.2..latest",
|
67
|
+
"chrome/25..latest",
|
68
|
+
"chrome/canary",
|
69
|
+
"firefox/20..latest",
|
70
|
+
"firefox/nightly",
|
71
|
+
"ie/8..latest",
|
72
|
+
"ipad/6.0..latest",
|
73
|
+
"iphone/6.0..latest",
|
74
|
+
"opera/12..latest",
|
75
|
+
"opera/next",
|
76
|
+
"safari/5.1..latest"
|
77
|
+
],
|
78
|
+
"files": "test/*.js"
|
79
|
+
},
|
80
|
+
"version": "1.1.2"
|
81
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
{
|
2
|
+
"_from": "minimatch@2 || 3",
|
3
|
+
"_id": "minimatch@3.0.0",
|
4
|
+
"_location": "/tar-pack/rimraf/glob/minimatch",
|
5
|
+
"_nodeVersion": "4.0.0",
|
6
|
+
"_npmUser": {
|
7
|
+
"email": "isaacs@npmjs.com",
|
8
|
+
"name": "isaacs"
|
9
|
+
},
|
10
|
+
"_npmVersion": "3.3.2",
|
11
|
+
"_phantomChildren": {},
|
12
|
+
"_requiredBy": [
|
13
|
+
"/tar-pack/rimraf/glob"
|
14
|
+
],
|
15
|
+
"_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz",
|
16
|
+
"_shasum": "5236157a51e4f004c177fb3c527ff7dd78f0ef83",
|
17
|
+
"author": {
|
18
|
+
"email": "i@izs.me",
|
19
|
+
"name": "Isaac Z. Schlueter",
|
20
|
+
"url": "http://blog.izs.me"
|
21
|
+
},
|
22
|
+
"bugs": {
|
23
|
+
"url": "https://github.com/isaacs/minimatch/issues"
|
24
|
+
},
|
25
|
+
"dependencies": {
|
26
|
+
"brace-expansion": "^1.0.0"
|
27
|
+
},
|
28
|
+
"description": "a glob matcher in javascript",
|
29
|
+
"devDependencies": {
|
30
|
+
"standard": "^3.7.2",
|
31
|
+
"tap": "^1.2.0"
|
32
|
+
},
|
33
|
+
"directories": {},
|
34
|
+
"dist": {
|
35
|
+
"shasum": "5236157a51e4f004c177fb3c527ff7dd78f0ef83",
|
36
|
+
"tarball": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz"
|
37
|
+
},
|
38
|
+
"engines": {
|
39
|
+
"node": "*"
|
40
|
+
},
|
41
|
+
"files": [
|
42
|
+
"minimatch.js"
|
43
|
+
],
|
44
|
+
"gitHead": "270dbea567f0af6918cb18103e98c612aa717a20",
|
45
|
+
"homepage": "https://github.com/isaacs/minimatch#readme",
|
46
|
+
"license": "ISC",
|
47
|
+
"main": "minimatch.js",
|
48
|
+
"maintainers": [
|
49
|
+
{
|
50
|
+
"name": "isaacs",
|
51
|
+
"email": "i@izs.me"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"name": "minimatch",
|
55
|
+
"optionalDependencies": {},
|
56
|
+
"readme": "ERROR: No README data found!",
|
57
|
+
"repository": {
|
58
|
+
"type": "git",
|
59
|
+
"url": "git://github.com/isaacs/minimatch.git"
|
60
|
+
},
|
61
|
+
"scripts": {
|
62
|
+
"posttest": "standard minimatch.js test/*.js",
|
63
|
+
"test": "tap test/*.js"
|
64
|
+
},
|
65
|
+
"version": "3.0.0"
|
66
|
+
}
|
package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# once
|
2
|
+
|
3
|
+
Only call a function once.
|
4
|
+
|
5
|
+
## usage
|
6
|
+
|
7
|
+
```javascript
|
8
|
+
var once = require('once')
|
9
|
+
|
10
|
+
function load (file, cb) {
|
11
|
+
cb = once(cb)
|
12
|
+
loader.load('file')
|
13
|
+
loader.once('load', cb)
|
14
|
+
loader.once('error', cb)
|
15
|
+
}
|
16
|
+
```
|
17
|
+
|
18
|
+
Or add to the Function.prototype in a responsible way:
|
19
|
+
|
20
|
+
```javascript
|
21
|
+
// only has to be done once
|
22
|
+
require('once').proto()
|
23
|
+
|
24
|
+
function load (file, cb) {
|
25
|
+
cb = cb.once()
|
26
|
+
loader.load('file')
|
27
|
+
loader.once('load', cb)
|
28
|
+
loader.once('error', cb)
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
Ironically, the prototype feature makes this module twice as
|
33
|
+
complicated as necessary.
|
34
|
+
|
35
|
+
To check whether you function has been called, use `fn.called`. Once the
|
36
|
+
function is called for the first time the return value of the original
|
37
|
+
function is saved in `fn.value` and subsequent calls will continue to
|
38
|
+
return this value.
|
39
|
+
|
40
|
+
```javascript
|
41
|
+
var once = require('once')
|
42
|
+
|
43
|
+
function load (cb) {
|
44
|
+
cb = once(cb)
|
45
|
+
var stream = createStream()
|
46
|
+
stream.once('data', cb)
|
47
|
+
stream.once('end', function () {
|
48
|
+
if (!cb.called) cb(new Error('not found'))
|
49
|
+
})
|
50
|
+
}
|
51
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
The ISC License
|
2
|
+
|
3
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
4
|
+
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# wrappy
|
2
|
+
|
3
|
+
Callback wrapping utility
|
4
|
+
|
5
|
+
## USAGE
|
6
|
+
|
7
|
+
```javascript
|
8
|
+
var wrappy = require("wrappy")
|
9
|
+
|
10
|
+
// var wrapper = wrappy(wrapperFunction)
|
11
|
+
|
12
|
+
// make sure a cb is called only once
|
13
|
+
// See also: http://npm.im/once for this specific use case
|
14
|
+
var once = wrappy(function (cb) {
|
15
|
+
var called = false
|
16
|
+
return function () {
|
17
|
+
if (called) return
|
18
|
+
called = true
|
19
|
+
return cb.apply(this, arguments)
|
20
|
+
}
|
21
|
+
})
|
22
|
+
|
23
|
+
function printBoo () {
|
24
|
+
console.log('boo')
|
25
|
+
}
|
26
|
+
// has some rando property
|
27
|
+
printBoo.iAmBooPrinter = true
|
28
|
+
|
29
|
+
var onlyPrintOnce = once(printBoo)
|
30
|
+
|
31
|
+
onlyPrintOnce() // prints 'boo'
|
32
|
+
onlyPrintOnce() // does nothing
|
33
|
+
|
34
|
+
// random property is retained!
|
35
|
+
assert.equal(onlyPrintOnce.iAmBooPrinter, true)
|
36
|
+
```
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"_from": "wrappy@1",
|
3
|
+
"_id": "wrappy@1.0.1",
|
4
|
+
"_location": "/tar-pack/rimraf/glob/once/wrappy",
|
5
|
+
"_nodeVersion": "0.10.31",
|
6
|
+
"_npmUser": {
|
7
|
+
"email": "i@izs.me",
|
8
|
+
"name": "isaacs"
|
9
|
+
},
|
10
|
+
"_npmVersion": "2.0.0",
|
11
|
+
"_phantomChildren": {},
|
12
|
+
"_requiredBy": [
|
13
|
+
"/tar-pack/rimraf/glob/once"
|
14
|
+
],
|
15
|
+
"_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz",
|
16
|
+
"_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739",
|
17
|
+
"author": {
|
18
|
+
"email": "i@izs.me",
|
19
|
+
"name": "Isaac Z. Schlueter",
|
20
|
+
"url": "http://blog.izs.me/"
|
21
|
+
},
|
22
|
+
"bugs": {
|
23
|
+
"url": "https://github.com/npm/wrappy/issues"
|
24
|
+
},
|
25
|
+
"dependencies": {},
|
26
|
+
"description": "Callback wrapping utility",
|
27
|
+
"devDependencies": {
|
28
|
+
"tap": "^0.4.12"
|
29
|
+
},
|
30
|
+
"directories": {
|
31
|
+
"test": "test"
|
32
|
+
},
|
33
|
+
"dist": {
|
34
|
+
"shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739",
|
35
|
+
"tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
36
|
+
},
|
37
|
+
"gitHead": "006a8cbac6b99988315834c207896eed71fd069a",
|
38
|
+
"homepage": "https://github.com/npm/wrappy",
|
39
|
+
"license": "ISC",
|
40
|
+
"main": "wrappy.js",
|
41
|
+
"maintainers": [
|
42
|
+
{
|
43
|
+
"name": "isaacs",
|
44
|
+
"email": "i@izs.me"
|
45
|
+
}
|
46
|
+
],
|
47
|
+
"name": "wrappy",
|
48
|
+
"optionalDependencies": {},
|
49
|
+
"readme": "ERROR: No README data found!",
|
50
|
+
"repository": {
|
51
|
+
"type": "git",
|
52
|
+
"url": "git+https://github.com/npm/wrappy.git"
|
53
|
+
},
|
54
|
+
"scripts": {
|
55
|
+
"test": "tap test/*.js"
|
56
|
+
},
|
57
|
+
"version": "1.0.1"
|
58
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
var test = require('tap').test
|
2
|
+
var wrappy = require('../wrappy.js')
|
3
|
+
|
4
|
+
test('basic', function (t) {
|
5
|
+
function onceifier (cb) {
|
6
|
+
var called = false
|
7
|
+
return function () {
|
8
|
+
if (called) return
|
9
|
+
called = true
|
10
|
+
return cb.apply(this, arguments)
|
11
|
+
}
|
12
|
+
}
|
13
|
+
onceifier.iAmOnce = {}
|
14
|
+
var once = wrappy(onceifier)
|
15
|
+
t.equal(once.iAmOnce, onceifier.iAmOnce)
|
16
|
+
|
17
|
+
var called = 0
|
18
|
+
function boo () {
|
19
|
+
t.equal(called, 0)
|
20
|
+
called++
|
21
|
+
}
|
22
|
+
// has some rando property
|
23
|
+
boo.iAmBoo = true
|
24
|
+
|
25
|
+
var onlyPrintOnce = once(boo)
|
26
|
+
|
27
|
+
onlyPrintOnce() // prints 'boo'
|
28
|
+
onlyPrintOnce() // does nothing
|
29
|
+
t.equal(called, 1)
|
30
|
+
|
31
|
+
// random property is retained!
|
32
|
+
t.equal(onlyPrintOnce.iAmBoo, true)
|
33
|
+
|
34
|
+
var logs = []
|
35
|
+
var logwrap = wrappy(function (msg, cb) {
|
36
|
+
logs.push(msg + ' wrapping cb')
|
37
|
+
return function () {
|
38
|
+
logs.push(msg + ' before cb')
|
39
|
+
var ret = cb.apply(this, arguments)
|
40
|
+
logs.push(msg + ' after cb')
|
41
|
+
}
|
42
|
+
})
|
43
|
+
|
44
|
+
var c = logwrap('foo', function () {
|
45
|
+
t.same(logs, [ 'foo wrapping cb', 'foo before cb' ])
|
46
|
+
})
|
47
|
+
c()
|
48
|
+
t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ])
|
49
|
+
|
50
|
+
t.end()
|
51
|
+
})
|
@@ -0,0 +1,33 @@
|
|
1
|
+
// Returns a wrapper function that returns a wrapped callback
|
2
|
+
// The wrapper function should do some stuff, and return a
|
3
|
+
// presumably different callback function.
|
4
|
+
// This makes sure that own properties are retained, so that
|
5
|
+
// decorations and such are not lost along the way.
|
6
|
+
module.exports = wrappy
|
7
|
+
function wrappy (fn, cb) {
|
8
|
+
if (fn && cb) return wrappy(fn)(cb)
|
9
|
+
|
10
|
+
if (typeof fn !== 'function')
|
11
|
+
throw new TypeError('need wrapper function')
|
12
|
+
|
13
|
+
Object.keys(fn).forEach(function (k) {
|
14
|
+
wrapper[k] = fn[k]
|
15
|
+
})
|
16
|
+
|
17
|
+
return wrapper
|
18
|
+
|
19
|
+
function wrapper() {
|
20
|
+
var args = new Array(arguments.length)
|
21
|
+
for (var i = 0; i < args.length; i++) {
|
22
|
+
args[i] = arguments[i]
|
23
|
+
}
|
24
|
+
var ret = fn.apply(this, args)
|
25
|
+
var cb = args[args.length-1]
|
26
|
+
if (typeof ret === 'function' && ret !== cb) {
|
27
|
+
Object.keys(cb).forEach(function (k) {
|
28
|
+
ret[k] = cb[k]
|
29
|
+
})
|
30
|
+
}
|
31
|
+
return ret
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
var wrappy = require('wrappy')
|
2
|
+
module.exports = wrappy(once)
|
3
|
+
|
4
|
+
once.proto = once(function () {
|
5
|
+
Object.defineProperty(Function.prototype, 'once', {
|
6
|
+
value: function () {
|
7
|
+
return once(this)
|
8
|
+
},
|
9
|
+
configurable: true
|
10
|
+
})
|
11
|
+
})
|
12
|
+
|
13
|
+
function once (fn) {
|
14
|
+
var f = function () {
|
15
|
+
if (f.called) return f.value
|
16
|
+
f.called = true
|
17
|
+
return f.value = fn.apply(this, arguments)
|
18
|
+
}
|
19
|
+
f.called = false
|
20
|
+
return f
|
21
|
+
}
|