diff --git a/.eslintignore b/.eslintignore index 0be7057993e451..9b5c5fccb643e4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ lib/internal/v8_prof_polyfill.js -lib/internal/v8_prof_processor.js lib/punycode.js test/addons/??_*/ test/fixtures diff --git a/.eslintrc b/.eslintrc index 8e01cc4c94c0e4..af0e6ddc15670f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,7 +13,7 @@ rules: no-duplicate-case: 2 no-empty-character-class: 2 no-ex-assign: 2 - no-extra-boolean-cast : 2 + no-extra-boolean-cast: 2 no-extra-parens: [2, "functions"] no-extra-semi: 2 no-func-assign: 2 @@ -85,8 +85,9 @@ rules: prefer-const: 2 # Custom rules in tools/eslint-rules + assert-fail-single-argument: 2 new-with-error: [2, "Error", "RangeError", "TypeError", "SyntaxError", "ReferenceError"] - + align-multiline-assignment: 2 # Global scoped method and vars globals: diff --git a/.gitignore b/.gitignore index 734d92d4d719af..c7361af80c79dc 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,8 @@ _UpgradeReport_Files/ ipch/ *.sdf *.opensdf +*.VC.opendb +.vs/ /config.mk /config.gypi diff --git a/BUILDING.md b/BUILDING.md index c6e8656a72c40e..a4aa0808237c54 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -87,7 +87,14 @@ To test if Node.js was built correctly: $ node -e "console.log('Hello from Node.js ' + process.version)" ``` -### Android / Android based devices, aka. Firefox OS +### Android / Android-based devices (e.g., Firefox OS) + +Although these instructions for building on Android are provided, please note +that Android is not an officially supported platform at this time. Patches to +improve the Android build are accepted. However, there is no testing on Android +in the current continuous integration environment. The participation of people +dedicated and determined to improve Android building, testing, and support is +encouraged. Be sure you have downloaded and extracted [Android NDK] (https://developer.android.com/tools/sdk/ndk/index.html) diff --git a/CHANGELOG.md b/CHANGELOG.md index d994f0bff81cc3..7475345104cec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,127 @@ # Node.js ChangeLog +## 2016-04-21, Version 5.11.0 (Stable), @thealphanerd + +## Notable Changes + +* **Buffer**: + * `Buffer.prototype.compare` can now compare sub-ranges of two Buffers. (James M Snell) [#5880](https://github.com/nodejs/node/pull/5880) +* **deps**: + * update to http-parser 2.7.0 (Fedor Indutny) [#6279](https://github.com/nodejs/node/pull/6279) + * update ESLint to 2.7.0 (silverwind) [#6132](https://github.com/nodejs/node/pull/6132) +* **net**: + * adds support for passing DNS lookup hints to `createConnection()` (Colin Ihrig) [#6000](https://github.com/nodejs/node/pull/6000) +* **node**: + * Make the builtin libraries available for the `--eval` and `--print` CLI options (Anna Henningsen) [#6207](https://github.com/nodejs/node/pull/6207) +* **npm**: + * upgrade npm to 3.8.6 (Kat Marchán) [#6153](https://github.com/nodejs/node/pull/6153) +* **repl**: + * Pressing enter in the repl will repeat the last command by default if no input has been received. This behavior was in node previously and was not removed intentionally. (Rich Trott) [#6090](https://github.com/nodejs/node/pull/6090) +* **src**: + * add SIGINFO to supported signals (James Reggio) [#6093](https://github.com/nodejs/node/pull/6093) +* **streams**: + * Fix a regression that caused by net streams requesting multiple chunks synchronously when combined with cork/uncork (Matteo Collina) [#6164](https://github.com/nodejs/node/pull/6164) +* **zlib**: + * The flushing flag is now configurable allowing for decompression of partial data (Anna Henningsen) [#6069](https://github.com/nodejs/node/pull/6069) + +### Commits + +* [[`85cb9bb31d`](https://github.com/nodejs/node/commit/85cb9bb31d)] - **assert**: respect assert.doesNotThrow message. (Ilya Shaisultanov) [#2407](https://github.com/nodejs/node/pull/2407) +* [[`5807f9d378`](https://github.com/nodejs/node/commit/5807f9d378)] - **benchmark**: add module loader benchmark parameter (Brian White) [#5172](https://github.com/nodejs/node/pull/5172) +* [[`24ec70149c`](https://github.com/nodejs/node/commit/24ec70149c)] - **(SEMVER-MINOR)** **buffer**: add Buffer.prototype.compare by offset (James M Snell) [#5880](https://github.com/nodejs/node/pull/5880) +* [[`d44540f5af`](https://github.com/nodejs/node/commit/d44540f5af)] - **buffer**: standardize array index check (Trevor Norris) [#6084](https://github.com/nodejs/node/pull/6084) +* [[`68cf6a5e6a`](https://github.com/nodejs/node/commit/68cf6a5e6a)] - **build**: fix make tar-headers for Linux (Gibson Fahnestock) [#5978](https://github.com/nodejs/node/pull/5978) +* [[`95e9c0643a`](https://github.com/nodejs/node/commit/95e9c0643a)] - **build**: allow test-ci to run tests in parallel (Johan Bergström) [#6208](https://github.com/nodejs/node/pull/6208) +* [[`a5f8d0c6ef`](https://github.com/nodejs/node/commit/a5f8d0c6ef)] - **build**: remove -f{data,function}-sections flags (Ben Noordhuis) [#6077](https://github.com/nodejs/node/pull/6077) +* [[`2e6e2d6511`](https://github.com/nodejs/node/commit/2e6e2d6511)] - **child_process**: add nullptr checks after allocs (Anna Henningsen) [#6256](https://github.com/nodejs/node/pull/6256) +* [[`5c9dddf66f`](https://github.com/nodejs/node/commit/5c9dddf66f)] - **(SEMVER-MINOR)** **debugger**: run last command on presssing enter (Rich Trott) [#6090](https://github.com/nodejs/node/pull/6090) +* [[`b7dd451fef`](https://github.com/nodejs/node/commit/b7dd451fef)] - **deps**: update to http-parser 2.7.0 (Fedor Indutny) [#6279](https://github.com/nodejs/node/pull/6279) +* [[`f8c0ab98ae`](https://github.com/nodejs/node/commit/f8c0ab98ae)] - **deps**: floating fix for npm's test-node script (Kat Marchán) [#6153](https://github.com/nodejs/node/pull/6153) +* [[`1d669aba06`](https://github.com/nodejs/node/commit/1d669aba06)] - **deps**: upgrade npm to 3.8.6 (Kat Marchán) [#6153](https://github.com/nodejs/node/pull/6153) +* [[`a7104e4516`](https://github.com/nodejs/node/commit/a7104e4516)] - **deps**: cherry-pick 1383d00 from v8 upstream (Fedor Indutny) [#6179](https://github.com/nodejs/node/pull/6179) +* [[`632e6b9617`](https://github.com/nodejs/node/commit/632e6b9617)] - **deps**: backport 125ac66 from v8 upstream (Myles Borins) [#6086](https://github.com/nodejs/node/pull/6086) +* [[`5874502cba`](https://github.com/nodejs/node/commit/5874502cba)] - **doc**: git mv to .md (Robert Jefe Lindstaedt) [#4747](https://github.com/nodejs/node/pull/4747) +* [[`02a84e20ef`](https://github.com/nodejs/node/commit/02a84e20ef)] - **doc**: add full example for zlib.flush() (Anna Henningsen) [#6172](https://github.com/nodejs/node/pull/6172) +* [[`9f9371bd61`](https://github.com/nodejs/node/commit/9f9371bd61)] - **doc**: note that zlib.flush acts after pending writes (Anna Henningsen) [#6172](https://github.com/nodejs/node/pull/6172) +* [[`b74ddea66e`](https://github.com/nodejs/node/commit/b74ddea66e)] - **doc**: fix broken references (Alexander Gromnitsky) [#6100](https://github.com/nodejs/node/pull/6100) +* [[`b8ae1b86d4`](https://github.com/nodejs/node/commit/b8ae1b86d4)] - **doc**: path.format provide more examples (John Eversole) [#5838](https://github.com/nodejs/node/pull/5838) +* [[`91001d33cf`](https://github.com/nodejs/node/commit/91001d33cf)] - **doc**: replace functions with arrow functions (abouthiroppy) [#6203](https://github.com/nodejs/node/pull/6203) +* [[`038801d551`](https://github.com/nodejs/node/commit/038801d551)] - **doc**: DCO anchor that doesn't change (William Kapke) [#6257](https://github.com/nodejs/node/pull/6257) +* [[`5bf8d1a9bf`](https://github.com/nodejs/node/commit/5bf8d1a9bf)] - **doc**: fix http response event, Agent#getName (Matthew Douglass) [#5993](https://github.com/nodejs/node/pull/5993) +* [[`ea8fe043ae`](https://github.com/nodejs/node/commit/ea8fe043ae)] - **doc**: document intention and dangers of fs module Buffer API (Nikolai Vavilov) [#6020](https://github.com/nodejs/node/pull/6020) +* [[`5c4395bc1b`](https://github.com/nodejs/node/commit/5c4395bc1b)] - **doc**: explain differences in console.assert between node and browsers (James M Snell) [#6169](https://github.com/nodejs/node/pull/6169) +* [[`90eb765c51`](https://github.com/nodejs/node/commit/90eb765c51)] - **doc**: native module reloading is not supported (Bryan English) [#6168](https://github.com/nodejs/node/pull/6168) +* [[`bb97de0c04`](https://github.com/nodejs/node/commit/bb97de0c04)] - **doc**: clarify fs.watch() and inodes on linux, os x (Joran Dirk Greef) [#6099](https://github.com/nodejs/node/pull/6099) +* [[`1796e49546`](https://github.com/nodejs/node/commit/1796e49546)] - **doc**: add domain postmortem (Trevor Norris) [#6159](https://github.com/nodejs/node/pull/6159) +* [[`02bf4599db`](https://github.com/nodejs/node/commit/02bf4599db)] - **doc**: add stefanmb to collaborators (Stefan Budeanu) [#6227](https://github.com/nodejs/node/pull/6227) +* [[`4a2b53a002`](https://github.com/nodejs/node/commit/4a2b53a002)] - **doc**: add iWuzHere to collaborators (Imran Iqbal) [#6226](https://github.com/nodejs/node/pull/6226) +* [[`9d3317a327`](https://github.com/nodejs/node/commit/9d3317a327)] - **doc**: add santigimeno to collaborators (Santiago Gimeno) [#6225](https://github.com/nodejs/node/pull/6225) +* [[`33647030d2`](https://github.com/nodejs/node/commit/33647030d2)] - **doc**: add addaleax to collaborators (Anna Henningsen) [#6224](https://github.com/nodejs/node/pull/6224) +* [[`6bc3bde47e`](https://github.com/nodejs/node/commit/6bc3bde47e)] - **doc**: fix incorrect references in buffer docs (Amery) [#6194](https://github.com/nodejs/node/pull/6194) +* [[`b26fea1595`](https://github.com/nodejs/node/commit/b26fea1595)] - **doc**: add copy about how to curl SHA256.txt (Myles Borins) [#6120](https://github.com/nodejs/node/pull/6120) +* [[`daaad47099`](https://github.com/nodejs/node/commit/daaad47099)] - **doc**: clarification for maxBuffer and Unicode output (James M Snell) [#6030](https://github.com/nodejs/node/pull/6030) +* [[`5e6915f374`](https://github.com/nodejs/node/commit/5e6915f374)] - **doc**: describe child.kill() pitfalls on linux (Robert Jefe Lindstaedt) [#2098](https://github.com/nodejs/node/issues/2098) +* [[`a40d0e8f9d`](https://github.com/nodejs/node/commit/a40d0e8f9d)] - **doc**: fix scrolling on iOS devices (Luigi Pinca) [#5878](https://github.com/nodejs/node/pull/5878) +* [[`a81fca4f99`](https://github.com/nodejs/node/commit/a81fca4f99)] - **doc**: add topic - event loop, timers, `nextTick()` (Jeff Harris) [#4936](https://github.com/nodejs/node/pull/4936) +* [[`440d1172fd`](https://github.com/nodejs/node/commit/440d1172fd)] - **doc**: add example using algorithms not directly exposed (Brad Hill) [#6108](https://github.com/nodejs/node/pull/6108) +* [[`96ad5c5303`](https://github.com/nodejs/node/commit/96ad5c5303)] - **doc**: update openssl LICENSE using license-builder.sh (Steven R. Loomis) [#6065](https://github.com/nodejs/node/pull/6065) +* [[`07829b0bc9`](https://github.com/nodejs/node/commit/07829b0bc9)] - **doc**: simple doc typo fix (Brendon Pierson) [#6041](https://github.com/nodejs/node/pull/6041) +* [[`bc0ee06226`](https://github.com/nodejs/node/commit/bc0ee06226)] - **doc**: note about Android support (Rich Trott) [#6040](https://github.com/nodejs/node/pull/6040) +* [[`60a73a2ed2`](https://github.com/nodejs/node/commit/60a73a2ed2)] - **doc**: fix a typo in 5.10.1's changelog (Vladimir Varankin) [#6076](https://github.com/nodejs/node/pull/6076) +* [[`90aabb9b8a`](https://github.com/nodejs/node/commit/90aabb9b8a)] - **gitignore**: adding .vs/ directory to .gitignore (Mike Kaufman) [#6070](https://github.com/nodejs/node/pull/6070) +* [[`93f91c60af`](https://github.com/nodejs/node/commit/93f91c60af)] - **gitignore**: ignore VS 2015 *.VC.opendb files (Mike Kaufman) [#6070](https://github.com/nodejs/node/pull/6070) +* [[`d9cd449aa7`](https://github.com/nodejs/node/commit/d9cd449aa7)] - **http**: disallow sending obviously invalid status codes (Brian White) [#6291](https://github.com/nodejs/node/pull/6291) +* [[`f6969a1608`](https://github.com/nodejs/node/commit/f6969a1608)] - **http**: skip body and next message of CONNECT res (Fedor Indutny) [#6279](https://github.com/nodejs/node/pull/6279) +* [[`8ccfb87e1a`](https://github.com/nodejs/node/commit/8ccfb87e1a)] - **http**: unref socket timer on parser execute (Fedor Indutny) [#6286](https://github.com/nodejs/node/pull/6286) +* [[`d4abca5b27`](https://github.com/nodejs/node/commit/d4abca5b27)] - **lib**: remove bootstrap global context indirection (Jeremiah Senkpiel) [#5881](https://github.com/nodejs/node/pull/5881) +* [[`90c12a969c`](https://github.com/nodejs/node/commit/90c12a969c)] - **lib,test,tools**: alignment on variable assignments (Rich Trott) [#6242](https://github.com/nodejs/node/pull/6242) +* [[`36c58da315`](https://github.com/nodejs/node/commit/36c58da315)] - **net**: replace __defineGetter__ with defineProperty (Fedor Indutny) [#6284](https://github.com/nodejs/node/pull/6284) +* [[`6d9c0c9aa7`](https://github.com/nodejs/node/commit/6d9c0c9aa7)] - **(SEMVER-MINOR)** **net**: support DNS hints in createConnection() (Colin Ihrig) [#6000](https://github.com/nodejs/node/pull/6000) +* [[`87e0734135`](https://github.com/nodejs/node/commit/87e0734135)] - **(SEMVER-MINOR)** **node**: make builtin libs available for `--eval` (Anna Henningsen) [#6207](https://github.com/nodejs/node/pull/6207) +* [[`fc89d17656`](https://github.com/nodejs/node/commit/fc89d17656)] - **path**: fixing a test that breaks on some machines. (Mike Kaufman) [#6067](https://github.com/nodejs/node/pull/6067) +* [[`fbb0a06080`](https://github.com/nodejs/node/commit/fbb0a06080)] - **process**: fix incorrect usage of assert.fail() (Rich Trott) [#6211](https://github.com/nodejs/node/pull/6211) +* [[`40945e01c3`](https://github.com/nodejs/node/commit/40945e01c3)] - **(SEMVER-MINOR)** **repl**: keep the built-in modules non-enumerable (Anna Henningsen) [#6207](https://github.com/nodejs/node/pull/6207) +* [[`2254f1a175`](https://github.com/nodejs/node/commit/2254f1a175)] - **repl**: refactor repl.js (Rich Trott) [#6071](https://github.com/nodejs/node/pull/6071) +* [[`9f2dc70081`](https://github.com/nodejs/node/commit/9f2dc70081)] - **(SEMVER-MINOR)** **src**: add SIGINFO to supported signals (James Reggio) [#6093](https://github.com/nodejs/node/pull/6093) +* [[`fbc99ba4f1`](https://github.com/nodejs/node/commit/fbc99ba4f1)] - **src**: add missing 'inline' keywords (Ben Noordhuis) [#6056](https://github.com/nodejs/node/pull/6056) +* [[`20bb92f5c8`](https://github.com/nodejs/node/commit/20bb92f5c8)] - **src**: use size_t for http parser array size fields (Ben Noordhuis) [#5969](https://github.com/nodejs/node/pull/5969) +* [[`2fd8be2dbe`](https://github.com/nodejs/node/commit/2fd8be2dbe)] - **src**: replace ARRAY_SIZE with typesafe arraysize (Ben Noordhuis) [#5969](https://github.com/nodejs/node/pull/5969) +* [[`4392b4aee0`](https://github.com/nodejs/node/commit/4392b4aee0)] - **stream**: Fix readableState.awaitDrain mechanism (Anna Henningsen) [#6023](https://github.com/nodejs/node/pull/6023) +* [[`052d87c167`](https://github.com/nodejs/node/commit/052d87c167)] - **stream_base**: expose `bytesRead` getter (Fedor Indutny) [#6284](https://github.com/nodejs/node/pull/6284) +* [[`f69416c06e`](https://github.com/nodejs/node/commit/f69416c06e)] - **streams**: support unlimited synchronous cork/uncork cycles (Matteo Collina) [#6164](https://github.com/nodejs/node/pull/6164) +* [[`3bacd1989b`](https://github.com/nodejs/node/commit/3bacd1989b)] - **test**: add zlib close-after-error regression test (Anna Henningsen) [#6270](https://github.com/nodejs/node/pull/6270) +* [[`033b21bc78`](https://github.com/nodejs/node/commit/033b21bc78)] - **test**: move more tests from sequential to parallel (Santiago Gimeno) [#6187](https://github.com/nodejs/node/pull/6187) +* [[`df93d6bfd2`](https://github.com/nodejs/node/commit/df93d6bfd2)] - **test**: assert - fixed error messages to match the tests (surya panikkal) [#6241](https://github.com/nodejs/node/pull/6241) +* [[`1ef18bd038`](https://github.com/nodejs/node/commit/1ef18bd038)] - **test**: add test for responses to HTTP CONNECT req (Josh Leder) [#6279](https://github.com/nodejs/node/pull/6279) +* [[`8779967d4b`](https://github.com/nodejs/node/commit/8779967d4b)] - **test**: move debugger tests to sequential (Rich Trott) [#6205](https://github.com/nodejs/node/pull/6205) +* [[`9293946dd6`](https://github.com/nodejs/node/commit/9293946dd6)] - **test**: move some test from sequential to parallel (Santiago Gimeno) [#6087](https://github.com/nodejs/node/pull/6087) +* [[`b0ba16f966`](https://github.com/nodejs/node/commit/b0ba16f966)] - **test**: move the debugger tests back to parallel (Santiago Gimeno) [#6246](https://github.com/nodejs/node/pull/6246) +* [[`8077b899f4`](https://github.com/nodejs/node/commit/8077b899f4)] - **test**: fix issues for ESLint 2.7.0 (silverwind) [#6132](https://github.com/nodejs/node/pull/6132) +* [[`1af0e4499c`](https://github.com/nodejs/node/commit/1af0e4499c)] - **test**: fix flaky test-http-set-timeout-server (Santiago Gimeno) [#6248](https://github.com/nodejs/node/pull/6248) +* [[`68c32833c6`](https://github.com/nodejs/node/commit/68c32833c6)] - **test**: fix test-net-settimeout flakiness (Santiago Gimeno) [#6166](https://github.com/nodejs/node/pull/6166) +* [[`a38b614ae9`](https://github.com/nodejs/node/commit/a38b614ae9)] - **test**: fix flaky test-child-process-fork-net (Rich Trott) [#6138](https://github.com/nodejs/node/pull/6138) +* [[`476535cc0e`](https://github.com/nodejs/node/commit/476535cc0e)] - **test**: fix flaky test-http-client-abort (Rich Trott) [#6124](https://github.com/nodejs/node/pull/6124) +* [[`6bb7999bd6`](https://github.com/nodejs/node/commit/6bb7999bd6)] - **test**: refactor test-file-write-stream3 (Rich Trott) [#6050](https://github.com/nodejs/node/pull/6050) +* [[`a27e95231e`](https://github.com/nodejs/node/commit/a27e95231e)] - **test**: enforce strict mode for test-domain-crypto (Rich Trott) [#6047](https://github.com/nodejs/node/pull/6047) +* [[`8da4bad1c9`](https://github.com/nodejs/node/commit/8da4bad1c9)] - **test**: fix pummel test failures (Rich Trott) [#6012](https://github.com/nodejs/node/pull/6012) +* [[`fb2a9784a3`](https://github.com/nodejs/node/commit/fb2a9784a3)] - **test,tools**: enable linting for undefined vars (Rich Trott) [#6255](https://github.com/nodejs/node/pull/6255) +* [[`01d4522763`](https://github.com/nodejs/node/commit/01d4522763)] - **test,vm**: enable strict mode for vm tests (Rich Trott) [#6209](https://github.com/nodejs/node/pull/6209) +* [[`73eac79138`](https://github.com/nodejs/node/commit/73eac79138)] - **tools**: lint rule for assert.fail() (Rich Trott) [#6261](https://github.com/nodejs/node/pull/6261) +* [[`8877703fc4`](https://github.com/nodejs/node/commit/8877703fc4)] - **tools**: enable linting for v8_prof_processor.js (Rich Trott) [#6262](https://github.com/nodejs/node/pull/6262) +* [[`68925360ee`](https://github.com/nodejs/node/commit/68925360ee)] - **tools**: move message listener to worker objects (Brian White) [#6212](https://github.com/nodejs/node/pull/6212) +* [[`713f6ff67a`](https://github.com/nodejs/node/commit/713f6ff67a)] - **tools**: improve js linter (Brian White) [#5638](https://github.com/nodejs/node/pull/5638) +* [[`7ea5e43b98`](https://github.com/nodejs/node/commit/7ea5e43b98)] - **tools**: lint for alignment of variable assignments (Rich Trott) [#6242](https://github.com/nodejs/node/pull/6242) +* [[`3ce59abb35`](https://github.com/nodejs/node/commit/3ce59abb35)] - **tools**: update ESLint to 2.7.0 (silverwind) [#6132](https://github.com/nodejs/node/pull/6132) +* [[`fb646309e2`](https://github.com/nodejs/node/commit/fb646309e2)] - **tools**: fix license-builder.sh again for ICU (Steven R. Loomis) [#6068](https://github.com/nodejs/node/pull/6068) +* [[`fabc33a075`](https://github.com/nodejs/node/commit/fabc33a075)] - **tools**: remove simplejson dependency (Sakthipriyan Vairamani) [#6101](https://github.com/nodejs/node/pull/6101) +* [[`0658632c08`](https://github.com/nodejs/node/commit/0658632c08)] - **tools,doc**: parse types in braces everywhere (Alexander Makarenko) [#5329](https://github.com/nodejs/node/pull/5329) +* [[`69eb4a6834`](https://github.com/nodejs/node/commit/69eb4a6834)] - **tools,doc**: fix json for grouped optional params (firedfox) [#5977](https://github.com/nodejs/node/pull/5977) +* [[`a2dd848764`](https://github.com/nodejs/node/commit/a2dd848764)] - **tools,doc**: fix incomplete json produced by doctool (firedfox) [#5966](https://github.com/nodejs/node/pull/5966) +* [[`4f6f59977a`](https://github.com/nodejs/node/commit/4f6f59977a)] - **zlib**: fix use after null when calling .close (James Lal) [#5982](https://github.com/nodejs/node/pull/5982) +* [[`2ac14ee81f`](https://github.com/nodejs/node/commit/2ac14ee81f)] - **(SEMVER-MINOR)** **zlib**: Make the finish flush flag configurable (Anna Henningsen) [#6069](https://github.com/nodejs/node/pull/6069) +* [[`3a5dd024d3`](https://github.com/nodejs/node/commit/3a5dd024d3)] - **(SEMVER-MINOR)** **zlib**: detect gzip files when using unzip* (Anna Henningsen) [#5884](https://github.com/nodejs/node/pull/5884) +* [[`61167c3e23`](https://github.com/nodejs/node/commit/61167c3e23)] - **zlib**: fix gzip member head/buffer boundary issue (Anna Henningsen) [#5973](https://github.com/nodejs/node/pull/5973) + ## 2016-04-05, Version 5.10.1 (Stable), @thealphanerd ### Notable changes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e37da91ce8a193..bce91a3603cbed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,7 +49,7 @@ and built upon. #### Respect the stability index The rules for the master branch are less strict; consult the -[stability index](./doc/api/documentation.markdown#stability-index) for details. +[stability index](./doc/api/documentation..md#stability-index) for details. In a nutshell, modules are at varying levels of API stability. Bug fixes are always welcome but API or behavioral changes to modules at stability level 3 @@ -173,6 +173,7 @@ to address, apply your changes in a separate commit and push that to your feature branch. Post a comment in the pull request afterwards; GitHub does not send out notifications when you add commits. + ## Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: diff --git a/LICENSE b/LICENSE index f527a1c8b23124..d0d07f7d429145 100644 --- a/LICENSE +++ b/LICENSE @@ -102,44 +102,51 @@ The externally maintained libraries used by Node.js are: COPYRIGHT AND PERMISSION NOTICE - Copyright (c) 1995-2015 International Business Machines Corporation and others + Copyright (c) 1995-2016 International Business Machines Corporation and others All rights reserved. - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, and/or sell - copies of the Software, and to permit persons + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above - copyright notice(s) and this permission notice appear in all copies - of the Software and that both the above copyright notice(s) and this + copyright notice(s) and this permission notice appear in all copies of + the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL - THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, - OR ANY SPECIAL 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. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY + SPECIAL 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. - Except as contained in this notice, the name of a copyright holder shall not be - used in advertising or otherwise to promote the sale, use or other dealings in - this Software without prior written authorization of the copyright holder. + Except as contained in this notice, the name of a copyright holder + shall not be used in advertising or otherwise to promote the sale, use + or other dealings in this Software without prior written authorization + of the copyright holder. - All trademarks and registered trademarks mentioned herein are the property of their respective owners. + All trademarks and registered trademarks mentioned herein are the + property of their respective owners. + + --------------------- Third-Party Software Licenses - This section contains third-party software notices and/or additional terms for licensed - third-party software components included within ICU libraries. + + This section contains third-party software notices and/or additional + terms for licensed third-party software components included within ICU + libraries. 1. Unicode Data Files and Software COPYRIGHT AND PERMISSION NOTICE - Copyright © 1991-2015 Unicode, Inc. All rights reserved. + Copyright © 1991-2016 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. @@ -177,281 +184,312 @@ The externally maintained libraries used by Node.js are: 2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt) - # The Google Chrome software developed by Google is licensed under the BSD license. Other software included in this distribution is provided under other licenses, as set forth below. + # The Google Chrome software developed by Google is licensed under + # the BSD license. Other software included in this distribution is + # provided under other licenses, as set forth below. # - # The BSD License - # http://opensource.org/licenses/bsd-license.php - # Copyright (C) 2006-2008, Google Inc. + # The BSD License + # http://opensource.org/licenses/bsd-license.php + # Copyright (C) 2006-2008, Google Inc. # - # All rights reserved. + # All rights reserved. # - # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: # - # Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - # Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - # Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + # Redistributions of source code must retain the above copyright notice, + # this list of conditions and the following disclaimer. + # Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided with + # the distribution. + # Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. # # - # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # - # The word list in cjdict.txt are generated by combining three word lists listed - # below with further processing for compound word breaking. The frequency is generated - # with an iterative training against Google web corpora. + # The word list in cjdict.txt are generated by combining three word lists + # listed below with further processing for compound word breaking. The + # frequency is generated with an iterative training against Google web + # corpora. # - # * Libtabe (Chinese) - # - https://sourceforge.net/project/?group_id=1519 - # - Its license terms and conditions are shown below. + # * Libtabe (Chinese) + # - https://sourceforge.net/project/?group_id=1519 + # - Its license terms and conditions are shown below. # - # * IPADIC (Japanese) - # - http://chasen.aist-nara.ac.jp/chasen/distribution.html - # - Its license terms and conditions are shown below. + # * IPADIC (Japanese) + # - http://chasen.aist-nara.ac.jp/chasen/distribution.html + # - Its license terms and conditions are shown below. # - # ---------COPYING.libtabe ---- BEGIN-------------------- + # ---------COPYING.libtabe ---- BEGIN-------------------- # - # /* - # * Copyrighy (c) 1999 TaBE Project. - # * Copyright (c) 1999 Pai-Hsiang Hsiao. - # * All rights reserved. - # * - # * Redistribution and use in source and binary forms, with or without - # * modification, are permitted provided that the following conditions - # * are met: - # * - # * . Redistributions of source code must retain the above copyright - # * notice, this list of conditions and the following disclaimer. - # * . Redistributions in binary form must reproduce the above copyright - # * notice, this list of conditions and the following disclaimer in - # * the documentation and/or other materials provided with the - # * distribution. - # * . Neither the name of the TaBE Project nor the names of its - # * contributors may be used to endorse or promote products derived - # * from this software without specific prior written permission. - # * - # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - # * OF THE POSSIBILITY OF SUCH DAMAGE. - # */ + # /* + # * Copyrighy (c) 1999 TaBE Project. + # * Copyright (c) 1999 Pai-Hsiang Hsiao. + # * All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the TaBE Project nor the names of its + # * contributors may be used to endorse or promote products derived + # * from this software without specific prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ # - # /* - # * Copyright (c) 1999 Computer Systems and Communication Lab, - # * Institute of Information Science, Academia Sinica. - # * All rights reserved. - # * - # * Redistribution and use in source and binary forms, with or without - # * modification, are permitted provided that the following conditions - # * are met: - # * - # * . Redistributions of source code must retain the above copyright - # * notice, this list of conditions and the following disclaimer. - # * . Redistributions in binary form must reproduce the above copyright - # * notice, this list of conditions and the following disclaimer in - # * the documentation and/or other materials provided with the - # * distribution. - # * . Neither the name of the Computer Systems and Communication Lab - # * nor the names of its contributors may be used to endorse or - # * promote products derived from this software without specific - # * prior written permission. - # * - # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - # * OF THE POSSIBILITY OF SUCH DAMAGE. - # */ + # /* + # * Copyright (c) 1999 Computer Systems and Communication Lab, + # * Institute of Information Science, Academia + # * Sinica. All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the Computer Systems and Communication Lab + # * nor the names of its contributors may be used to endorse or + # * promote products derived from this software without specific + # * prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ # - # Copyright 1996 Chih-Hao Tsai @ Beckman Institute, University of Illinois - # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 + # Copyright 1996 Chih-Hao Tsai @ Beckman Institute, + # University of Illinois + # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 # - # ---------------COPYING.libtabe-----END------------------------------------ + # ---------------COPYING.libtabe-----END-------------------------------- # # - # ---------------COPYING.ipadic-----BEGIN------------------------------------ + # ---------------COPYING.ipadic-----BEGIN------------------------------- # - # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science - # and Technology. All Rights Reserved. + # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science + # and Technology. All Rights Reserved. # - # Use, reproduction, and distribution of this software is permitted. - # Any copy of this software, whether in its original form or modified, - # must include both the above copyright notice and the following - # paragraphs. + # Use, reproduction, and distribution of this software is permitted. + # Any copy of this software, whether in its original form or modified, + # must include both the above copyright notice and the following + # paragraphs. # - # Nara Institute of Science and Technology (NAIST), - # the copyright holders, disclaims all warranties with regard to this - # software, including all implied warranties of merchantability and - # fitness, in no event shall NAIST be liable for - # any special, 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 tortuous action, arising out - # of or in connection with the use or performance of this software. + # Nara Institute of Science and Technology (NAIST), + # the copyright holders, disclaims all warranties with regard to this + # software, including all implied warranties of merchantability and + # fitness, in no event shall NAIST be liable for + # any special, 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 tortuous action, arising out + # of or in connection with the use or performance of this software. # - # A large portion of the dictionary entries - # originate from ICOT Free Software. The following conditions for ICOT - # Free Software applies to the current dictionary as well. + # A large portion of the dictionary entries + # originate from ICOT Free Software. The following conditions for ICOT + # Free Software applies to the current dictionary as well. # - # Each User may also freely distribute the Program, whether in its - # original form or modified, to any third party or parties, PROVIDED - # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear - # on, or be attached to, the Program, which is distributed substantially - # in the same form as set out herein and that such intended - # distribution, if actually made, will neither violate or otherwise - # contravene any of the laws and regulations of the countries having - # jurisdiction over the User or the intended distribution itself. + # Each User may also freely distribute the Program, whether in its + # original form or modified, to any third party or parties, PROVIDED + # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear + # on, or be attached to, the Program, which is distributed substantially + # in the same form as set out herein and that such intended + # distribution, if actually made, will neither violate or otherwise + # contravene any of the laws and regulations of the countries having + # jurisdiction over the User or the intended distribution itself. # - # NO WARRANTY + # NO WARRANTY # - # The program was produced on an experimental basis in the course of the - # research and development conducted during the project and is provided - # to users as so produced on an experimental basis. Accordingly, the - # program is provided without any warranty whatsoever, whether express, - # implied, statutory or otherwise. The term "warranty" used herein - # includes, but is not limited to, any warranty of the quality, - # performance, merchantability and fitness for a particular purpose of - # the program and the nonexistence of any infringement or violation of - # any right of any third party. + # The program was produced on an experimental basis in the course of the + # research and development conducted during the project and is provided + # to users as so produced on an experimental basis. Accordingly, the + # program is provided without any warranty whatsoever, whether express, + # implied, statutory or otherwise. The term "warranty" used herein + # includes, but is not limited to, any warranty of the quality, + # performance, merchantability and fitness for a particular purpose of + # the program and the nonexistence of any infringement or violation of + # any right of any third party. # - # Each user of the program will agree and understand, and be deemed to - # have agreed and understood, that there is no warranty whatsoever for - # the program and, accordingly, the entire risk arising from or - # otherwise connected with the program is assumed by the user. + # Each user of the program will agree and understand, and be deemed to + # have agreed and understood, that there is no warranty whatsoever for + # the program and, accordingly, the entire risk arising from or + # otherwise connected with the program is assumed by the user. # - # Therefore, neither ICOT, the copyright holder, or any other - # organization that participated in or was otherwise related to the - # development of the program and their respective officials, directors, - # officers and other employees shall be held liable for any and all - # damages, including, without limitation, general, special, incidental - # and consequential damages, arising out of or otherwise in connection - # with the use or inability to use the program or any product, material - # or result produced or otherwise obtained by using the program, - # regardless of whether they have been advised of, or otherwise had - # knowledge of, the possibility of such damages at any time during the - # project or thereafter. Each user will be deemed to have agreed to the - # foregoing by his or her commencement of use of the program. The term - # "use" as used herein includes, but is not limited to, the use, - # modification, copying and distribution of the program and the - # production of secondary products from the program. + # Therefore, neither ICOT, the copyright holder, or any other + # organization that participated in or was otherwise related to the + # development of the program and their respective officials, directors, + # officers and other employees shall be held liable for any and all + # damages, including, without limitation, general, special, incidental + # and consequential damages, arising out of or otherwise in connection + # with the use or inability to use the program or any product, material + # or result produced or otherwise obtained by using the program, + # regardless of whether they have been advised of, or otherwise had + # knowledge of, the possibility of such damages at any time during the + # project or thereafter. Each user will be deemed to have agreed to the + # foregoing by his or her commencement of use of the program. The term + # "use" as used herein includes, but is not limited to, the use, + # modification, copying and distribution of the program and the + # production of secondary products from the program. # - # In the case where the program, whether in its original form or - # modified, was distributed or delivered to or received by a user from - # any person, organization or entity other than ICOT, unless it makes or - # grants independently of ICOT any specific warranty to the user in - # writing, such person, organization or entity, will also be exempted - # from and not be held liable to the user for any such damages as noted - # above as far as the program is concerned. + # In the case where the program, whether in its original form or + # modified, was distributed or delivered to or received by a user from + # any person, organization or entity other than ICOT, unless it makes or + # grants independently of ICOT any specific warranty to the user in + # writing, such person, organization or entity, will also be exempted + # from and not be held liable to the user for any such damages as noted + # above as far as the program is concerned. # - # ---------------COPYING.ipadic-----END------------------------------------ + # ---------------COPYING.ipadic-----END---------------------------------- 3. Lao Word Break Dictionary Data (laodict.txt) - # Copyright (c) 2013 International Business Machines Corporation - # and others. All Rights Reserved. + # Copyright (c) 2013 International Business Machines Corporation + # and others. All Rights Reserved. # - # Project: http://code.google.com/p/lao-dictionary/ + # Project: http://code.google.com/p/lao-dictionary/ # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt - # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt - # (copied below) + # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt + # (copied below) # - # This file is derived from the above dictionary, with slight modifications. - # -------------------------------------------------------------------------------- - # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. - # All rights reserved. + # This file is derived from the above dictionary, with slight + # modifications. + # ---------------------------------------------------------------------- + # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. + # All rights reserved. # - # Redistribution and use in source and binary forms, with or without modification, - # are permitted provided that the following conditions are met: + # Redistribution and use in source and binary forms, with or without + # modification, + # are permitted provided that the following conditions are met: # - # Redistributions of source code must retain the above copyright notice, this - # list of conditions and the following disclaimer. Redistributions in binary - # form must reproduce the above copyright notice, this list of conditions and - # the following disclaimer in the documentation and/or other materials - # provided with the distribution. # - # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - # -------------------------------------------------------------------------------- + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. Redistributions in + # binary form must reproduce the above copyright notice, this list of + # conditions and the following disclaimer in the documentation and/or + # other materials provided with the distribution. + # + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # OF THE POSSIBILITY OF SUCH DAMAGE. + # -------------------------------------------------------------------------- 4. Burmese Word Break Dictionary Data (burmesedict.txt) - # Copyright (c) 2014 International Business Machines Corporation - # and others. All Rights Reserved. - # - # This list is part of a project hosted at: - # github.com/kanyawtech/myanmar-karen-word-lists + # Copyright (c) 2014 International Business Machines Corporation + # and others. All Rights Reserved. # - # -------------------------------------------------------------------------------- - # Copyright (c) 2013, LeRoy Benjamin Sharon - # All rights reserved. + # This list is part of a project hosted at: + # github.com/kanyawtech/myanmar-karen-word-lists # - # Redistribution and use in source and binary forms, with or without modification, - # are permitted provided that the following conditions are met: + # -------------------------------------------------------------------------- + # Copyright (c) 2013, LeRoy Benjamin Sharon + # All rights reserved. # - # Redistributions of source code must retain the above copyright notice, this - # list of conditions and the following disclaimer. + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions + # are met: Redistributions of source code must retain the above + # copyright notice, this list of conditions and the following + # disclaimer. Redistributions in binary form must reproduce the + # above copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided + # with the distribution. # - # Redistributions in binary form must reproduce the above copyright notice, this - # list of conditions and the following disclaimer in the documentation and/or - # other materials provided with the distribution. + # Neither the name Myanmar Karen Word Lists, nor the names of its + # contributors may be used to endorse or promote products derived + # from this software without specific prior written permission. # - # Neither the name Myanmar Karen Word Lists, nor the names of its - # contributors may be used to endorse or promote products derived from - # this software without specific prior written permission. - # - # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - # -------------------------------------------------------------------------------- + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + # SUCH DAMAGE. + # -------------------------------------------------------------------------- 5. Time Zone Database - ICU uses the public domain data and code derived from - Time Zone Database for its time zone support. The ownership of the TZ database is explained - in BCP 175: Procedure for Maintaining the Time Zone + + ICU uses the public domain data and code derived from Time Zone + Database for its time zone support. The ownership of the TZ database + is explained in BCP 175: Procedure for Maintaining the Time Zone Database section 7. - 7. Database Ownership - - The TZ database itself is not an IETF Contribution or an IETF - document. Rather it is a pre-existing and regularly updated work - that is in the public domain, and is intended to remain in the public - domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do not apply - to the TZ Database or contributions that individuals make to it. - Should any claims be made and substantiated against the TZ Database, - the organization that is providing the IANA Considerations defined in - this RFC, under the memorandum of understanding with the IETF, - currently ICANN, may act in accordance with all competent court - orders. No ownership claims will be made by ICANN or the IETF Trust - on the database or the code. Any person making a contribution to the - database or code waives all rights to future claims in that - contribution or in the TZ Database. + # 7. Database Ownership + # + # The TZ database itself is not an IETF Contribution or an IETF + # document. Rather it is a pre-existing and regularly updated work + # that is in the public domain, and is intended to remain in the + # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do + # not apply to the TZ Database or contributions that individuals make + # to it. Should any claims be made and substantiated against the TZ + # Database, the organization that is providing the IANA + # Considerations defined in this RFC, under the memorandum of + # understanding with the IETF, currently ICANN, may act in accordance + # with all competent court orders. No ownership claims will be made + # by ICANN or the IETF Trust on the database or the code. Any person + # making a contribution to the database or code waives all rights to + # future claims in that contribution or in the TZ Database. """ - libuv, located at deps/uv, is licensed as follows: @@ -506,7 +544,7 @@ The externally maintained libraries used by Node.js are: - OpenSSL, located at deps/openssl, is licensed as follows: """ - Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. + Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/Makefile b/Makefile index b4edaee1bf29ba..c01b10f14a8a23 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,12 @@ PREFIX ?= /usr/local FLAKY_TESTS ?= run TEST_CI_ARGS ?= STAGINGSERVER ?= node-www - OSTYPE := $(shell uname -s | tr '[A-Z]' '[a-z]') +ifdef JOBS + PARALLEL_ARGS = -j $(JOBS) +endif + ifdef QUICKCHECK QUICKCHECK_ARG := --quickcheck endif @@ -128,7 +131,7 @@ test/gc/node_modules/weak/build/Release/weakref.node: $(NODE_EXE) --nodedir="$(shell pwd)" # Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale. -test/addons/.docbuildstamp: doc/api/addons.markdown +test/addons/.docbuildstamp: doc/api/addons.md $(RM) -r test/addons/??_*/ $(NODE) tools/doc/addon-verify.js touch $@ @@ -168,7 +171,8 @@ test-all-valgrind: test-build $(PYTHON) tools/test.py --mode=debug,release --valgrind test-ci: | build-addons - $(PYTHON) tools/test.py -p tap --logfile test.tap --mode=release --flaky-tests=$(FLAKY_TESTS) \ + $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ + --mode=release --flaky-tests=$(FLAKY_TESTS) \ $(TEST_CI_ARGS) addons message parallel sequential test-release: test-build @@ -235,9 +239,9 @@ test-v8-benchmarks: test-v8-all: test-v8 test-v8-intl test-v8-benchmarks # runs all v8 tests -apidoc_sources = $(wildcard doc/api/*.markdown) -apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \ - $(addprefix out/,$(apidoc_sources:.markdown=.json)) +apidoc_sources = $(wildcard doc/api/*.md) +apidocs = $(addprefix out/,$(apidoc_sources:.md=.html)) \ + $(addprefix out/,$(apidoc_sources:.md=.json)) apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets @@ -254,10 +258,10 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/ out/doc/%: doc/% cp -r $< $@ -out/doc/api/%.json: doc/api/%.markdown $(NODE_EXE) +out/doc/api/%.json: doc/api/%.md $(NODE_EXE) $(NODE) tools/doc/generate.js --format=json $< > $@ -out/doc/api/%.html: doc/api/%.markdown $(NODE_EXE) +out/doc/api/%.html: doc/api/%.md $(NODE_EXE) $(NODE) tools/doc/generate.js --format=html --template=doc/template.html $< > $@ docopen: out/doc/api/all.html @@ -469,7 +473,7 @@ doc-upload: tar scp -pr out/doc/ $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs.done" -$(TARBALL)-headers: config.gypi release-only +$(TARBALL)-headers: release-only $(PYTHON) ./configure \ --prefix=/ \ --dest-cpu=$(DESTCPU) \ @@ -477,7 +481,7 @@ $(TARBALL)-headers: config.gypi release-only --release-urlbase=$(RELEASE_URLBASE) \ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS) HEADERS_ONLY=1 $(PYTHON) tools/install.py install '$(TARNAME)' '/' - find $(TARNAME)/ -type l | xargs rm # annoying on windows + find $(TARNAME)/ -type l | xargs rm -f tar -cf $(TARNAME)-headers.tar $(TARNAME) rm -rf $(TARNAME) gzip -c -f -9 $(TARNAME)-headers.tar > $(TARNAME)-headers.tar.gz @@ -592,8 +596,13 @@ bench-idle: $(NODE) benchmark/idle_clients.js & jslint: - $(NODE) tools/eslint/bin/eslint.js benchmark lib src test tools/doc \ - tools/eslint-rules --rulesdir tools/eslint-rules + $(NODE) tools/jslint.js -J benchmark lib src test tools/doc \ + tools/eslint-rules tools/jslint.js + +jslint-ci: + $(NODE) tools/jslint.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \ + benchmark lib src test tools/doc \ + tools/eslint-rules tools/jslint.js CPPLINT_EXCLUDE ?= CPPLINT_EXCLUDE += src/node_lttng.cc @@ -621,8 +630,7 @@ cpplint: @$(PYTHON) tools/cpplint.py $(CPPLINT_FILES) lint: jslint cpplint - -lint-ci: lint +lint-ci: jslint-ci cpplint .PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean \ check uninstall install install-includes install-bin all staticlib \ @@ -630,4 +638,5 @@ lint-ci: lint blog blogclean tar binary release-only bench-http-simple bench-idle \ bench-all bench bench-misc bench-array bench-buffer bench-net \ bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \ - test-v8-benchmarks test-v8-all v8 lint-ci bench-ci + test-v8-benchmarks test-v8-all v8 lint-ci bench-ci jslint-ci \ + $(TARBALL)-headers diff --git a/README.md b/README.md index 64264f7c40d983..99113d55e8755c 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,15 @@ documentation of the latest stable version. Stable, LTS and Nightly download directories all contain a *SHASUM256.txt* file that lists the SHA checksums for each file available for -download. To check that a downloaded file matches the checksum, run +download. + +The *SHASUM256.txt* can be downloaded using curl. + +``` +$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt +``` + +To check that a downloaded file matches the checksum, run it through `sha256sum` with a command such as: ``` @@ -159,6 +167,7 @@ information about the governance of the Node.js project, see ### Collaborators +* [addaleax](https://github.com/addaleax) - **Anna Henningsen** <anna@addaleax.net> * [AndreasMadsen](https://github.com/AndreasMadsen) - **Andreas Madsen** <amwebdk@gmail.com> * [benjamingr](https://github.com/benjamingr) - **Benjamin Gruenbaum** <benjamingr@gmail.com> * [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** <brendan.ashworth@me.com> @@ -168,6 +177,7 @@ information about the governance of the Node.js project, see * [geek](https://github.com/geek) - **Wyatt Preul** <wpreul@gmail.com> * [iarna](https://github.com/iarna) - **Rebecca Turner** <me@re-becca.org> * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <i@izs.me> +* [iWuzHere](https://github.com/iWuzHere) - **Imran Iqbal** <imran@imraniqbal.org> * [jbergstroem](https://github.com/jbergstroem) - **Johan Bergström** <bugs@bergstroem.nu> * [joaocgreis](https://github.com/joaocgreis) - **João Reis** <reis@janeasystems.com> * [julianduque](https://github.com/julianduque) - **Julian Duque** <julianduquej@gmail.com> @@ -188,9 +198,11 @@ information about the governance of the Node.js project, see * [romankl](https://github.com/romankl) - **Roman Klauke** <romaaan.git@gmail.com> * [saghul](https://github.com/saghul) - **Saúl Ibarra Corretgé** <saghul@gmail.com> * [sam-github](https://github.com/sam-github) - **Sam Roberts** <vieuxtech@gmail.com> +* [santigimeno](https://github.com/santigimeno) - **Santiago Gimeno** <santiago.gimeno@gmail.com> * [seishun](https://github.com/seishun) - **Nikolai Vavilov** <vvnicholas@gmail.com> * [silverwind](https://github.com/silverwind) - **Roman Reiss** <me@silverwind.io> * [srl295](https://github.com/srl295) - **Steven R Loomis** <srloomis@us.ibm.com> +* [stefanmb](https://github.com/stefanmb) - **Stefan Budeanu** <stefan@budeanu.com> * [targos](https://github.com/targos) - **Michaël Zasso** <mic.besace@gmail.com> * [tellnes](https://github.com/tellnes) - **Christian Tellnes** <christian@tellnes.no> * [thealphanerd](https://github.com/thealphanerd) - **Myles Borins** <myles.borins@gmail.com> diff --git a/benchmark/buffers/buffer-compare-offset.js b/benchmark/buffers/buffer-compare-offset.js new file mode 100644 index 00000000000000..17b36f82883426 --- /dev/null +++ b/benchmark/buffers/buffer-compare-offset.js @@ -0,0 +1,58 @@ +'use strict'; +const common = require('../common.js'); +const v8 = require('v8'); + +const bench = common.createBenchmark(main, { + method: ['offset', 'slice'], + size: [16, 512, 1024, 4096, 16386], + millions: [1] +}); + +function compareUsingSlice(b0, b1, len, iter) { + + // Force optimization before starting the benchmark + Buffer.compare(b0.slice(1, len), b1.slice(1, len)); + v8.setFlagsFromString('--allow_natives_syntax'); + eval('%OptimizeFunctionOnNextCall(Buffer.compare)'); + eval('%OptimizeFunctionOnNextCall(b0.slice)'); + eval('%OptimizeFunctionOnNextCall(b1.slice)'); + Buffer.compare(b0.slice(1, len), b1.slice(1, len)); + doCompareUsingSlice(b0, b1, len, iter); +} + +function doCompareUsingSlice(b0, b1, len, iter) { + var i; + bench.start(); + for (i = 0; i < iter; i++) + Buffer.compare(b0.slice(1, len), b1.slice(1, len)); + bench.end(iter / 1e6); +} + +function compareUsingOffset(b0, b1, len, iter) { + len = len + 1; + // Force optimization before starting the benchmark + b0.compare(b1, 1, len, 1, len); + v8.setFlagsFromString('--allow_natives_syntax'); + eval('%OptimizeFunctionOnNextCall(b0.compare)'); + b0.compare(b1, 1, len, 1, len); + doCompareUsingOffset(b0, b1, len, iter); +} + +function doCompareUsingOffset(b0, b1, len, iter) { + var i; + bench.start(); + for (i = 0; i < iter; i++) + b0.compare(b1, 1, len, 1, len); + bench.end(iter / 1e6); +} + +function main(conf) { + const iter = (conf.millions >>> 0) * 1e6; + const size = (conf.size >>> 0); + const method = conf.method === 'slice' ? + compareUsingSlice : compareUsingOffset; + method(Buffer.alloc(size, 'a'), + Buffer.alloc(size, 'b'), + size >> 1, + iter); +} diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js index 1df7a74cbe77e1..a175533c7bbc6e 100644 --- a/benchmark/module/module-loader.js +++ b/benchmark/module/module-loader.js @@ -7,15 +7,17 @@ var tmpDirectory = path.join(__dirname, '..', 'tmp'); var benchmarkDirectory = path.join(tmpDirectory, 'nodejs-benchmark-module'); var bench = common.createBenchmark(main, { - thousands: [50] + thousands: [50], + fullPath: ['true', 'false'] }); function main(conf) { + var n = +conf.thousands * 1e3; + rmrf(tmpDirectory); try { fs.mkdirSync(tmpDirectory); } catch (e) {} try { fs.mkdirSync(benchmarkDirectory); } catch (e) {} - var n = +conf.thousands * 1e3; for (var i = 0; i <= n; i++) { fs.mkdirSync(benchmarkDirectory + i); fs.writeFileSync( @@ -28,10 +30,21 @@ function main(conf) { ); } - measure(n); + if (conf.fullPath === 'true') + measureFull(n); + else + measureDir(n); +} + +function measureFull(n) { + bench.start(); + for (var i = 0; i <= n; i++) { + require(benchmarkDirectory + i + '/index.js'); + } + bench.end(n / 1e3); } -function measure(n) { +function measureDir(n) { bench.start(); for (var i = 0; i <= n; i++) { require(benchmarkDirectory + i); diff --git a/common.gypi b/common.gypi index 811a7b3da3d502..ac06e55b181e67 100644 --- a/common.gypi +++ b/common.gypi @@ -95,7 +95,7 @@ 'variables': { 'v8_enable_handle_zapping': 0, }, - 'cflags': [ '-O3', '-ffunction-sections', '-fdata-sections' ], + 'cflags': [ '-O3' ], 'conditions': [ ['target_arch=="x64"', { 'msvs_configuration_platform': 'x64', diff --git a/deps/http_parser/Makefile b/deps/http_parser/Makefile index 970bdc42635ae1..5f4eb2252f241b 100644 --- a/deps/http_parser/Makefile +++ b/deps/http_parser/Makefile @@ -22,14 +22,14 @@ PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"') HELPER ?= BINEXT ?= ifeq (darwin,$(PLATFORM)) -SONAME ?= libhttp_parser.2.6.2.dylib +SONAME ?= libhttp_parser.2.7.0.dylib SOEXT ?= dylib else ifeq (wine,$(PLATFORM)) CC = winegcc BINEXT = .exe.so HELPER = wine else -SONAME ?= libhttp_parser.so.2.6.2 +SONAME ?= libhttp_parser.so.2.7.0 SOEXT ?= so endif diff --git a/deps/http_parser/http_parser.c b/deps/http_parser/http_parser.c index d51a2e7bcdf30a..719617549d0cb1 100644 --- a/deps/http_parser/http_parser.c +++ b/deps/http_parser/http_parser.c @@ -1812,6 +1812,9 @@ size_t http_parser_execute (http_parser *parser, case 0: break; + case 2: + parser->upgrade = 1; + case 1: parser->flags |= F_SKIPBODY; break; diff --git a/deps/http_parser/http_parser.h b/deps/http_parser/http_parser.h index 0cee4cc85b3892..105ae510a8ab57 100644 --- a/deps/http_parser/http_parser.h +++ b/deps/http_parser/http_parser.h @@ -26,8 +26,8 @@ extern "C" { /* Also update SONAME in the Makefile whenever you change these. */ #define HTTP_PARSER_VERSION_MAJOR 2 -#define HTTP_PARSER_VERSION_MINOR 6 -#define HTTP_PARSER_VERSION_PATCH 2 +#define HTTP_PARSER_VERSION_MINOR 7 +#define HTTP_PARSER_VERSION_PATCH 0 #include #if defined(_WIN32) && !defined(__MINGW32__) && \ @@ -77,6 +77,11 @@ typedef struct http_parser_settings http_parser_settings; * HEAD request which may contain 'Content-Length' or 'Transfer-Encoding: * chunked' headers that indicate the presence of a body. * + * Returning `2` from on_headers_complete will tell parser that it should not + * expect neither a body nor any futher responses on this connection. This is + * useful for handling responses to a CONNECT request which may not contain + * `Upgrade` or `Connection: upgrade` headers. + * * http_data_cb does not return data chunks. It will be called arbitrarily * many times for each string. E.G. you might get 10 callbacks for "on_url" * each providing just a few characters more data. diff --git a/deps/http_parser/test.c b/deps/http_parser/test.c index 7b01dc346b63d9..456a78add05e68 100644 --- a/deps/http_parser/test.c +++ b/deps/http_parser/test.c @@ -2173,6 +2173,20 @@ pause_chunk_complete_cb (http_parser *p) return chunk_complete_cb(p); } +int +connect_headers_complete_cb (http_parser *p) +{ + headers_complete_cb(p); + return 1; +} + +int +connect_message_complete_cb (http_parser *p) +{ + messages[num_messages].should_keep_alive = http_should_keep_alive(parser); + return message_complete_cb(p); +} + static http_parser_settings settings_pause = {.on_message_begin = pause_message_begin_cb ,.on_header_field = pause_header_field_cb @@ -2212,6 +2226,19 @@ static http_parser_settings settings_count_body = ,.on_chunk_complete = chunk_complete_cb }; +static http_parser_settings settings_connect = + {.on_message_begin = message_begin_cb + ,.on_header_field = header_field_cb + ,.on_header_value = header_value_cb + ,.on_url = request_url_cb + ,.on_status = response_status_cb + ,.on_body = dontcall_body_cb + ,.on_headers_complete = connect_headers_complete_cb + ,.on_message_complete = connect_message_complete_cb + ,.on_chunk_header = chunk_header_cb + ,.on_chunk_complete = chunk_complete_cb + }; + static http_parser_settings settings_null = {.on_message_begin = 0 ,.on_header_field = 0 @@ -2275,6 +2302,14 @@ size_t parse_pause (const char *buf, size_t len) return nparsed; } +size_t parse_connect (const char *buf, size_t len) +{ + size_t nparsed; + currently_parsing_eof = (len == 0); + nparsed = http_parser_execute(parser, &settings_connect, buf, len); + return nparsed; +} + static inline int check_str_eq (const struct message *m, const char *prop, @@ -2331,7 +2366,7 @@ do { \ } while(0) int -message_eq (int index, const struct message *expected) +message_eq (int index, int connect, const struct message *expected) { int i; struct message *m = &messages[index]; @@ -2346,8 +2381,10 @@ message_eq (int index, const struct message *expected) MESSAGE_CHECK_STR_EQ(expected, m, response_status); } - MESSAGE_CHECK_NUM_EQ(expected, m, should_keep_alive); - MESSAGE_CHECK_NUM_EQ(expected, m, message_complete_on_eof); + if (!connect) { + MESSAGE_CHECK_NUM_EQ(expected, m, should_keep_alive); + MESSAGE_CHECK_NUM_EQ(expected, m, message_complete_on_eof); + } assert(m->message_begin_cb_called); assert(m->headers_complete_cb_called); @@ -2385,16 +2422,22 @@ message_eq (int index, const struct message *expected) MESSAGE_CHECK_NUM_EQ(expected, m, port); } - if (expected->body_size) { + if (connect) { + check_num_eq(m, "body_size", 0, m->body_size); + } else if (expected->body_size) { MESSAGE_CHECK_NUM_EQ(expected, m, body_size); } else { MESSAGE_CHECK_STR_EQ(expected, m, body); } - assert(m->num_chunks == m->num_chunks_complete); - MESSAGE_CHECK_NUM_EQ(expected, m, num_chunks_complete); - for (i = 0; i < m->num_chunks && i < MAX_CHUNKS; i++) { - MESSAGE_CHECK_NUM_EQ(expected, m, chunk_lengths[i]); + if (connect) { + check_num_eq(m, "num_chunks_complete", 0, m->num_chunks_complete); + } else { + assert(m->num_chunks == m->num_chunks_complete); + MESSAGE_CHECK_NUM_EQ(expected, m, num_chunks_complete); + for (i = 0; i < m->num_chunks && i < MAX_CHUNKS; i++) { + MESSAGE_CHECK_NUM_EQ(expected, m, chunk_lengths[i]); + } } MESSAGE_CHECK_NUM_EQ(expected, m, num_headers); @@ -3201,7 +3244,7 @@ test_message (const struct message *message) abort(); } - if(!message_eq(0, message)) abort(); + if(!message_eq(0, 0, message)) abort(); parser_free(); } @@ -3238,7 +3281,7 @@ test_message_count_body (const struct message *message) abort(); } - if(!message_eq(0, message)) abort(); + if(!message_eq(0, 0, message)) abort(); parser_free(); } @@ -3589,9 +3632,9 @@ test_multiple3 (const struct message *r1, const struct message *r2, const struct abort(); } - if (!message_eq(0, r1)) abort(); - if (message_count > 1 && !message_eq(1, r2)) abort(); - if (message_count > 2 && !message_eq(2, r3)) abort(); + if (!message_eq(0, 0, r1)) abort(); + if (message_count > 1 && !message_eq(1, 0, r2)) abort(); + if (message_count > 2 && !message_eq(2, 0, r3)) abort(); parser_free(); } @@ -3687,17 +3730,17 @@ test_scan (const struct message *r1, const struct message *r2, const struct mess goto error; } - if (!message_eq(0, r1)) { + if (!message_eq(0, 0, r1)) { fprintf(stderr, "\n\nError matching messages[0] in test_scan.\n"); goto error; } - if (message_count > 1 && !message_eq(1, r2)) { + if (message_count > 1 && !message_eq(1, 0, r2)) { fprintf(stderr, "\n\nError matching messages[1] in test_scan.\n"); goto error; } - if (message_count > 2 && !message_eq(2, r3)) { + if (message_count > 2 && !message_eq(2, 0, r3)) { fprintf(stderr, "\n\nError matching messages[2] in test_scan.\n"); goto error; } @@ -3796,7 +3839,29 @@ test_message_pause (const struct message *msg) abort(); } - if(!message_eq(0, msg)) abort(); + if(!message_eq(0, 0, msg)) abort(); + + parser_free(); +} + +/* Verify that body and next message won't be parsed in responses to CONNECT */ +void +test_message_connect (const struct message *msg) +{ + char *buf = (char*) msg->raw; + size_t buflen = strlen(msg->raw); + size_t nread; + + parser_init(msg->type); + + nread = parse_connect(buf, buflen); + + if (num_messages != 1) { + printf("\n*** num_messages != 1 after testing '%s' ***\n\n", msg->name); + abort(); + } + + if(!message_eq(0, 1, msg)) abort(); parser_free(); } @@ -3867,6 +3932,10 @@ main (void) test_message_pause(&responses[i]); } + for (i = 0; i < response_count; i++) { + test_message_connect(&responses[i]); + } + for (i = 0; i < response_count; i++) { if (!responses[i].should_keep_alive) continue; for (j = 0; j < response_count; j++) { diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index ba4b123ef94d33..9d8bbe956198ca 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -382,3 +382,10 @@ Zac GriffinSchneider Andres Kalle thefourtheye +Yael +Yann Odeyer +James Monger +Thomas Hallock +Paul Irish +Paul O'Leary McCann +Francis Gulotta diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index bcd44fff6691de..698942905ed5c1 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,8 +1,210 @@ +### v3.8.6 (2016-03-31) + +Heeeeeey y'all. + +Kat here! Rebecca's been schmoozing with folks at [Microsoft +Build](https://build.microsoft.com/), so I'm doing the `npm@3` release this +week. + +Speaking of Build, it looks like Microsoft is doing some bash thing. This might +be really good news for our Windows users once it rolls around. We're keeping an +eye out and feeling hopeful. 🙆 + +As far as the release goes: We're really happy to be getting more and more +community contributions! Keep it up! We really appreciate folks trying to help +us, and we'll do our best to help point you in the right direction. Even things +like documentation are a huge help. And remember -- you get socks for it, too! + +#### FIXES + +* [`f8fb4d8`](https://github.com/npm/npm/commit/f8fb4d83923810eb78d075bd200a9376c64c3e3a) + [#12079](https://github.com/npm/npm/pull/12079) + Back in `npm@3.2.2` we included [a patch that made it so `npm install pkg` was + basically `npm install pkg@latest` instead of + `pkg@*`](https://github.com/npm/npm/pull/9170) + This is probably what most users expected, but it also ended up [breaking `npm + deprecate`](https://github.com/npm/npm/pull/9170) when no version was provided + for a package. In that case, we were using `*` to mean "deprecate all + versions" and relying on the `pkg` -> `pkg@*` conversion. + This patch fixes `npm deprecate pkg` to work as it used to by special casing + that particular command's behavior. + ([@polm](https://github.com/polm)) +* [`458f773`](https://github.com/npm/npm/commit/458f7734f3376aba0b6ff16d34a25892f7717e40) + [#12146](https://github.com/npm/npm/pull/12146) + Adds `make doc-clean` to `prepublish` script, to clear out previously built + docs before publishing a new npm version + ([@watilde](https://github.com/watilde)) +* [`f0d1521`](https://github.com/npm/npm/commit/f0d1521038e956b2197673f36c464684293ce99d) + [#12146](https://github.com/npm/npm/pull/12146) + Adds `doc-clean` phony target to `make publish`. + ([@watilde](https://github.com/watilde)) + +#### DOC UPDATES + +* [`ea92ffc`](https://github.com/npm/npm/commit/ea92ffc9dd2a063896353fc52c104e85ec061360) + [#12147](https://github.com/npm/npm/pull/12147) + Document that the current behavior of `engines` is just to warn if the node + platform is incompatible. + ([@reconbot](https://github.com/reconbot)) +* [`cd1ba44`](https://github.com/npm/npm/commit/cd1ba4423b3ca889c741141b95b0d9472b9f71ea) + [#12143](https://github.com/npm/npm/pull/12143) + Remove `npm faq` command, since the [FAQ was + removed](https://github.com/npm/npm/pull/10547). + ([@watilde](https://github.com/watilde)) +* [`50a12cb`](https://github.com/npm/npm/commit/50a12cb1f5f158af78d6962ad20ff0a98bc18f18) + [#12143](https://github.com/npm/npm/pull/12143) + Remove references to the FAQ from the docs, since [it was + removed](https://github.com/npm/npm/pull/10547). + ([@watilde](https://github.com/watilde)) +* [`60051c2`](https://github.com/npm/npm/commit/60051c25e2ab80c667137dfcd04b242eea25980e) + [#12093](https://github.com/npm/npm/pull/12093) + Update `bugs` url in `package.json` to use the `https` URL for Github. + ([@watilde](https://github.com/watilde)) +* [`af30c37`](https://github.com/npm/npm/commit/af30c374ef22ed1a1c71b14fced7c4b8350e4e82) + [#12075](https://github.com/npm/npm/pull/12075) + Add the `--ignore-scripts` flag to the `npm install` docs. + ([@paulirish](https://github.com/paulirish)) +* [`632b214`](https://github.com/npm/npm/commit/632b214b2f2450e844410792e5947e46844612ff) + [#12063](https://github.com/npm/npm/pull/12063) + Various minor fixes to the html docs homepage. + ([@watilde](https://github.com/watilde)) + +#### DEP BUMPS + +* [`3da0171`](https://github.com/npm/npm/commit/3da01716a0e41d6b5adee2b4fc70fcaf08c0eb24) + `lodash.without@4.1.2` + ([@jdalton](https://github.com/jdalton)) +* [`69ccf6d`](https://github.com/npm/npm/commit/69ccf6dd4caf95cd0628054307487cae1885acd0) + `lodash.uniq@4.2.1` + ([@jdalton](https://github.com/jdalton)) +* [`b50c41a`](https://github.com/npm/npm/commit/b50c41a9930dc5353a23c5ae2ff87bb99e11d482) + `lodash.union@4.2.1` + ([@jdalton](https://github.com/jdalton)) +* [`59c1ad7`](https://github.com/npm/npm/commit/59c1ad7b6f243d07618ed5703bd11d787732fc57) + `lodash.clonedeep@4.3.2` + ([@jdalton](https://github.com/jdalton)) +* [`2b4f797`](https://github.com/npm/npm/commit/2b4f797dba8e7a1376c8335b7223e82d02cd8243) + `lodash._baseuniq@4.5.1` + ([@jdalton](https://github.com/jdalton)) + +### v3.8.5 (2016-03-24) + +Like my esteemed colleague [@zkat](https://github.com/zkat) said in this +week's [LTS release notes](https://github.com/npm/npm/releases/tag/v2.15.2), +this week is another small release but we are continuing to work on our +[Windows efforts](https://github.com/npm/npm/pull/11444). + +You may also be interested in reading the [LTS process and +policy](https://github.com/npm/npm/wiki/LTS) that +[@othiym23](https://github.com/othiym23) put together recently. If you have any +feedback, we would love to hear. + +#### DOCTOR IT HURTS WHEN LINK TO MY LINK + +Well then, don't do that. + +* [`0d4a0b1`](https://github.com/npm/npm/commit/0d4a0b1) + [#11442](https://github.com/npm/npm/pull/11442) + Fail if the user asks us to make a link from a module back on to itself. + ([@antialias](https://github.com/antialias)) + +#### ERR MODULE LIST TOO LONG + +* [`b271ed2`](https://github.com/npm/npm/commit/b271ed2) + [#11983](https://github.com/npm/npm/issues/11983) + Exit early if no arguments were provided to search instead of trying to display all the modules, + running out of memory, and then crashing. + ([@SimenB](https://github.com/SimenB)) + +#### ELIMINATE UNUSED MODULE + +* [`b8c7cd7`](https://github.com/npm/npm/commit/b8c7cd7) + [#12000](https://github.com/npm/npm/pull/12000) + Stop depending on [`async-some`](https://npmjs.com/package/async-some) as it's no + longer used in npm. + ([@watilde](https://github.com/watilde)) + +#### DOCUMENTATION IMPROVEMENTS + +* [`fdd6b28`](https://github.com/npm/npm/commit/fdd6b28) + [#11884](https://github.com/npm/npm/pull/11884) + Include `node_modules` in the list of files and directories that npm won't + include in packages ordinarily. (Modules listed in `bundledDependencies` and things + that those modules rely on, ARE included of course.) + ([@Jameskmonger](https://github.com/Jameskmonger)) +* [`aac15eb`](https://github.com/npm/npm/commit/aac15eb) + [#12006](https://github.com/npm/npm/pull/12006) + Fix typo in npm-orgs documentation, where teams docs went to access docs and vice versa. + ([@yaelz](https://github.com/yaelz)) + +#### FEWER NETWORK TESTS + +* [`3e41360`](https://github.com/npm/npm/commit/3e41360) + [#11987](https://github.com/npm/npm/pull/11987) + Fix test that was inappropriately hitting the network + ([@yodeyer](https://github.com/yodeyer)) + +### v3.8.4 (2016-03-24) + +Was erroneously released with just a changelog typo correction and was +otherwise the same as 3.8.3. + ### v3.8.3 (2016-03-17): +#### SECURITY ADVISORY: BEARER TOKEN DISCLOSURE + +This release includes [the fix for a +vulnerability](https://github.com/npm/npm/commit/f67ecad59e99a03e5aad8e93cd1a086ae087cb29) +that could cause the unintentional leakage of bearer tokens. + +Here are details on this vulnerability and how it affects you. + +##### DETAILS + +Since 2014, npm’s registry has used HTTP bearer tokens to authenticate requests +from the npm’s command-line interface. A design flaw meant that the CLI was +sending these bearer tokens with _every_ request made by logged-in users, +regardless of the destination of their request. (The bearers only should have +been included for requests made against a registry or registries used for the +current install.) + +An attacker could exploit this flaw by setting up an HTTP server that could +collect authentication information, then use this authentication information to +impersonate the users whose tokens they collected. This impersonation would +allow them to do anything the compromised users could do, including publishing +new versions of packages. + +With the fixes we’ve released, the CLI will only send bearer tokens with +requests made against a registry. + +##### THINK YOU'RE AT RISK? REGENERATE YOUR TOKENS + +If you believe that your bearer token may have been leaked, [invalidate your +current npm bearer tokens](https://www.npmjs.com/settings/tokens) and rerun +`npm login` to generate new tokens. Keep in mind that this may cause continuous +integration builds in services like Travis to break, in which case you’ll need +to update the tokens in your CI server’s configuration. + +##### WILL THIS BREAK MY CURRENT SETUP? + +Maybe. + +npm’s CLI team believes that the fix won’t break any existing registry setups. +Due to the large number of registry software suites out in the wild, though, +it’s possible our change will be breaking in some cases. + +If so, please [file an issue](https://github.com/npm/npm/issues/new) describing +the software you’re using and how it broke. Our team will work with you to +mitigate the breakage. + +##### CREDIT & THANKS + +Thanks to Mitar, Will White & the team at Mapbox, Max Motovilov, and James +Taylor for reporting this vulnerability to npm. + #### PERFORMANCE IMPROVEMENTS -The updated [`are-we-there-yet`](https://npm.com/package/are-we-there-yet) +The updated [`are-we-there-yet`](https://npmjs.com/package/are-we-there-yet) changes how it tracks how complete things are to be much more efficient. The summary is that `are-we-there-yet` was refactored to remove an expensive tree walk. diff --git a/deps/npm/Makefile b/deps/npm/Makefile index bea8138becf4c8..8466cfad77e48a 100644 --- a/deps/npm/Makefile +++ b/deps/npm/Makefile @@ -166,7 +166,7 @@ ls-ok: gitclean: git clean -fd -publish: gitclean ls-ok link doc +publish: gitclean ls-ok link doc-clean doc @git push origin :v$(shell npm -v) 2>&1 || true git push origin $(BRANCH) &&\ git push origin --tags &&\ diff --git a/deps/npm/README.md b/deps/npm/README.md index 5e907a6b4b7658..b2560960a6ce00 100644 --- a/deps/npm/README.md +++ b/deps/npm/README.md @@ -141,7 +141,6 @@ you have chosen. ## More Docs Check out the [docs](https://docs.npmjs.com/), -especially the [faq](https://docs.npmjs.com/misc/faq). You can use the `npm help` command to read any of them. @@ -164,6 +163,5 @@ will no doubt tell you to put the output in a gist or email. ## SEE ALSO * npm(1) -* npm-faq(7) * npm-help(1) * npm-index(7) diff --git a/deps/npm/changelogs/CHANGELOG-2.md b/deps/npm/changelogs/CHANGELOG-2.md index 8509585001529f..48fe503381dcf5 100644 --- a/deps/npm/changelogs/CHANGELOG-2.md +++ b/deps/npm/changelogs/CHANGELOG-2.md @@ -1,3 +1,580 @@ +### v2.15.2 (2016-03-24): + +It's always nice to see new contributors. 💚 + +This week sees another small release, but we're still chugging along on our +[Windows efforts](https://github.com/npm/npm/pull/11444). + +There's also some small process changes to our LTS process relatively recently +that you might wanna know about! 💁 + +For one, the `2.x` branch was removed in favor of just `lts`. If you're making +PRs exclusively against npm's LTS, please use that name from now on. `2.x` was +deleted. + +Also, [@othiym23](https://github.com/othiym23) put some time into [writing down +our LTS process and policy](https://github.com/npm/npm/wiki/LTS). Check it out +and ping us if you have questions or comments about it! + +In general, we're trying to make sure all our policy and such for our +contributors is written down, and we hope it makes it easier in general for +y'all. Forrest is also working on a shiny new Contributor's Guide right now, but +we'll link to that in the (near?) future, when it's ready to roll out. + +#### TESTS + +* [`1d0e468`](https://github.com/npm/npm/commit/1d0e468c06c7b8e2b95b7fe874a3399a16d9db74) + [#11931](https://github.com/npm/npm/pull/11931) + Removes a bunch of old, disabled tests that have just been sitting around, + doing nothing. + ([@othiym23](https://github.com/othiym23)) +* [`7ae8aa1`](https://github.com/npm/npm/commit/7ae8aa1d9dc47761024f6756114205db3fb2c80b) + [#11987](https://github.com/npm/npm/pull/11987) + There was a failure in the `outdated-symlink` test caused by using the default + registry instead of the mock registry tests. + ([@yodeyer](https://github.com/yodeyer)) + +#### DOCS + +* [`b2649fb`](https://github.com/npm/npm/commit/b2649fb360f239aadef1ab51a580cbf4fdf29722) + [#12006](https://github.com/npm/npm/pull/12006) + Access was Team and Team was Access, but someone from the community rolled + around and corrected it for us. Thanks a bunch! + ([@yaelz](https://github.com/yaelz)) + +### v2.15.1 (2016-03-17): + +#### SECURITY ADVISORY: BEARER TOKEN DISCLOSURE + +This release includes [the fix for a +vulnerability](https://github.com/npm/npm/commit/fea8cc92cee02c720b58f95f14d315507ccad401) +that could cause the unintentional leakage of bearer tokens. + +Here are details on this vulnerability and how it affects you. + +##### DETAILS + +Since 2014, npm’s registry has used HTTP bearer tokens to authenticate requests +from the npm’s command-line interface. A design flaw meant that the CLI was +sending these bearer tokens with _every_ request made by logged-in users, +regardless of the destination of their request. (The bearers only should have +been included for requests made against a registry or registries used for the +current install.) + +An attacker could exploit this flaw by setting up an HTTP server that could +collect authentication information, then use this authentication information to +impersonate the users whose tokens they collected. This impersonation would +allow them to do anything the compromised users could do, including publishing +new versions of packages. + +With the fixes we’ve released, the CLI will only send bearer tokens with +requests made against a registry. + +##### THINK YOU'RE AT RISK? REGENERATE YOUR TOKENS + +If you believe that your bearer token may have been leaked, [invalidate your +current npm bearer tokens](https://www.npmjs.com/settings/tokens) and rerun +`npm login` to generate new tokens. Keep in mind that this may cause continuous +integration builds in services like Travis to break, in which case you’ll need +to update the tokens in your CI server’s configuration. + +##### WILL THIS BREAK MY CURRENT SETUP? + +Maybe. + +npm’s CLI team believes that the fix won’t break any existing registry setups. +Due to the large number of registry software suites out in the wild, though, +it’s possible our change will be breaking in some cases. + +If so, please [file an issue](https://github.com/npm/npm/issues/new) describing +the software you’re using and how it broke. Our team will work with you to +mitigate the breakage. + +##### CREDIT & THANKS + +Thanks to Mitar, Will White & the team at Mapbox, Max Motovilov, and James +Taylor for reporting this vulnerability to npm. + +### BACK TO YOUR REGULARLY SCHEDULED PROGRAMMING + +Aside from that, it's another one of those releases again! Docs and tests, it +turns out, have a pretty easy time getting into LTS releases, and boring is +exactly how LTS should be. 💁 + +#### DOCS + +* [`981c89c`](https://github.com/npm/npm/commit/981c89c8e398ca22ab6bf466123b25728ef6f543) + [#11820](https://github.com/npm/npm/pull/11820) + The basic explanation for how `npm link` works was a bit confusing, and + somewhat incorrect. It should be clearer now. + ([@rhgb](https://github.com/rhgb)) +* [`35b2b45`](https://github.com/npm/npm/commit/35b2b45f181dcbfb297f53b577dc1f26efcf3aba) + [#11787](https://github.com/npm/npm/pull/11787) + The `verison` alias for `npm version` no longer shows up in the command list + when you do `npm -h`. + ([@doug-wade](https://github.com/doug-wade)) +* [`1c9d00f`](https://github.com/npm/npm/commit/1c9d00f788298a81a8a7293d7dcf430f01bdd7fd) + [#11786](https://github.com/npm/npm/pull/11786) + Add a comment to the `npm-scope.md` docs about `npm@>=2` being required in + order to use scoped packaged. + ([@doug-wade](https://github.com/doug-wade)) +* [`7d64fb1`](https://github.com/npm/npm/commit/7d64fb1452d360aa736f31c85d6776ce570b2365) + [#11762](https://github.com/npm/npm/pull/11762) + Roll back patch that previously advised people to use `--depth Infinity` + instead of `--depth 9999`. Just keep using `--depth 9999`. + ([@GriffinSchneider](https://github.com/GriffinSchneider)) + +#### TESTS + +* [`98a9ee4`](https://github.com/npm/npm/commit/98a9ee4773f83994b8eb63c0ff75a9283408ba1a) + [#11912](https://github.com/npm/npm/pull/11912) + Did you know npm can install itself? `npm install -g npm` is the way to + upgrade! Turns out that one of the tests that verified this functionality got + rewritten as part of our recent push for better tests, and in the process + omitted a detail about *how* the test ran. We're testing that corner case + again, now, by moving the install folder to `/tmp`, where the original legacy + test ran. + ([@iarna](https://github.com/iarna)) + +### v2.15.0 (2016-03-10): + +#### WHY IS THIS SEMVER-MINOR I THOUGHT THIS WAS LTS + +A brief note about LTS this week! + +npm, as you may know if you're using this `2.x` branch, has an LTS process for +releases. We also try and play nice with [Node.js' own LTS release +process](https://github.com/nodejs/LTS#lts-plan). That means we generally try to +avoid things like minor version bumps on our `2.x` branch (which is also tagged +`lts` in the `dist-tag`s). + +That said, we had a minor-bump update recently for `npm@3.8.0` which added a +`maxsockets` option to allow users to configure the number of concurrent sockets +that npm would keep open at a time -- a setting that has the potential to help a +bunch for people with fussy routers or internet connections that aren't very +happy with Node.js applications' usual concurrency storm. This change was done +to `npm-registry-client`, which we don't have a parallel LTS-tracking branch +for. + +After talking it over, we ended up deciding that this was a reasonable enough +addition to LTS, even though it's *technically* a `semver-minor` bump, taking +into account both its potential for bugfixing (specially on `2.x`!) and the +general hassle it would be to maintain another branch for `npm-registry-client`. + + +* [`6dd61e7`](https://github.com/npm/npm/commit/6dd61e781c145480dc255a3e6a748729868443fd) + Expose `maxsockets` config setting from new `npm-registry-client`. + ([@misterbyrne](https://github.com/misterbyrne)) +* [`8a021c3`](https://github.com/npm/npm/commit/8a021c35184e665bd1f3f70ae2f478af812ab614) + `npm-registry-client@7.1.0`: + Adds support for configuring the max number of concurrent sockets, defaulting + to `50`. + ([@iarna](https://github.com/iarna)) + +#### DOC PATCH IS HERE TOO + +* [`0ae9f74`](https://github.com/npm/npm/commit/0ae9f740001a1bdf5920bc464cf9e284d5d139f0) + [#11748](https://github.com/npm/npm/pull/11748) + Add command aliases as a separate section in documentation for npm + subcommands. + ([@watilde](https://github.com/watilde)) + +#### DEP UPDATES + +* [`bfc3888`](https://github.com/npm/npm/commit/bfc38887f832f701c16b7ee410c4e0220a90399f) + `strip-ansi@3.0.1` + ([@jbnicolai](https://github.com/jbnicolai)) +* [`d5f4d51`](https://github.com/npm/npm/commit/d5f4d51a1b7ea78d7431c7ed4fed30200b2622f8) + `node-gyp@3.3.1`: Fixes Android generator + ([@bnoordhuis](https://github.com/bnoordhuis)) +* [`4119df8`](https://github.com/npm/npm/commit/4119df8aecd2ae57b0492ad8c9a480d900833008) + `glob@7.0.3`: Some path-related fixes for Windows. + ([@isaacs](https://github.com/isaacs)) + +### v2.14.22 (2016-03-03): + +This week is all documentation improvements. In case you hadn't noticed, we +*love* doc patches. We love them so much, we give socks away if you submit +documentation PRs! + +These folks are all getting socks if they ask for them. The socks are +super-sweet. Do you have yours yet? 👣 + +* [`3f3c7d0`](https://github.com/npm/npm/commit/3f3c7d080f052a5db91ff6091f8b1b13f26b53d6) + [#11441](https://github.com/npm/npm/pull/11441) + Add a link to the [Contribution + Guidelines](https://github.com/npm/npm/wiki/Contributing-Guidelines) to the + main npm docs. + ([@watilde](https://github.com/watilde)) +* [`9f87bb1`](https://github.com/npm/npm/commit/9f87bb1934acb33b678c17b7827165b17c071a82) + [#11441](https://github.com/npm/npm/pull/11441) + Remove Google Group email from npm docs about contributing. + ([@watilde](https://github.com/watilde)) +* [`93eaab3`](https://github.com/npm/npm/commit/93eaab3ee5ad16c7d90d1a4b38a95403fcf3f0f6) + [#11474](https://github.com/npm/npm/pull/11474) + Fix an invalid JSON error overlooked in + [#11196](https://github.com/npm/npm/pull/11196). + ([@robludwig](https://github.com/robludwig)) +* [`a407ca2`](https://github.com/npm/npm/commit/a407ca2bcf6a05117e55cf2ab69376e09094995e) + [#11483](https://github.com/npm/npm/pull/11483) + Add more details and an example to the documentation for bundledDependencies. + ([@gnerkus](https://github.com/gnerkus)) +* [`2c851a2`](https://github.com/npm/npm/commit/2c851a231afd874baa77c42ea5ba539c454ac79c) + [#11490](https://github.com/npm/npm/pull/11490) + Document the `--registry` flag for `npm search`. + ([@plumlee](https://github.com/plumlee)) + +### v2.14.21 (2016-02-25): + +Good news, everyone! There's a new LTS release with a few shinies here and there! + +#### USE THIS ONE INSTEAD + +We had some cases where the versions of npm and node used in some scripting situations were different than the ideal, or what folks actually expected. These should be particularly helpful to our Windows friends! <3 + +* [`02813c5`](https://github.com/npm/npm/commit/02813c55782a9def23f7f1e614edc38c6c88aed3) [#9253](https://github.com/npm/npm/issues/9253) Fix a bug where, when running lifecycle scripts, if the Node.js binary you ran `npm` with wasn't in your `PATH`, `npm` wouldn't use it to run your scripts. ([@segrey](https://github.com/segrey) and [@narqo](https://github.com/narqo)) +* [`a985dd5`](https://github.com/npm/npm/commit/a985dd50e06ee51ba5544577f977c7440c227ba2) [#11526](https://github.com/npm/npm/pull/11526) Prefer locally installed npm in Git Bash -- previous behavior was to use the global one. This was done previously for other shells, but not for Git Bash. ([@destroyerofbuilds](https://github.com/destroyerofbuilds)) + +#### SOCKS FOR THE SOCK GOD + +* [`f961092`](https://github.com/npm/npm/commit/f9610920079d8b88ae464b30007a92c594bd85a8) + [#11636.](https://github.com/npm/npm/issues/11636.) + Document the `--save-bundle` option for `npm install`. + ([@datyayu](https://github.com/datyayu)) +* [`7c908b6`](https://github.com/npm/npm/commit/7c908b618f7123f0a3b860c71eb779e33df35964) + [#11644](https://github.com/npm/npm/pull/11644) + Add documentation for the `test` directory for packages. + ([@lewiscowper](https://github.com/lewiscowper)) + +#### INTERNAL TEST IMPROVEMENTS + +The npm CLI team's time recently has been sunk into npm's many years of tech debt. Specifically, we've been working on improving the test suite. This isn't user visible, but in future should mean a more stable, easier to contribute to npm. Ordinarily we don't report these kinds of changes in the change log, but I thought I might share this week as this chunk is bigger than usual. + +These patches were previously released for `npm@3`, and then ported back to `npm@2` LTS. + +* [`437c537`](https://github.com/npm/npm/commit/437c537e2be5923c6d2c2753154564ba13db8fd9) [#11613](https://github.com/npm/npm/pull/11613) Fix up one of the tests after rebasing the legacy test rewrite to `npm@2`. ([@zkat](https://github.com/zkat)) +* [`55abd0c`](https://github.com/npm/npm/commit/55abd0cc20e87a144d33ce2d459f65e7506da576) [#11613](https://github.com/npm/npm/pull/11613) Test that the `package.json` `files` section and `.npmignore` do what they're supposed to. ([@zkat](https://github.com/zkat)) +* [`a2b99b6`](https://github.com/npm/npm/commit/a2b99b6273ada14b2121ebc0acb7933e630edd9d) [#11613](https://github.com/npm/npm/pull/11613) Test that npm's distribution binary is complete and can be installed and used. ([@iarna](https://github.com/iarna)) +* [`8a8c36c`](https://github.com/npm/npm/commit/8a8c36ce51166006022e5c5d4f8655bbc458d651) [#11613](https://github.com/npm/npm/pull/11613) Test that environment variables are properly passed into scripts. + ([@iarna](https://github.com/zkat)) +* [`a95b550`](https://github.com/npm/npm/commit/a95b5507616bd51e83d7eab5f2337b1aff6480b1) [#11613](https://github.com/npm/npm/pull/11613) Test that we don't leak auth info into the environment. ([@iarna](https://github.com/iarna)) +* [`a1c1c52`](https://github.com/npm/npm/commit/a1c1c52efeab24f6dba154d054f85d9efc833486) [#11613](https://github.com/npm/npm/pull/11613) Remove all the relatively cryptic legacy tests and creates new tap tests that check the same functionality. The *legacy* tests were tests that were originally a shell script that was ported to javascript early in `npm`'s history. ([@iarna](https:\\github.com/iarna) and [@zkat](https://github.com/zkat)) +* [`9d89581`](https://github.com/npm/npm/commit/9d895811d3ee70c2e672f3d8fa06574495b5b488) [#11613](https://github.com/npm/npm/pull/11613) `tacks@1.0.9`: Add a package that provides a tool to generate fixtures from folders and, relatedly, a module that an create and tear down filesystem fixtures easily. ([@iarna](https://github.com/iarna)) + +### v2.14.20 (2016-02-18): + +Hope y'all are having a nice week! As usual, it's a fairly limited release. The +most notable thing is some dependency updates that might help the Node.js CI +setup for Windows run a little better, even if we have some work to do on that +path length things, still. + +#### WHITTLING AWAY AT PATH LENGTHS + +So for all of you who don't know -- Node.js does, in fact, support long Windows +paths. Unfortunately, depending on the tool and the Windows version, a lot of +external tooling does not. This means, for example, that some (all?) versions of +Windows Explorer *can literally never delete npm from their system entirely +because of deeply-nested npm dependencies*. Which is pretty gnarly. + +Incidentally, if you run into that in particularly, you can use +[rimraf](npm.im/rimraf) to remove such files 💁. + +The latest victim of this issue was the Node.js CI setup for testing on Windows, +which uses some tooling or another that croaks on the usual path length limit +for that OS: 255 characters. + +This issue, of course, is largely not a problem as of `npm@3`, with its flat +trees, but it still occasionally and viciously bites LTS. + +We've taken another baby step towards alleviating this in this release by +updating a couple of dependencies that were preventing `npmlog` from deduping, +and then doing a dedupe on that and `gauge`. Hopefully it helps. + +* [`4199551`](https://github.com/npm/npm/commit/41995517e617674710748ab6d262670c96124393) + [#11528](https://github.com/npm/npm/pull/11528) + `npm-install-checks@1.0.7`: Just updates the version of npmlog so we can + dedupe it better. + ([@zkat](https://github.com/zkat)) +* [`14d72c7`](https://github.com/npm/npm/commit/14d72c756b89e2d167eb52c1849263dbddcb9f35) + [#11552](https://github.com/npm/npm/pull/11552) + [#11528](https://github.com/npm/npm/pull/11528) + `node-gyp@3.3.0`: AIX support, new `gyp`, update `npmlog` (for the dedupe), + adds `--cafile` command line option, and allows configuration of Node.js and + io.js mirrors. + ([@rvagg](https://github.com/rvagg)) +* [`0453cb9`](https://github.com/npm/npm/commit/0453cb94b33520eb723b7072cd2654b1d0142533) + [#11528](https://github.com/npm/npm/pull/11528) + Do a `dedupe` on `gauge` to flatten our dependencies a bit more. + ([@zkat](https://github.com/zkat)) + +#### OTHER DEP STUFF + +* [`686c0b3`](https://github.com/npm/npm/commit/686c0b37ec3a7b65f9b3849e1099805e5221c408) + `rimraf@2.5.2`: Just updates to glob@7. + ([@isaacs](https://github.com/isaacs)) + +#### @wyze, DOCUMENTATION HERO OF THE PEOPLE, GETS THEIR OWN HEADER + +* [`7232948`](https://github.com/npm/npm/commit/72329484c775376cb40d5b348f453eaaf2f0b821) + [#11416](https://github.com/npm/npm/pull/11416) + Logout docs were using a section copy-pasted from the adduser docs. + ([@wyze](https://github.com/wyze)) +* [`922b33a`](https://github.com/npm/npm/commit/922b33aba4362e1e90f42e9348f061a1cc73eafb) + [#11414](https://github.com/npm/npm/pull/11414) + Add colon for consistency. + ([@wyze](https://github.com/wyze)) + +### v2.14.19 (2016-02-11): + +Really tiny micro-release this week! The main thing to note is a dependency +update that means we no longer have `graceful-fs@3` in our dependency tree. This +has some implications for being able to run on future Node.js releases, so +better to get this out the door. 😁 + +#### DEPS + +* [`a556e0f`](https://github.com/npm/npm/commit/a556e0f9dcb5d7b44224ba9c16c9d0dc6c8d2532) + `cmd-shim@2.0.2`: Final straggler using `graceful-fs@<4`. + ([@ForbesLindesay](https://github.com/ForbesLindesay)) + +#### DOCS + +* [`69a2d59`](https://github.com/npm/npm/commit/69a2d599bf0cba674ee268483e9bd5c14333b89f) + [#11391](https://github.com/npm/npm/pull/11391) + Fixed versions of `shrinkwrap.json` in examples in documentation for `npm + shrinkwrap`, which did not quite match up. + ([@xcatliu](https://github.com/xcatliu)) + +### v2.14.18 (2016-02-04): + +Clearly our docs are perfect after all those wonderful PRs, 'cause this week's +gonna be all about dependency updates. Note: There is a small security-related +fix included here! + +#### SECURITY-RELATED DEPENDENCY UPDATE + +* [`5c095ef`](https://github.com/npm/npm/commit/5c095eff8dc006980d4d083f2007e4dacff23be3) + [#11341](https://github.com/npm/npm/pull/11341) + `request@2.69.0`: Includes security-related dependency updates involving + `hawk` and `is-my-json-valid` + ([@remy](https://github.com/remy) and [@simov](https://github.com/simov)) + +#### OTHER DEPENDENCY UPDATES + +* [`f9c2668`](https://github.com/npm/npm/commit/f9c2668ca3e6e2602d91250ce61280e5e12d0a00) + `which@1.2.4` + ([@isaacs](https://github.com/isaacs)) +* [`2907c43`](https://github.com/npm/npm/commit/2907c43ad4ef87e5f730c2576f680d6837fcbad0) + `spdx-license-ids@1.2.0` + ([@shinnn](https://github.com/shinnn)) +* [`7734069`](https://github.com/npm/npm/commit/773406960bf7f4a87b2ecb6ebf593c62d0e9f95d) + `rimraf@2.5.1` + ([@isaacs](https://github.com/isaacs)) +* [`f4b39a7`](https://github.com/npm/npm/commit/f4b39a7dd5e1335d92aa22c46d99abb33f271b8b) + `retry@0.9.0` + ([@tim-kos](https://github.com/tim-kos)) +* [`ded1e7a`](https://github.com/npm/npm/commit/ded1e7a1c9c7bec29bb7c30a8f85546670e75b56) + Nest `retry@0.8.0` inside `npm-registry-client` to prevent invalid + dependency issue until the latter gets a dependency update. + ([@zkat](https://github.com/zkat)) +* [`ab9f867`](https://github.com/npm/npm/commit/ab9f8679f9687f91ad03adaab6211a897aeebbae) + `read-package-json@2.0.3` + ([@iarna](https://github.com/iarna)) +* [`b638c41`](https://github.com/npm/npm/commit/b638c41607bb936b9eaaceba2aeeda1d34e3a9b2) + `npmlog@2.0.2` + ([@iarna](https://github.com/iarna)) +* [`49f34af`](https://github.com/npm/npm/commit/49f34af463a674359269025d8438feb6a7c69960) + `init-package-json@1.9.3` + ([@iarna](https://github.com/iarna)) +* [`2305dab`](https://github.com/npm/npm/commit/2305dab4e7bff09bb7686cec653cf1e663dbf15d) + `graceful-fs@4.1.3`: Fixed `.close()` not being patched. + ([@isaacs](https://github.com/isaacs)) +* [`18496d9`](https://github.com/npm/npm/commit/18496d9a0fff94e3652655998e8333056aa52b15) + `fs-write-stream-atomic@1.0.8` + ([@iarna](https://github.com/iarna)) +* [`6637bc7`](https://github.com/npm/npm/commit/6637bc7a0e194d82554cd7c91e1794018fef5943) + `config-chain@1.1.10` + ([@dominictarr](https://github.com/dominictarr)) +* [`4222bad`](https://github.com/npm/npm/commit/4222badffed9e9edacea6a8a96a99a164d376158) + `columnify@1.5.4` + ([@timoxley](https://github.com/timoxley)) +* [`df9016f`](https://github.com/npm/npm/commit/df9016f327a2a9ce492ebc75b882b03069438e13) + `ansi@0.3.1`: Added a license file. + ([@TooTallNate](https://github.com/TooTallNate)) + +### v2.14.17 (2016-01-28): + +Another week, another small LTS release! + +#### BETTER ERROR REPORTING YAY + +So as it turns out, when stuff goes wrong, it's actually nice to give people a +better clue rather than just say "oh well 😏". + +* [`5b8ccb9`](https://github.com/npm/npm/commit/5b8ccb91cf11b4edb463609cd4ed1dee84ed4db0) + [#11289](https://github.com/npm/npm/pull/11289) + There is an obscure feature that lets you monkey-patch npm when it starts up. + If the module being required with this feature failed, it would previous just + make npm error out– this reduces that to a warning. + ([@evanlucas](https://github.com/evanlucas)) +* [`556e42a`](https://github.com/npm/npm/commit/556e42ac6bab078722ddc1dc6cce4428d001133b) + [#11300](https://github.com/npm/npm/pull/11300) + Report symlinked packages as 'linked' in the output for `npm outdated`. + ([@halhenke](https://github.com/halhenke)) +* [`3842317`](https://github.com/npm/npm/commit/3842317583e0ea2eca78e39aa03f5bc06ba21de7) + [#11290](https://github.com/npm/npm/pull/11290) + Suppress warnings about pre-release node versions. This should get node's CI + passing on non-Windows platforms without needing to modify the node version to + get rid of the pre-release suffix. + ([@iarna](https://github.com/iarna)) + +#### EVERYONE WANTS THOSE NPM SOCKS, GEEZE + +Did you know that you can get npm socks for contributing to our docs? I bet +these people do, and now so do you! + +* [`dcde451`](https://github.com/npm/npm/commit/dcde451cb85a6ca08acc6ef45782c652f1d8fc89) + [#11232](https://github.com/npm/npm/pull/11232) + Update automatically included/excluded packages in `package.json`. + ([@jscissr](https://github.com/jscissr)) +* [`e3f8d5b`](https://github.com/npm/npm/commit/e3f8d5be5ac5ec1d72db42f7abf50cc4a8c5935c) + [#11273](https://github.com/npm/npm/pull/11273) + Add an example for `npm view versions`. + ([@vedatmahir](https://github.com/vedatmahir)) +* [`6a06ef2`](https://github.com/npm/npm/commit/6a06ef2252748089f0013de951f2d06160b90306) + [#11272](https://github.com/npm/npm/pull/11272) + Fix a typo in `npm-update.md`. + ([@jonathanp](https://github.com/jonathanp)) +* [`2515ff1`](https://github.com/npm/npm/commit/2515ff1de28f0b261fb25c79a66bd762a65961c4) + [#11215](https://github.com/npm/npm/pull/11215) + Correct small thinko in docs for SPDX expressions. + ([@kemitchell](https://github.com/kemitchell)) +* [`70f897b`](https://github.com/npm/npm/commit/70f897b03da9a5d5d4fd34614e9ee40e6f9e9653) + [#11196](https://github.com/npm/npm/pull/11196) + Make JSON snippets valid JSON in `npm update` docs. + ([@s100](https://github.com/s100)) + +### v2.14.16 (2016-01-21): + +Good to see you all again! It's been a while since we had an LTS release, and +the team continues to work hard to both get the issue tracker under control, and +get our test suite to be awesome and reliable. + +This is also the first LTS release of this year. + +We're gonna have an interesting time -- most of our focus this year will be +around stability and maintainability of the CLI, so you might actually end up +seeing a number of updates even over here, just for the sake of making sure +we're stable, that bugs get fixed, and tests have proper coverage. + +What better way to start this effort, then, than getting Travis tests green, fix +a few things here and there, and tweak a bunch of documentation? 😁 + +#### FIX ALL THE BUGS AND TWEAK ALL THE THINGS + +* [`24b13fb`](https://github.com/npm/npm/commit/24b13fbc57d34db1d5b0a37bcca122c00deba978) + [#11158](https://github.com/npm/npm/pull/11158) + Fix custom node-gyp env var quoting on Windows. + ([@orangemocha](https://github.com/orangemocha)) +* [`e2503f2`](https://github.com/npm/npm/commit/e2503f2be40157b05a9c500ec3b5d16090ffee50) + [#11142](https://github.com/npm/npm/pull/11142) + Fix race condition with `correctMkdir` in the cache directory. + ([@Jimbly](https://github.com/Jimbly)) + +* [`5c0e4c4`](https://github.com/npm/npm/commit/5c0e4c45a29d774ab729e86044377d4e5e424252) + [#10940](https://github.com/npm/npm/pull/10940) + Ignore failures replacing `package.json`. writeFileAtomic is not atomic in + Windows, it fails if the file is being accessed concurrently. + ([@orangemocha](https://github.com/orangemocha)) +* [`2c44d8d`](https://github.com/npm/npm/commit/2c44d8dc8c267d5e054d0175ce2f4750f0986463) + [#10903](https://github.com/npm/npm/pull/10903) + Add tests for `npm adduser --scope`. + ([@ekmartin](https://github.com/ekmartin)) +* [`4cb25d0`](https://github.com/npm/npm/commit/4cb25d0fed5c7792dfd1aec891380ecc1f8a5761) + [#10903](https://github.com/npm/npm/pull/10903) + Add a message informing users when they have been successfully logged in. + ([@ekmartin](https://github.com/ekmartin)) +* [`fe3ec6d`](https://github.com/npm/npm/commit/fe3ec6d6658262054c0c19c55373c21e84ab9f17) + [#10628](https://github.com/npm/npm/pull/10628) + Tell users how to open an issue with a package that has errored. + ([@trodrigues](https://github.com/trodrigues)) + +#### DOCS DOCS DOCS + +We got a TON of lovely documentation patches, too! Thanks all for submitting! + +* [`22482a1`](https://github.com/npm/npm/commit/22482a1f22079d72c3f8ca55c2f0c153bdd024c0) + [#11188](https://github.com/npm/npm/pull/11188) + Briefly explain what's included when you publish. + ([@beaugunderson](https://github.com/beaugunderson)) +* [`fa47724`](https://github.com/npm/npm/commit/fa4772438df0c66a19309dd1c1a3ce43cbee5461) + [#11150](https://github.com/npm/npm/pull/11150) + Advise use of `--depth Infinity` instead of `--depth 9999` in `npm update`. + ([@halhenke](https://github.com/halhenke)) +* [`248ddfe`](https://github.com/npm/npm/commit/248ddfe8f7ddd3318e14bf61de41cab4a638c8a3) + [#11130](https://github.com/npm/npm/pull/11130) + Nuke "using npm programmatically" section from README. The programmatic npm + API is unsupported, and is not guaranteed not to break in non-major versions. + Removing this section so newcomers aren't encouraged to discover or use it. + ([@ljharb](https://github.com/ljharb)) +* [`ae9c452`](https://github.com/npm/npm/commit/ae9c4521222d60ab4a69c19fee5e361c62f41fae) + [#11128](https://github.com/npm/npm/pull/11128) + Add link to local paths section indocs for `package.json`. + ([@orangejulius](https://github.com/orangejulius)) +* [`663a8c6`](https://github.com/npm/npm/commit/663a8c6b4b1647f9b86c15ef32e30023edc8c060) + [#11044](https://github.com/npm/npm/pull/11044) + Update default value documentation for the color option in npm's config. + ([@scottaddie](https://github.com/scottaddie)) +* [`5c1dda0`](https://github.com/npm/npm/commit/5c1dda0d3a18b2954872dba33fbc696ff0700ffe) + [#11037](https://github.com/npm/npm/pull/11037) + Correct the name property max length constraint verbiage. + ([@scottaddie](https://github.com/scottaddie)) +* [`8288365`](https://github.com/npm/npm/commit/8288365d08e97fa3a5b0d31703c015a8be49e07f) + [#10990](https://github.com/npm/npm/pull/10990) + Update folder docs to reflect that process.installPrefix was removed as of + 0.8.x. + ([@jeffmcmahan](https://github.com/jeffmcmahan)) +* [`61d63fa`](https://github.com/npm/npm/commit/61d63fa22c4f09742180c2de460a4ffb6c32738e) + [#10790](https://github.com/npm/npm/pull/10790) + Clarify that `npm install foo` is the same as `npm install foo@latest` now. + ([@cvrebert](https://github.com/cvrebert)) +* [`442c920`](https://github.com/npm/npm/commit/442c9207f375354c91d36df8711ba2d33e1c97f3) + [#10789](https://github.com/npm/npm/pull/10789) + Link over to `npm-dist-tag(1)` in `npm install` docs when they talk about the + `pkg@` syntax. + ([@cvrebert](https://github.com/cvrebert)) +* [`dca7a5e`](https://github.com/npm/npm/commit/dca7a5e2be3bfa306a870a123707d35c732406c0) + [#10788](https://github.com/npm/npm/pull/10788) + Link to tag docs in docs for `npm publish --tag`. + ([@cvrebert](https://github.com/cvrebert)) +* [`a72904e`](https://github.com/npm/npm/commit/a72904e8d4ab1d43ae8150fbe3f6468b0cbb1efd) + [#10787](https://github.com/npm/npm/pull/10787) + Explain why the `latest` tag matters. + ([@cvrebert](https://github.com/cvrebert)) +* [`9d0697a`](https://github.com/npm/npm/commit/9d0697a534046df7efda32170014041bbc1f4e7d) + [#10785](https://github.com/npm/npm/pull/10785) + Replace some quite marks in `npm dist-tag` docs for the sake of consistency. + ([@cvrebert](https://github.com/cvrebert)) + +#### I REALLY LIKE GREEN. CAN YOU TELL? + +So Travis is all green now on `npm@2`, thanks to the removal of nock and a few +other test suite tweaks. This is a fantastic step towards making sure we can all +have confidence in our test suite! 🎉 + +* [`64995be`](https://github.com/npm/npm/commit/64995be6d874356b15c136f9867302d805dfe1e9) [`75ab216`](https://github.com/npm/npm/commit/75ab2164cf79e28ac7f7ebe714f3c5aee99c6626) [`a9f6fe9`](https://github.com/npm/npm/commit/a9f6fe9dc558f17c4a7b9eb83329ac080f7df4b7) [`649c193`](https://github.com/npm/npm/commit/649c193adadf714c2819837f9372a29d724a5ec0) [`94cb05e`](https://github.com/npm/npm/commit/94cb05eaa9e5ad6675cf15c4ac0a44fbdde05900) [`6541690`](https://github.com/npm/npm/commit/65416907008061ac5a5f66b1630a57776803b526) [`255be6f`](https://github.com/npm/npm/commit/255be6f5bca9e3d216f3a5cbdf6714c6c9fcf132) [`9e84fa4`](https://github.com/npm/npm/commit/9e84fa43c49d04cf86ca1678e2a61412f5559cb9) [`8a587b0`](https://github.com/npm/npm/commit/8a587b0c1696ae7302891fa6355fc3e8670e00d3) [`bf812a5`](https://github.com/npm/npm/commit/bf812a54e497a573493346399798aa0b9373ac24) + [#10903](https://github.com/npm/npm/pull/10903) + Get rid of nock from tests, and get Travis green. + ([@zkat](https://github.com/zkat) and [@iarna](https://github.com/iarna)) +* [`70a5310`](https://github.com/npm/npm/commit/70a5310712c6666e753ca8f3bfff4a780ec6292d) + `npm-registry-couchapp@2.6.12`: + Better 0.8 compatibility, and ability to run in travis docker stuff. This + means the test suite should run a lot faster, too! + ([@iarna](https://github.com/iarna)) +* [`28fae39`](https://github.com/npm/npm/commit/28fae399212eda5554e6c0ffd8c9591144ab7b9d) + Get rid of sudo, for Travis! + ([@zkat](https://github.com/zkat)) + ### v2.14.15 (2015-12-10): Did you know that Bob Ross reached the rank of master sergeant in the US Air diff --git a/deps/npm/doc/cli/npm-completion.md b/deps/npm/doc/cli/npm-completion.md index 6c7f3935629e7b..cc826a4d7b6d48 100644 --- a/deps/npm/doc/cli/npm-completion.md +++ b/deps/npm/doc/cli/npm-completion.md @@ -28,5 +28,4 @@ completions based on the arguments. ## SEE ALSO * npm-developers(7) -* npm-faq(7) * npm(1) diff --git a/deps/npm/doc/cli/npm-help-search.md b/deps/npm/doc/cli/npm-help-search.md index f1d883acd9a82d..74e1011ab00679 100644 --- a/deps/npm/doc/cli/npm-help-search.md +++ b/deps/npm/doc/cli/npm-help-search.md @@ -31,5 +31,4 @@ If false, then help-search will just list out the help topics found. ## SEE ALSO * npm(1) -* npm-faq(7) * npm-help(1) diff --git a/deps/npm/doc/cli/npm-help.md b/deps/npm/doc/cli/npm-help.md index 9fb96c9c2e6512..5230082b923fa9 100644 --- a/deps/npm/doc/cli/npm-help.md +++ b/deps/npm/doc/cli/npm-help.md @@ -29,7 +29,6 @@ Set to `"browser"` to view html help content in the default web browser. * npm(1) * README -* npm-faq(7) * npm-folders(5) * npm-config(1) * npm-config(7) diff --git a/deps/npm/doc/cli/npm-install.md b/deps/npm/doc/cli/npm-install.md index f9c54c056a6915..177bf41ec2b300 100644 --- a/deps/npm/doc/cli/npm-install.md +++ b/deps/npm/doc/cli/npm-install.md @@ -271,6 +271,9 @@ global `node_modules` folder. Only your direct dependencies will show in `node_modules` and everything they depend on will be flattened in their `node_modules` folders. This obviously will eliminate some deduping. +The `--ignore-scripts` argument will cause npm to not execute any +scripts defined in the package.json. See `npm-scripts(7)`. + The `--legacy-bundling` argument will cause npm to install the package such that versions of npm prior to 1.4, such as the one included with node 0.8, can install the package. This eliminates all automatic deduping. diff --git a/deps/npm/doc/cli/npm-link.md b/deps/npm/doc/cli/npm-link.md index b5749f889c7a42..3970ffdf80b992 100644 --- a/deps/npm/doc/cli/npm-link.md +++ b/deps/npm/doc/cli/npm-link.md @@ -65,7 +65,6 @@ include that scope, e.g. ## SEE ALSO * npm-developers(7) -* npm-faq(7) * package.json(5) * npm-install(1) * npm-folders(5) diff --git a/deps/npm/doc/cli/npm.md b/deps/npm/doc/cli/npm.md index 6c4cdd42bb2fa3..31c9b18af70ec8 100644 --- a/deps/npm/doc/cli/npm.md +++ b/deps/npm/doc/cli/npm.md @@ -156,7 +156,6 @@ will no doubt tell you to put the output in a gist or email. ## SEE ALSO * npm-help(1) -* npm-faq(7) * README * package.json(5) * npm-install(1) diff --git a/deps/npm/doc/files/npm-folders.md b/deps/npm/doc/files/npm-folders.md index 6846b1fce8f713..62ecebc27a3166 100644 --- a/deps/npm/doc/files/npm-folders.md +++ b/deps/npm/doc/files/npm-folders.md @@ -204,7 +204,6 @@ cannot be found elsewhere. See `package.json(5)` for more information. ## SEE ALSO -* npm-faq(7) * package.json(5) * npm-install(1) * npm-pack(1) diff --git a/deps/npm/doc/files/package.json.md b/deps/npm/doc/files/package.json.md index 3c61d8b88e593d..9af7d36b7ec232 100644 --- a/deps/npm/doc/files/package.json.md +++ b/deps/npm/doc/files/package.json.md @@ -206,6 +206,7 @@ Conversely, some files are always ignored: * `._*` * `npm-debug.log` * `.npmrc` +* `node_modules` ## main @@ -654,8 +655,8 @@ are capable of properly installing your program. For example: { "engines" : { "npm" : "~1.0.20" } } -Note that, unless the user has set the `engine-strict` config flag, this -field is advisory only. +Unless the user has set the `engine-strict` config flag, this +field is advisory only will produce warnings when your package is installed as a dependency. ## engineStrict @@ -756,7 +757,6 @@ npm will default some values based on package contents. * npm-config(1) * npm-config(7) * npm-help(1) -* npm-faq(7) * npm-install(1) * npm-publish(1) * npm-uninstall(1) diff --git a/deps/npm/doc/misc/npm-coding-style.md b/deps/npm/doc/misc/npm-coding-style.md index 81dadf83473d2c..a105b1aa53b39a 100644 --- a/deps/npm/doc/misc/npm-coding-style.md +++ b/deps/npm/doc/misc/npm-coding-style.md @@ -189,5 +189,4 @@ Boolean objects are verboten. ## SEE ALSO * npm-developers(7) -* npm-faq(7) * npm(1) diff --git a/deps/npm/doc/misc/npm-developers.md b/deps/npm/doc/misc/npm-developers.md index 25957f11ecbf07..e8df1ed7b9c82a 100644 --- a/deps/npm/doc/misc/npm-developers.md +++ b/deps/npm/doc/misc/npm-developers.md @@ -211,7 +211,6 @@ Tell the world how easy it is to install your program! ## SEE ALSO -* npm-faq(7) * npm(1) * npm-init(1) * package.json(5) diff --git a/deps/npm/doc/misc/npm-orgs.md b/deps/npm/doc/misc/npm-orgs.md index 1f9977eaddf4be..e28b6c17640fd6 100644 --- a/deps/npm/doc/misc/npm-orgs.md +++ b/deps/npm/doc/misc/npm-orgs.md @@ -17,8 +17,8 @@ The developer will be able to access packages based on the teams they are on. Ac There are two main commands: -1. `npm team` see npm-access(1) for more details -2. `npm access` see npm-team(1) for more details +1. `npm team` see npm-team(1) for more details +2. `npm access` see npm-access(1) for more details ## Team Admins create teams diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index 0490b345d88b87..d346352b253c3e 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -93,8 +93,7 @@

More Severe Uninstalling

this means that future npm installs will not remember the settings that you have chosen.

More Docs

-

Check out the docs, -especially the faq.

+

Check out the docs,

You can use the npm help command to read any of them.

If you're a developer, and you want to use npm to publish your program, you should read this

@@ -111,7 +110,6 @@

BUGS

SEE ALSO

@@ -127,5 +125,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-access.html b/deps/npm/html/doc/cli/npm-access.html index 1ae9eb53a0cc8d..9344c58dbbc245 100644 --- a/deps/npm/html/doc/cli/npm-access.html +++ b/deps/npm/html/doc/cli/npm-access.html @@ -84,5 +84,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-adduser.html b/deps/npm/html/doc/cli/npm-adduser.html index 9e34cb364081d6..44fbcecee5510c 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -72,5 +72,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-bin.html b/deps/npm/html/doc/cli/npm-bin.html index dc00f71e0c374b..9796b852fac0ac 100644 --- a/deps/npm/html/doc/cli/npm-bin.html +++ b/deps/npm/html/doc/cli/npm-bin.html @@ -35,5 +35,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-bugs.html b/deps/npm/html/doc/cli/npm-bugs.html index 848142127d7223..bbb7654f9344bf 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -55,5 +55,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-build.html b/deps/npm/html/doc/cli/npm-build.html index 3b9060437e303c..6196a369c0896a 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -40,5 +40,5 @@

DESCRIPTION

       - + diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index 85e33d26c7eb93..0d24e621a790bc 100644 --- a/deps/npm/html/doc/cli/npm-bundle.html +++ b/deps/npm/html/doc/cli/npm-bundle.html @@ -31,5 +31,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-cache.html b/deps/npm/html/doc/cli/npm-cache.html index d462bc45bbd91c..056613a4175740 100644 --- a/deps/npm/html/doc/cli/npm-cache.html +++ b/deps/npm/html/doc/cli/npm-cache.html @@ -81,5 +81,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-completion.html b/deps/npm/html/doc/cli/npm-completion.html index bef549af161ce1..414ef4ac245c69 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -29,7 +29,6 @@

SYNOPSIS

SEE ALSO

@@ -44,5 +43,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index f9c124a260b1ee..4e103974ed6ee1 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -67,5 +67,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index 38aff1070f72c5..dbf60ea4969650 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -61,5 +61,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index 3dbbb697391543..b39d96d196e2e2 100644 --- a/deps/npm/html/doc/cli/npm-deprecate.html +++ b/deps/npm/html/doc/cli/npm-deprecate.html @@ -38,5 +38,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-dist-tag.html b/deps/npm/html/doc/cli/npm-dist-tag.html index 6303fe3bf4aa59..20b9ef6f38b4dd 100644 --- a/deps/npm/html/doc/cli/npm-dist-tag.html +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -87,5 +87,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-docs.html b/deps/npm/html/doc/cli/npm-docs.html index c750230e9ac364..608a88c1bdbca7 100644 --- a/deps/npm/html/doc/cli/npm-docs.html +++ b/deps/npm/html/doc/cli/npm-docs.html @@ -56,5 +56,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-edit.html b/deps/npm/html/doc/cli/npm-edit.html index ff5b3c14360034..489a31fd3dc863 100644 --- a/deps/npm/html/doc/cli/npm-edit.html +++ b/deps/npm/html/doc/cli/npm-edit.html @@ -49,5 +49,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-explore.html b/deps/npm/html/doc/cli/npm-explore.html index 3cfc1e3691b50f..70bfc6d34a7f2d 100644 --- a/deps/npm/html/doc/cli/npm-explore.html +++ b/deps/npm/html/doc/cli/npm-explore.html @@ -49,5 +49,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-help-search.html b/deps/npm/html/doc/cli/npm-help-search.html index 71cb65a8287fd5..2be22217231234 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -31,7 +31,6 @@

long

SEE ALSO

@@ -46,5 +45,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index 870d4b1d76ff28..d34aef1164d7e7 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -30,7 +30,6 @@

SEE ALSO

  • npm(1)
  • README
  • -
  • npm-faq(7)
  • npm-folders(5)
  • npm-config(1)
  • npm-config(7)
  • @@ -51,5 +50,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index 9dbf210986ef64..c92b5d7e25aaaa 100644 --- a/deps/npm/html/doc/cli/npm-init.html +++ b/deps/npm/html/doc/cli/npm-init.html @@ -48,5 +48,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-install-test.html b/deps/npm/html/doc/cli/npm-install-test.html index 848e61c3a433b9..296866d2ad5821 100644 --- a/deps/npm/html/doc/cli/npm-install-test.html +++ b/deps/npm/html/doc/cli/npm-install-test.html @@ -42,4 +42,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index bc9f2bbb878b38..46a24c5f48a240 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -217,6 +217,8 @@

    SYNOPSIS

    global node_modules folder. Only your direct dependencies will show in node_modules and everything they depend on will be flattened in their node_modules folders. This obviously will eliminate some deduping.

    +

    The --ignore-scripts argument will cause npm to not execute any +scripts defined in the package.json. See npm-scripts(7).

    The --legacy-bundling argument will cause npm to install the package such that versions of npm prior to 1.4, such as the one included with node 0.8, can install the package. This eliminates all automatic deduping.

    @@ -310,5 +312,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-link.html b/deps/npm/html/doc/cli/npm-link.html index 959fe81717b1ed..cc7d4b8f7de5ea 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -54,7 +54,6 @@

    SYNOPSIS

    SEE ALSO

    • npm-developers(7)
    • -
    • npm-faq(7)
    • package.json(5)
    • npm-install(1)
    • npm-folders(5)
    • @@ -74,5 +73,5 @@

      SYNOPSIS

             - + diff --git a/deps/npm/html/doc/cli/npm-logout.html b/deps/npm/html/doc/cli/npm-logout.html index c51bc9dc63ac2f..0430fcf35dba78 100644 --- a/deps/npm/html/doc/cli/npm-logout.html +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -51,5 +51,5 @@

      scope

             - + diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index 2dc599fb55c8a5..feaf5c02720b4a 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -21,7 +21,7 @@

      SYNOPSIS

      limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

      -
      npm@3.8.3 /path/to/npm
      +
      npm@3.8.6 /path/to/npm
       └─┬ init-package-json@0.0.4
         └── promzard@0.1.5
       

      It will print out extraneous, missing, and invalid packages.

      @@ -104,5 +104,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index 6f2d8d10bdcc8c..02d947c5a68a23 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -116,5 +116,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index d7e009837436f2..c862feb12d7521 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -51,5 +51,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-pack.html b/deps/npm/html/doc/cli/npm-pack.html index 33af7f5630cade..1e2d1fa63fa34e 100644 --- a/deps/npm/html/doc/cli/npm-pack.html +++ b/deps/npm/html/doc/cli/npm-pack.html @@ -41,5 +41,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-ping.html b/deps/npm/html/doc/cli/npm-ping.html index 5d9b5d13fd9e34..d435090b41572f 100644 --- a/deps/npm/html/doc/cli/npm-ping.html +++ b/deps/npm/html/doc/cli/npm-ping.html @@ -32,4 +32,4 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index 538842f10f117d..c5db17a3abdc61 100644 --- a/deps/npm/html/doc/cli/npm-prefix.html +++ b/deps/npm/html/doc/cli/npm-prefix.html @@ -38,5 +38,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-prune.html b/deps/npm/html/doc/cli/npm-prune.html index 16ae2b4fa5f516..a7fc7c7f734ab4 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -40,5 +40,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index 717636afba192f..f75ed7444018c1 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -72,5 +72,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 88f7e2d89ec139..4b2140aac3f754 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -35,5 +35,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index 159b49fa3b9884..5f9ea1872f0744 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -41,5 +41,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-restart.html b/deps/npm/html/doc/cli/npm-restart.html index dae20aae2d8c78..5644b01f07a055 100644 --- a/deps/npm/html/doc/cli/npm-restart.html +++ b/deps/npm/html/doc/cli/npm-restart.html @@ -53,5 +53,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-root.html b/deps/npm/html/doc/cli/npm-root.html index c575315ce99a99..069f5ccba92396 100644 --- a/deps/npm/html/doc/cli/npm-root.html +++ b/deps/npm/html/doc/cli/npm-root.html @@ -35,5 +35,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-run-script.html b/deps/npm/html/doc/cli/npm-run-script.html index 6c58e7c4ec7eba..b090a308ab461e 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -60,5 +60,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index ffb8ad88177f0b..a2dfaf42348c03 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -57,5 +57,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index 5262766d19f85a..cd6e038e1ab7a6 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -169,5 +169,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-star.html b/deps/npm/html/doc/cli/npm-star.html index b81c9be673e47e..ca1c5f684ba953 100644 --- a/deps/npm/html/doc/cli/npm-star.html +++ b/deps/npm/html/doc/cli/npm-star.html @@ -36,5 +36,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-stars.html b/deps/npm/html/doc/cli/npm-stars.html index bbf916d660b5ae..2016c0af3bb212 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -36,5 +36,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index a93e8362cd3e77..3a4dd2d4d28bc1 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -39,5 +39,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index 36a954c98aa746..95a978ea0a7284 100644 --- a/deps/npm/html/doc/cli/npm-stop.html +++ b/deps/npm/html/doc/cli/npm-stop.html @@ -34,5 +34,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-tag.html b/deps/npm/html/doc/cli/npm-tag.html index c7203668e9cd46..45202c99a3c7e0 100644 --- a/deps/npm/html/doc/cli/npm-tag.html +++ b/deps/npm/html/doc/cli/npm-tag.html @@ -63,5 +63,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-team.html b/deps/npm/html/doc/cli/npm-team.html index c2e5c2a31ea941..fb140ee9fa919d 100644 --- a/deps/npm/html/doc/cli/npm-team.html +++ b/deps/npm/html/doc/cli/npm-team.html @@ -67,4 +67,4 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index d77033da728108..31e6a40cfb2b9f 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -38,5 +38,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index 9df80989e42f5d..356ce459740273 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -60,5 +60,5 @@

      SYNOPSIS

             - + diff --git a/deps/npm/html/doc/cli/npm-unpublish.html b/deps/npm/html/doc/cli/npm-unpublish.html index 1b9ff69b319e6c..99dd3f3f46b81b 100644 --- a/deps/npm/html/doc/cli/npm-unpublish.html +++ b/deps/npm/html/doc/cli/npm-unpublish.html @@ -47,5 +47,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-update.html b/deps/npm/html/doc/cli/npm-update.html index d3bca7bb3c0969..e65100ae4db7ab 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -118,5 +118,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index f4f932f0509ab0..cb507e606e1acd 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -100,5 +100,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index 3bbbcbe3808622..971bfceec72d95 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -86,5 +86,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index 18d85939d29afa..93c9802e08ec5e 100644 --- a/deps/npm/html/doc/cli/npm-whoami.html +++ b/deps/npm/html/doc/cli/npm-whoami.html @@ -33,5 +33,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm.html b/deps/npm/html/doc/cli/npm.html index 517d82f53d972b..d8cc90c8371b1e 100644 --- a/deps/npm/html/doc/cli/npm.html +++ b/deps/npm/html/doc/cli/npm.html @@ -13,7 +13,7 @@

      npm

      javascript package manager

      SYNOPSIS

      npm <command> [args]
       

      VERSION

      -

      3.8.3

      +

      3.8.6

      DESCRIPTION

      npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -126,11 +126,10 @@

      AUTHOR

      Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

      +i@izs.me

      SEE ALSO

      • npm-help(1)
      • -
      • npm-faq(7)
      • README
      • package.json(5)
      • npm-install(1)
      • @@ -151,5 +150,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/files/npm-folders.html b/deps/npm/html/doc/files/npm-folders.html index 6f65dfb33b547d..6bb853addc7f8d 100644 --- a/deps/npm/html/doc/files/npm-folders.html +++ b/deps/npm/html/doc/files/npm-folders.html @@ -161,7 +161,6 @@

        Publishing

        cannot be found elsewhere. See package.json(5) for more information.

        SEE ALSO

          -
        • npm-faq(7)
        • package.json(5)
        • npm-install(1)
        • npm-pack(1)
        • @@ -183,5 +182,5 @@

          SEE ALSO

                 - + diff --git a/deps/npm/html/doc/files/npm-global.html b/deps/npm/html/doc/files/npm-global.html index 6f65dfb33b547d..6bb853addc7f8d 100644 --- a/deps/npm/html/doc/files/npm-global.html +++ b/deps/npm/html/doc/files/npm-global.html @@ -161,7 +161,6 @@

          Publishing

          cannot be found elsewhere. See package.json(5) for more information.

          SEE ALSO

            -
          • npm-faq(7)
          • package.json(5)
          • npm-install(1)
          • npm-pack(1)
          • @@ -183,5 +182,5 @@

            SEE ALSO

                   - + diff --git a/deps/npm/html/doc/files/npm-json.html b/deps/npm/html/doc/files/npm-json.html index 70d9c616bd87bc..d9b6382b8d12c2 100644 --- a/deps/npm/html/doc/files/npm-json.html +++ b/deps/npm/html/doc/files/npm-json.html @@ -162,6 +162,7 @@

            files

          • ._*
          • npm-debug.log
          • .npmrc
          • +
          • node_modules

          main

          The main field is a module ID that is the primary entry point to your program. @@ -494,8 +495,8 @@

          engines

          You can also use the "engines" field to specify which versions of npm are capable of properly installing your program. For example:

          { "engines" : { "npm" : "~1.0.20" } }
          -

          Note that, unless the user has set the engine-strict config flag, this -field is advisory only.

          +

      Unless the user has set the engine-strict config flag, this +field is advisory only will produce warnings when your package is installed as a dependency.

      engineStrict

      This feature was deprecated with npm 3.0.0

      Prior to npm 3.0.0, this feature was used to treat this package as if the @@ -566,7 +567,6 @@

      SEE ALSO

    • npm-config(1)
    • npm-config(7)
    • npm-help(1)
    • -
    • npm-faq(7)
    • npm-install(1)
    • npm-publish(1)
    • npm-uninstall(1)
    • @@ -583,5 +583,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/npmrc.html b/deps/npm/html/doc/files/npmrc.html index e0fcb5b479fed2..8c4b88bb7ddc87 100644 --- a/deps/npm/html/doc/files/npmrc.html +++ b/deps/npm/html/doc/files/npmrc.html @@ -83,5 +83,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/package.json.html b/deps/npm/html/doc/files/package.json.html index 70d9c616bd87bc..d9b6382b8d12c2 100644 --- a/deps/npm/html/doc/files/package.json.html +++ b/deps/npm/html/doc/files/package.json.html @@ -162,6 +162,7 @@

      files

    • ._*
    • npm-debug.log
    • .npmrc
    • +
    • node_modules

    main

    The main field is a module ID that is the primary entry point to your program. @@ -494,8 +495,8 @@

    engines

    You can also use the "engines" field to specify which versions of npm are capable of properly installing your program. For example:

    { "engines" : { "npm" : "~1.0.20" } }
    -

    Note that, unless the user has set the engine-strict config flag, this -field is advisory only.

    +

    Unless the user has set the engine-strict config flag, this +field is advisory only will produce warnings when your package is installed as a dependency.

    engineStrict

    This feature was deprecated with npm 3.0.0

    Prior to npm 3.0.0, this feature was used to treat this package as if the @@ -566,7 +567,6 @@

    SEE ALSO

  • npm-config(1)
  • npm-config(7)
  • npm-help(1)
  • -
  • npm-faq(7)
  • npm-install(1)
  • npm-publish(1)
  • npm-uninstall(1)
  • @@ -583,5 +583,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 2616991f8f6938..914559250a9278 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -162,5 +162,5 @@

    semver(7)

           - + diff --git a/deps/npm/html/doc/misc/npm-coding-style.html b/deps/npm/html/doc/misc/npm-coding-style.html index 5db93707ea1d47..f449d709ae4493 100644 --- a/deps/npm/html/doc/misc/npm-coding-style.html +++ b/deps/npm/html/doc/misc/npm-coding-style.html @@ -139,7 +139,6 @@

    null, undefined, false, 0

    SEE ALSO

    @@ -154,5 +153,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-config.html b/deps/npm/html/doc/misc/npm-config.html index 0df4531c10d805..d972c27946a1e8 100644 --- a/deps/npm/html/doc/misc/npm-config.html +++ b/deps/npm/html/doc/misc/npm-config.html @@ -856,5 +856,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-developers.html b/deps/npm/html/doc/misc/npm-developers.html index 1d1bf4b387422f..77bf7fc0dacb41 100644 --- a/deps/npm/html/doc/misc/npm-developers.html +++ b/deps/npm/html/doc/misc/npm-developers.html @@ -174,7 +174,6 @@

    Brag about it

    Tell the world how easy it is to install your program!

    SEE ALSO

      -
    • npm-faq(7)
    • npm(1)
    • npm-init(1)
    • package.json(5)
    • @@ -195,5 +194,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-disputes.html b/deps/npm/html/doc/misc/npm-disputes.html index 83e2f39b88e42a..5bc80740136d1e 100644 --- a/deps/npm/html/doc/misc/npm-disputes.html +++ b/deps/npm/html/doc/misc/npm-disputes.html @@ -13,7 +13,7 @@

      npm-disputes

      Handling Module

      SYNOPSIS

      1. Get the author email with npm owner ls <pkgname>
      2. -
      3. Email the author, CC support@npmjs.com
      4. +
      5. Email the author, CC support@npmjs.com
      6. After a few weeks, if there's no resolution, we'll sort it out.

      Don't squat on package names. Publish code or move out of the way.

      @@ -51,12 +51,12 @@

      DESCRIPTION

      owner (Bob).
    • Joe emails Bob, explaining the situation as respectfully as possible, and what he would like to do with the module name. He -adds the npm support staff support@npmjs.com to the CC list of +adds the npm support staff support@npmjs.com to the CC list of the email. Mention in the email that Bob can run npm owner add joe foo to add Joe as an owner of the foo package.
    • After a reasonable amount of time, if Bob has not responded, or if Bob and Joe can't come to any sort of resolution, email support -support@npmjs.com and we'll sort it out. ("Reasonable" is +support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least 4 weeks, but extra time is allowed around common holidays.)
    • @@ -112,5 +112,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-index.html b/deps/npm/html/doc/misc/npm-index.html index fe0e65afb9d4a1..92b5121258cdf3 100644 --- a/deps/npm/html/doc/misc/npm-index.html +++ b/deps/npm/html/doc/misc/npm-index.html @@ -162,4 +162,4 @@

      semver(7)

             - + diff --git a/deps/npm/html/doc/misc/npm-orgs.html b/deps/npm/html/doc/misc/npm-orgs.html index 8967cf184197c9..1dd915ad6b0181 100644 --- a/deps/npm/html/doc/misc/npm-orgs.html +++ b/deps/npm/html/doc/misc/npm-orgs.html @@ -22,8 +22,8 @@

      DESCRIPTION

      The developer will be able to access packages based on the teams they are on. Access is either read-write or read-only.

      There are two main commands:

        -
      1. npm team see npm-access(1) for more details
      2. -
      3. npm access see npm-team(1) for more details
      4. +
      5. npm team see npm-team(1) for more details
      6. +
      7. npm access see npm-access(1) for more details

      Team Admins create teams

        @@ -86,4 +86,4 @@

        Team Admins create teams

               - + diff --git a/deps/npm/html/doc/misc/npm-registry.html b/deps/npm/html/doc/misc/npm-registry.html index 90056aa576f2db..087565fec40e9c 100644 --- a/deps/npm/html/doc/misc/npm-registry.html +++ b/deps/npm/html/doc/misc/npm-registry.html @@ -70,5 +70,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/misc/npm-scope.html b/deps/npm/html/doc/misc/npm-scope.html index 63c18a2a5f93c1..43feb0b22c8a73 100644 --- a/deps/npm/html/doc/misc/npm-scope.html +++ b/deps/npm/html/doc/misc/npm-scope.html @@ -91,5 +91,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/misc/npm-scripts.html b/deps/npm/html/doc/misc/npm-scripts.html index dcbc34ca783098..b9cc536cb13c61 100644 --- a/deps/npm/html/doc/misc/npm-scripts.html +++ b/deps/npm/html/doc/misc/npm-scripts.html @@ -207,5 +207,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/misc/removing-npm.html b/deps/npm/html/doc/misc/removing-npm.html index 736d47d5a98522..ea8ea286ebac7d 100644 --- a/deps/npm/html/doc/misc/removing-npm.html +++ b/deps/npm/html/doc/misc/removing-npm.html @@ -57,5 +57,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/misc/semver.html b/deps/npm/html/doc/misc/semver.html index 92cfb4f0e036a7..767fb9d664c047 100644 --- a/deps/npm/html/doc/misc/semver.html +++ b/deps/npm/html/doc/misc/semver.html @@ -302,5 +302,5 @@

        Ranges

               - + diff --git a/deps/npm/html/index.html b/deps/npm/html/index.html index 0d3c128b794d0e..bb8681c85c9fd6 100644 --- a/deps/npm/html/index.html +++ b/deps/npm/html/index.html @@ -61,7 +61,7 @@

        npm

        Easy Zero Line Install

        -

        Install Node.js
        +

        Install Node.js
        (npm comes with it.)

        Because a one-line install is one too many.

        @@ -70,24 +70,22 @@

        Fancy Install

        1. Get the code. -
        2. Do what the README +
        3. Do what the README says to do.

        There's a pretty thorough install script at https://npmjs.org/install.sh

        -

        For maximum security, make sure to thorougly inspect every +

        For maximum security, make sure to thoroughly inspect every program that you run on your computer!

        Other Cool Stuff

        diff --git a/deps/npm/lib/config/cmd-list.js b/deps/npm/lib/config/cmd-list.js index 82725221baf622..9cf975c54a1b8a 100644 --- a/deps/npm/lib/config/cmd-list.js +++ b/deps/npm/lib/config/cmd-list.js @@ -85,7 +85,6 @@ var cmdList = [ 'docs', 'repo', 'bugs', - 'faq', 'root', 'prefix', 'bin', diff --git a/deps/npm/lib/deprecate.js b/deps/npm/lib/deprecate.js index ffc29c9c8b92e1..dff61973ed65db 100644 --- a/deps/npm/lib/deprecate.js +++ b/deps/npm/lib/deprecate.js @@ -37,6 +37,10 @@ function deprecate (args, cb) { // fetch the data and make sure it exists. var p = npa(pkg) + // npa makes the default spec "latest", but for deprecation + // "*" is the appropriate default. + if (p.rawSpec === '') p.spec = '*' + mapToRegistry(p.name, npm.config, function (er, uri, auth) { if (er) return cb(er) diff --git a/deps/npm/lib/faq.js b/deps/npm/lib/faq.js deleted file mode 100644 index c9d88d3012e564..00000000000000 --- a/deps/npm/lib/faq.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = faq - -faq.usage = 'npm faq' - -var npm = require('./npm.js') - -function faq (args, cb) { npm.commands.help(['faq'], cb) } diff --git a/deps/npm/lib/help.js b/deps/npm/lib/help.js index 388a4e7d5d703c..cecc6e02b086ea 100644 --- a/deps/npm/lib/help.js +++ b/deps/npm/lib/help.js @@ -170,7 +170,6 @@ function npmUsage (valid, cb) { '', 'npm -h quick help on ', 'npm -l display full usage info', - 'npm faq commonly asked questions', 'npm help search for help on ', 'npm help npm involved overview', '', diff --git a/deps/npm/lib/search.js b/deps/npm/lib/search.js index 4877417f0d79c7..bf1f6499a71d51 100644 --- a/deps/npm/lib/search.js +++ b/deps/npm/lib/search.js @@ -49,6 +49,10 @@ function search (args, silent, staleness, cb) { return s.toLowerCase() }).filter(function (s) { return s }) + if (opts.length === 0) { + return cb(new Error('search must be called with arguments')) + } + if (typeof searchexclude === 'string') { searchexclude = searchexclude.split(/\s+/) } else { diff --git a/deps/npm/lib/utils/link.js b/deps/npm/lib/utils/link.js index 1091f46833c8c8..d0492e076fd6b8 100644 --- a/deps/npm/lib/utils/link.js +++ b/deps/npm/lib/utils/link.js @@ -25,6 +25,24 @@ function linkIfExists (from, to, gently, cb) { }) } +function resolveIfSymlink (maybeSymlinkPath, cb) { + fs.lstat(maybeSymlinkPath, function (err, stat) { + if (err) return cb.apply(this, arguments) + if (!stat.isSymbolicLink()) return cb(null, maybeSymlinkPath) + fs.readlink(maybeSymlinkPath, cb) + }) +} + +function ensureFromIsNotSource (from, to, cb) { + resolveIfSymlink(from, function (err, fromDestination) { + if (err) return cb.apply(this, arguments) + if (path.resolve(path.dirname(from), fromDestination) === path.resolve(to)) { + return cb(new Error('Link target resolves to the same directory as link source: ' + to)) + } + cb.apply(this, arguments) + }) +} + function link (from, to, gently, abs, cb) { if (typeof cb !== 'function') { cb = abs @@ -48,6 +66,7 @@ function link (from, to, gently, abs, cb) { chain( [ + [ensureFromIsNotSource, from, to], [fs, 'stat', from], [rm, to, gently], [mkdir, path.dirname(to)], diff --git a/deps/npm/man/man1/npm-README.1 b/deps/npm/man/man1/npm-README.1 index b95f97c843cd5c..644147b483dccd 100644 --- a/deps/npm/man/man1/npm-README.1 +++ b/deps/npm/man/man1/npm-README.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "March 2016" "" "" +.TH "NPM" "1" "April 2016" "" "" .SH "NAME" \fBnpm\fR \- a JavaScript package manager .P @@ -145,7 +145,6 @@ you have chosen\. .SH More Docs .P Check out the docs \fIhttps://docs\.npmjs\.com/\fR, -especially the faq \fIhttps://docs\.npmjs\.com/misc/faq\fR\|\. .P You can use the \fBnpm help\fP command to read any of them\. .P @@ -171,8 +170,6 @@ will no doubt tell you to put the output in a gist or email\. .IP \(bu 2 npm help npm .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help help .IP \(bu 2 npm help 7 index diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 97e3f4063f30f3..1346590429cfea 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "March 2016" "" "" +.TH "NPM\-ACCESS" "1" "April 2016" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 677f371b3d25b0..cc034a4f0c4026 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ADDUSER" "1" "March 2016" "" "" +.TH "NPM\-ADDUSER" "1" "April 2016" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index 4a52b6309bb1c6..7d1c758fcf156b 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "March 2016" "" "" +.TH "NPM\-BIN" "1" "April 2016" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 83c10e46e2a05e..b7a0d8329c0156 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "March 2016" "" "" +.TH "NPM\-BUGS" "1" "April 2016" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-build.1 b/deps/npm/man/man1/npm-build.1 index c2d2a883ac3747..ede3c890ec717d 100644 --- a/deps/npm/man/man1/npm-build.1 +++ b/deps/npm/man/man1/npm-build.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUILD" "1" "March 2016" "" "" +.TH "NPM\-BUILD" "1" "April 2016" "" "" .SH "NAME" \fBnpm-build\fR \- Build a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bundle.1 b/deps/npm/man/man1/npm-bundle.1 index 4931522248af43..aa1540bdc95279 100644 --- a/deps/npm/man/man1/npm-bundle.1 +++ b/deps/npm/man/man1/npm-bundle.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUNDLE" "1" "March 2016" "" "" +.TH "NPM\-BUNDLE" "1" "April 2016" "" "" .SH "NAME" \fBnpm-bundle\fR \- REMOVED .SH DESCRIPTION diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index ad1dcd6ede9d29..dd9f6176743341 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "March 2016" "" "" +.TH "NPM\-CACHE" "1" "April 2016" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index 8487fdff9cad38..7cdb4643c91b39 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "March 2016" "" "" +.TH "NPM\-COMPLETION" "1" "April 2016" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SH SYNOPSIS @@ -36,8 +36,6 @@ completions based on the arguments\. .IP \(bu 2 npm help 7 developers .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help npm .RE diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 265164f0a0a23f..7ab468e1844b51 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "March 2016" "" "" +.TH "NPM\-CONFIG" "1" "April 2016" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index 05877e9a7d0ec3..45f829f98d21d0 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "March 2016" "" "" +.TH "NPM\-DEDUPE" "1" "April 2016" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 1cd1337343870f..c7fd28ada8a392 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "March 2016" "" "" +.TH "NPM\-DEPRECATE" "1" "April 2016" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 931278fec90d32..a92340fe760066 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIST\-TAG" "1" "March 2016" "" "" +.TH "NPM\-DIST\-TAG" "1" "April 2016" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index 5dae817eb83440..245d07ab331ae8 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "March 2016" "" "" +.TH "NPM\-DOCS" "1" "April 2016" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index cffd387fa1077b..743425af86d020 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "March 2016" "" "" +.TH "NPM\-EDIT" "1" "April 2016" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index e4359837233b5d..e9c937d299a291 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "1" "March 2016" "" "" +.TH "NPM\-EXPLORE" "1" "April 2016" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index ab398c447f6308..f2927e071a245d 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "March 2016" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "April 2016" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SH SYNOPSIS @@ -37,8 +37,6 @@ If false, then help\-search will just list out the help topics found\. .IP \(bu 2 npm help npm .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help help .RE diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index d281a759d4f6a3..bb5230c05d897c 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "March 2016" "" "" +.TH "NPM\-HELP" "1" "April 2016" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SH SYNOPSIS @@ -36,8 +36,6 @@ npm help npm .IP \(bu 2 README .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help 5 folders .IP \(bu 2 npm help config diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 3b7eb856eae73e..20d3c87fc2dcfc 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "March 2016" "" "" +.TH "NPM\-INIT" "1" "April 2016" "" "" .SH "NAME" \fBnpm-init\fR \- Interactively create a package\.json file .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index 5b1fe9f82ba23b..45462e78ea1ab3 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "March 2016" "" "" +.TH "NPM" "" "April 2016" "" "" .SH "NAME" \fBnpm\fR .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 32c87bf7cee6d3..11de983b7a72ad 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "March 2016" "" "" +.TH "NPM\-INSTALL" "1" "April 2016" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SH SYNOPSIS @@ -320,6 +320,9 @@ global \fBnode_modules\fP folder\. Only your direct dependencies will show in \fBnode_modules\fP and everything they depend on will be flattened in their \fBnode_modules\fP folders\. This obviously will eliminate some deduping\. .P +The \fB\-\-ignore\-scripts\fP argument will cause npm to not execute any +scripts defined in the package\.json\. See npm help 7 \fBnpm\-scripts\fP\|\. +.P The \fB\-\-legacy\-bundling\fP argument will cause npm to install the package such that versions of npm prior to 1\.4, such as the one included with node 0\.8, can install the package\. This eliminates all automatic deduping\. diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index db43123a6875af..d99fcf1d08ddb7 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "March 2016" "" "" +.TH "NPM\-LINK" "1" "April 2016" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SH SYNOPSIS @@ -85,8 +85,6 @@ npm link @myorg/privatepackage .IP \(bu 2 npm help 7 developers .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help 5 package\.json .IP \(bu 2 npm help install diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index b8c0b81511bbf7..4cb1d2c6329cbc 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "March 2016" "" "" +.TH "NPM\-LOGOUT" "1" "April 2016" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 1aaf9e73b7b9d7..8298409c660249 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "March 2016" "" "" +.TH "NPM\-LS" "1" "April 2016" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SH SYNOPSIS @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@3.8.3 /path/to/npm +npm@3.8.6 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 9ac425effc3473..6cb81b075b3d18 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "March 2016" "" "" +.TH "NPM\-OUTDATED" "1" "April 2016" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index 1c680a71e97fd0..30aeb00bbab548 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "March 2016" "" "" +.TH "NPM\-OWNER" "1" "April 2016" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 523334225e9dbb..4d242b139c17ea 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "March 2016" "" "" +.TH "NPM\-PACK" "1" "April 2016" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index 8b776bedcad8bd..a39c37419239af 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "March 2016" "" "" +.TH "NPM\-PING" "1" "April 2016" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 88991c72e62ee0..a37596200914bb 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "March 2016" "" "" +.TH "NPM\-PREFIX" "1" "April 2016" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index b02d5d41a38d73..6538b5a8015491 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "March 2016" "" "" +.TH "NPM\-PRUNE" "1" "April 2016" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index 553c3bbd15a825..182d4bbbeef29d 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "March 2016" "" "" +.TH "NPM\-PUBLISH" "1" "April 2016" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 15ab16c2c82328..668002e2ba480f 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "March 2016" "" "" +.TH "NPM\-REBUILD" "1" "April 2016" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 266d31713cfe68..86dc40727d9251 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "March 2016" "" "" +.TH "NPM\-REPO" "1" "April 2016" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 54ab5c92bcba6a..5127fcf9e5e7c0 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "March 2016" "" "" +.TH "NPM\-RESTART" "1" "April 2016" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index c85e1dc54f919e..8fd77cf6bc0eb3 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "March 2016" "" "" +.TH "NPM\-ROOT" "1" "April 2016" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index 70f2a7a99cca87..618d49d3d1fffb 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "March 2016" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "April 2016" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 7afbbc28f9c31b..c99830fca52797 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "March 2016" "" "" +.TH "NPM\-SEARCH" "1" "April 2016" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index 0ae94a23ac4267..13d7c2d85be9ad 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "March 2016" "" "" +.TH "NPM\-SHRINKWRAP" "1" "April 2016" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 91aa06877ceafd..9f52ce52dd26ae 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "March 2016" "" "" +.TH "NPM\-STAR" "1" "April 2016" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index fc579d23975c8d..59d5897e12625a 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "March 2016" "" "" +.TH "NPM\-STARS" "1" "April 2016" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 36f26f96224cfc..bd65a9149f8a8c 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "March 2016" "" "" +.TH "NPM\-START" "1" "April 2016" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index d4e5dcb993d411..a99c6fe5ab4d03 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "March 2016" "" "" +.TH "NPM\-STOP" "1" "April 2016" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-tag.1 b/deps/npm/man/man1/npm-tag.1 index 7dab63a89d4a45..4a670febef08f5 100644 --- a/deps/npm/man/man1/npm-tag.1 +++ b/deps/npm/man/man1/npm-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TAG" "1" "March 2016" "" "" +.TH "NPM\-TAG" "1" "April 2016" "" "" .SH "NAME" \fBnpm-tag\fR \- Tag a published version .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index 50e1c7e635044e..297e648c741b79 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "March 2016" "" "" +.TH "NPM\-TEAM" "1" "April 2016" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 6e35b5f540d2c7..068e0176723209 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "March 2016" "" "" +.TH "NPM\-TEST" "1" "April 2016" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index c7b24aeedd154e..65b28b4bd7fdc3 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "1" "March 2016" "" "" +.TH "NPM\-UNINSTALL" "1" "April 2016" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 45227244daeb07..aded668480f987 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "March 2016" "" "" +.TH "NPM\-UNPUBLISH" "1" "April 2016" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 28fa7f4be4b2dd..dc262065b271cb 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "March 2016" "" "" +.TH "NPM\-UPDATE" "1" "April 2016" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 90b6c0867c107e..ac74ee8dd6f25b 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "March 2016" "" "" +.TH "NPM\-VERSION" "1" "April 2016" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 0fdeeff6dc8f68..62b2042cd17037 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "March 2016" "" "" +.TH "NPM\-VIEW" "1" "April 2016" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 7f6b515c3848ea..183016ae025a82 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "March 2016" "" "" +.TH "NPM\-WHOAMI" "1" "April 2016" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 457ee5e9884761..165cf1b890622c 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "March 2016" "" "" +.TH "NPM" "1" "April 2016" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SH SYNOPSIS @@ -10,7 +10,7 @@ npm [args] .RE .SH VERSION .P -3.8.3 +3.8.6 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts @@ -187,8 +187,6 @@ i@izs\.me .IP \(bu 2 npm help help .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 README .IP \(bu 2 npm help 5 package\.json diff --git a/deps/npm/man/man5/npm-folders.5 b/deps/npm/man/man5/npm-folders.5 index 33ad7d4c63d83f..f4f37f0c22b2a7 100644 --- a/deps/npm/man/man5/npm-folders.5 +++ b/deps/npm/man/man5/npm-folders.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "March 2016" "" "" +.TH "NPM\-FOLDERS" "5" "April 2016" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION @@ -207,8 +207,6 @@ cannot be found elsewhere\. See npm help 5 \fBpackage\.json\fP for more informa .SH SEE ALSO .RS 0 .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help 5 package\.json .IP \(bu 2 npm help install diff --git a/deps/npm/man/man5/npm-global.5 b/deps/npm/man/man5/npm-global.5 index 33ad7d4c63d83f..f4f37f0c22b2a7 100644 --- a/deps/npm/man/man5/npm-global.5 +++ b/deps/npm/man/man5/npm-global.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "March 2016" "" "" +.TH "NPM\-FOLDERS" "5" "April 2016" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION @@ -207,8 +207,6 @@ cannot be found elsewhere\. See npm help 5 \fBpackage\.json\fP for more informa .SH SEE ALSO .RS 0 .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help 5 package\.json .IP \(bu 2 npm help install diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index b492849675cafa..09689ad85bfd57 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "March 2016" "" "" +.TH "PACKAGE\.JSON" "5" "April 2016" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -263,6 +263,8 @@ Conversely, some files are always ignored: \fBnpm\-debug\.log\fP .IP \(bu 2 \fB\|\.npmrc\fP +.IP \(bu 2 +\fBnode_modules\fP .RE .SH main @@ -791,8 +793,8 @@ are capable of properly installing your program\. For example: .fi .RE .P -Note that, unless the user has set the \fBengine\-strict\fP config flag, this -field is advisory only\. +Unless the user has set the \fBengine\-strict\fP config flag, this +field is advisory only will produce warnings when your package is installed as a dependency\. .SH engineStrict .P \fBThis feature was deprecated with npm 3\.0\.0\fR @@ -908,8 +910,6 @@ npm help 7 config .IP \(bu 2 npm help help .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help install .IP \(bu 2 npm help publish diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index e99cb155dadc57..63054cde3c2e2f 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "March 2016" "" "" +.TH "NPMRC" "5" "April 2016" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SH DESCRIPTION diff --git a/deps/npm/man/man5/package.json.5 b/deps/npm/man/man5/package.json.5 index b492849675cafa..09689ad85bfd57 100644 --- a/deps/npm/man/man5/package.json.5 +++ b/deps/npm/man/man5/package.json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "March 2016" "" "" +.TH "PACKAGE\.JSON" "5" "April 2016" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -263,6 +263,8 @@ Conversely, some files are always ignored: \fBnpm\-debug\.log\fP .IP \(bu 2 \fB\|\.npmrc\fP +.IP \(bu 2 +\fBnode_modules\fP .RE .SH main @@ -791,8 +793,8 @@ are capable of properly installing your program\. For example: .fi .RE .P -Note that, unless the user has set the \fBengine\-strict\fP config flag, this -field is advisory only\. +Unless the user has set the \fBengine\-strict\fP config flag, this +field is advisory only will produce warnings when your package is installed as a dependency\. .SH engineStrict .P \fBThis feature was deprecated with npm 3\.0\.0\fR @@ -908,8 +910,6 @@ npm help 7 config .IP \(bu 2 npm help help .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help install .IP \(bu 2 npm help publish diff --git a/deps/npm/man/man7/npm-coding-style.7 b/deps/npm/man/man7/npm-coding-style.7 index 1866cdf8b664d5..745ac94e2d317b 100644 --- a/deps/npm/man/man7/npm-coding-style.7 +++ b/deps/npm/man/man7/npm-coding-style.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CODING\-STYLE" "7" "March 2016" "" "" +.TH "NPM\-CODING\-STYLE" "7" "April 2016" "" "" .SH "NAME" \fBnpm-coding-style\fR \- npm's "funny" coding style .SH DESCRIPTION @@ -216,8 +216,6 @@ Boolean objects are verboten\. .IP \(bu 2 npm help 7 developers .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help npm .RE diff --git a/deps/npm/man/man7/npm-config.7 b/deps/npm/man/man7/npm-config.7 index b3c376ab88ccff..3a4df5e5e02166 100644 --- a/deps/npm/man/man7/npm-config.7 +++ b/deps/npm/man/man7/npm-config.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "7" "March 2016" "" "" +.TH "NPM\-CONFIG" "7" "April 2016" "" "" .SH "NAME" \fBnpm-config\fR \- More than you probably want to know about npm configuration .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-developers.7 b/deps/npm/man/man7/npm-developers.7 index a9162d0ff65cc9..3d9247ac04bc1e 100644 --- a/deps/npm/man/man7/npm-developers.7 +++ b/deps/npm/man/man7/npm-developers.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DEVELOPERS" "7" "March 2016" "" "" +.TH "NPM\-DEVELOPERS" "7" "April 2016" "" "" .SH "NAME" \fBnpm-developers\fR \- Developer Guide .SH DESCRIPTION @@ -262,8 +262,6 @@ Tell the world how easy it is to install your program! .SH SEE ALSO .RS 0 .IP \(bu 2 -npm help 7 faq -.IP \(bu 2 npm help npm .IP \(bu 2 npm help init diff --git a/deps/npm/man/man7/npm-disputes.7 b/deps/npm/man/man7/npm-disputes.7 index 3e56cc4a3dca47..385921c79cb06b 100644 --- a/deps/npm/man/man7/npm-disputes.7 +++ b/deps/npm/man/man7/npm-disputes.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DISPUTES" "7" "March 2016" "" "" +.TH "NPM\-DISPUTES" "7" "April 2016" "" "" .SH "NAME" \fBnpm-disputes\fR \- Handling Module Name Disputes .SH SYNOPSIS diff --git a/deps/npm/man/man7/npm-index.7 b/deps/npm/man/man7/npm-index.7 index 8b53025679102d..17b6fa7777978d 100644 --- a/deps/npm/man/man7/npm-index.7 +++ b/deps/npm/man/man7/npm-index.7 @@ -1,4 +1,4 @@ -.TH "NPM\-INDEX" "7" "March 2016" "" "" +.TH "NPM\-INDEX" "7" "April 2016" "" "" .SH "NAME" \fBnpm-index\fR \- Index of all npm documentation .SS npm help README diff --git a/deps/npm/man/man7/npm-orgs.7 b/deps/npm/man/man7/npm-orgs.7 index 031c93376d8a32..71c5197f64faeb 100644 --- a/deps/npm/man/man7/npm-orgs.7 +++ b/deps/npm/man/man7/npm-orgs.7 @@ -1,4 +1,4 @@ -.TH "NPM\-ORGS" "7" "March 2016" "" "" +.TH "NPM\-ORGS" "7" "April 2016" "" "" .SH "NAME" \fBnpm-orgs\fR \- Working with Teams & Orgs .SH DESCRIPTION @@ -23,9 +23,9 @@ The developer will be able to access packages based on the teams they are on\. A There are two main commands: .RS 0 .IP 1. 3 -\fBnpm team\fP see npm help access for more details +\fBnpm team\fP see npm help team for more details .IP 2. 3 -\fBnpm access\fP see npm help team for more details +\fBnpm access\fP see npm help access for more details .RE .SH Team Admins create teams diff --git a/deps/npm/man/man7/npm-registry.7 b/deps/npm/man/man7/npm-registry.7 index 5ef2ab8df190e0..e50735dc74db70 100644 --- a/deps/npm/man/man7/npm-registry.7 +++ b/deps/npm/man/man7/npm-registry.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REGISTRY" "7" "March 2016" "" "" +.TH "NPM\-REGISTRY" "7" "April 2016" "" "" .SH "NAME" \fBnpm-registry\fR \- The JavaScript Package Registry .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scope.7 b/deps/npm/man/man7/npm-scope.7 index 88c3fcf30a7ee3..e26b614bd42601 100644 --- a/deps/npm/man/man7/npm-scope.7 +++ b/deps/npm/man/man7/npm-scope.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCOPE" "7" "March 2016" "" "" +.TH "NPM\-SCOPE" "7" "April 2016" "" "" .SH "NAME" \fBnpm-scope\fR \- Scoped packages .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scripts.7 b/deps/npm/man/man7/npm-scripts.7 index 28fbe3ac32026e..72c220f0639fa6 100644 --- a/deps/npm/man/man7/npm-scripts.7 +++ b/deps/npm/man/man7/npm-scripts.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCRIPTS" "7" "March 2016" "" "" +.TH "NPM\-SCRIPTS" "7" "April 2016" "" "" .SH "NAME" \fBnpm-scripts\fR \- How npm handles the "scripts" field .SH DESCRIPTION diff --git a/deps/npm/man/man7/removing-npm.7 b/deps/npm/man/man7/removing-npm.7 index 338724b26a06dc..d77f66995cf073 100644 --- a/deps/npm/man/man7/removing-npm.7 +++ b/deps/npm/man/man7/removing-npm.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REMOVAL" "1" "March 2016" "" "" +.TH "NPM\-REMOVAL" "1" "April 2016" "" "" .SH "NAME" \fBnpm-removal\fR \- Cleaning the Slate .SH SYNOPSIS diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index 2cb733f85fe3c6..acec7e039a26e4 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "March 2016" "" "" +.TH "SEMVER" "7" "April 2016" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Usage diff --git a/deps/npm/node_modules/async-some/.eslintrc b/deps/npm/node_modules/async-some/.eslintrc deleted file mode 100644 index 5c39c67eca02a9..00000000000000 --- a/deps/npm/node_modules/async-some/.eslintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "env" : { - "node" : true - }, - "rules" : { - "curly" : 0, - "no-lonely-if" : 1, - "no-mixed-requires" : 0, - "no-underscore-dangle" : 0, - "no-unused-vars" : [2, {"vars" : "all", "args" : "after-used"}], - "no-use-before-define" : [2, "nofunc"], - "quotes" : [1, "double", "avoid-escape"], - "semi" : [2, "never"], - "space-after-keywords" : 1, - "space-infix-ops" : 0, - "strict" : 0 - } -} diff --git a/deps/npm/node_modules/async-some/.npmignore b/deps/npm/node_modules/async-some/.npmignore deleted file mode 100644 index 3c3629e647f5dd..00000000000000 --- a/deps/npm/node_modules/async-some/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/deps/npm/node_modules/async-some/LICENSE b/deps/npm/node_modules/async-some/LICENSE deleted file mode 100644 index d21147bf1965eb..00000000000000 --- a/deps/npm/node_modules/async-some/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2014-2015, Forrest L Norvell - -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/deps/npm/node_modules/async-some/README.md b/deps/npm/node_modules/async-some/README.md deleted file mode 100644 index bb502ee0608720..00000000000000 --- a/deps/npm/node_modules/async-some/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# some - -Short-circuited async Array.prototype.some implementation. - -Serially evaluates a list of values from a JS array or arraylike -against an asynchronous predicate, terminating on the first truthy -value. If the predicate encounters an error, pass it to the completion -callback. Otherwise, pass the truthy value passed by the predicate, or -`false` if no truthy value was passed. - -Is -[Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)-proof, -browser-safe, and pretty efficient. - -## Usage - -```javascript -var some = require("async-some"); -var resolve = require("path").resolve; -var stat = require("fs").stat; -var readFileSync = require("fs").readFileSync; - -some(["apple", "seaweed", "ham", "quince"], porkDetector, function (error, match) { - if (error) return console.error(error); - - if (match) return console.dir(JSON.parse(readFileSync(match))); - - console.error("time to buy more Sporkle™!"); -}); - -var PREFIX = resolve(__dirname, "../pork_store"); -function porkDetector(value, cb) { - var path = resolve(PREFIX, value + ".json"); - stat(path, function (er, stat) { - if (er) { - if (er.code === "ENOENT") return cb(null, false); - - return cb(er); - } - - cb(er, path); - }); -} -``` - -### some(list, test, callback) - -* `list` {Object} An arraylike (either an Array or the arguments arraylike) to - be checked. -* `test` {Function} The predicate against which the elements of `list` will be - tested. Takes two parameters: - * `element` {any} The element of the list to be tested. - * `callback` {Function} The continuation to be called once the test is - complete. Takes (again) two values: - * `error` {Error} Any errors that the predicate encountered. - * `value` {any} A truthy value. A non-falsy result terminates checking the - entire list. -* `callback` {Function} The callback to invoke when either a value has been - found or the entire input list has been processed with no result. Is invoked - with the traditional two parameters: - * `error` {Error} Errors that were encountered during the evaluation of some(). - * `match` {any} Value successfully matched by `test`, if any. diff --git a/deps/npm/node_modules/async-some/package.json b/deps/npm/node_modules/async-some/package.json deleted file mode 100644 index b7d5521e58dfba..00000000000000 --- a/deps/npm/node_modules/async-some/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "async-some", - "version": "1.0.2", - "description": "short-circuited, asynchronous version of Array.protototype.some", - "main": "some.js", - "scripts": { - "test": "tap test/*.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/othiym23/async-some.git" - }, - "keywords": [ - "async", - "some", - "array", - "collections", - "fp" - ], - "author": { - "name": "Forrest L Norvell", - "email": "ogd@aoaioxxysz.net" - }, - "license": "ISC", - "bugs": { - "url": "https://github.com/othiym23/async-some/issues" - }, - "homepage": "https://github.com/othiym23/async-some", - "dependencies": { - "dezalgo": "^1.0.2" - }, - "devDependencies": { - "tap": "^1.1.0" - }, - "readme": "# some\n\nShort-circuited async Array.prototype.some implementation.\n\nSerially evaluates a list of values from a JS array or arraylike\nagainst an asynchronous predicate, terminating on the first truthy\nvalue. If the predicate encounters an error, pass it to the completion\ncallback. Otherwise, pass the truthy value passed by the predicate, or\n`false` if no truthy value was passed.\n\nIs\n[Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)-proof,\nbrowser-safe, and pretty efficient.\n\n## Usage\n\n```javascript\nvar some = require(\"async-some\");\nvar resolve = require(\"path\").resolve;\nvar stat = require(\"fs\").stat;\nvar readFileSync = require(\"fs\").readFileSync;\n\nsome([\"apple\", \"seaweed\", \"ham\", \"quince\"], porkDetector, function (error, match) {\n if (error) return console.error(error);\n\n if (match) return console.dir(JSON.parse(readFileSync(match)));\n\n console.error(\"time to buy more Sporkle™!\");\n});\n\nvar PREFIX = resolve(__dirname, \"../pork_store\");\nfunction porkDetector(value, cb) {\n var path = resolve(PREFIX, value + \".json\");\n stat(path, function (er, stat) {\n if (er) {\n if (er.code === \"ENOENT\") return cb(null, false);\n\n return cb(er);\n }\n\n cb(er, path);\n });\n}\n```\n\n### some(list, test, callback)\n\n* `list` {Object} An arraylike (either an Array or the arguments arraylike) to\n be checked.\n* `test` {Function} The predicate against which the elements of `list` will be\n tested. Takes two parameters:\n * `element` {any} The element of the list to be tested.\n * `callback` {Function} The continuation to be called once the test is\n complete. Takes (again) two values:\n * `error` {Error} Any errors that the predicate encountered.\n * `value` {any} A truthy value. A non-falsy result terminates checking the\n entire list.\n* `callback` {Function} The callback to invoke when either a value has been\n found or the entire input list has been processed with no result. Is invoked\n with the traditional two parameters:\n * `error` {Error} Errors that were encountered during the evaluation of some().\n * `match` {any} Value successfully matched by `test`, if any.\n", - "readmeFilename": "README.md", - "gitHead": "3a5086ad54739c48b2bbf073f23bcc95658199e3", - "_id": "async-some@1.0.2", - "_shasum": "4d8a81620d5958791b5b98f802d3207776e95509", - "_from": "async-some@>=1.0.2 <1.1.0" -} diff --git a/deps/npm/node_modules/async-some/some.js b/deps/npm/node_modules/async-some/some.js deleted file mode 100644 index 0419709f763daa..00000000000000 --- a/deps/npm/node_modules/async-some/some.js +++ /dev/null @@ -1,47 +0,0 @@ -var assert = require("assert") -var dezalgoify = require("dezalgo") - -module.exports = some - -/** - * short-circuited async Array.prototype.some implementation - * - * Serially evaluates a list of values from a JS array or arraylike - * against an asynchronous predicate, terminating on the first truthy - * value. If the predicate encounters an error, pass it to the completion - * callback. Otherwise, pass the truthy value passed by the predicate, or - * `false` if no truthy value was passed. - */ -function some (list, test, cb) { - assert("length" in list, "array must be arraylike") - assert.equal(typeof test, "function", "predicate must be callable") - assert.equal(typeof cb, "function", "callback must be callable") - - var array = slice(list) - , index = 0 - , length = array.length - , hecomes = dezalgoify(cb) - - map() - - function map () { - if (index >= length) return hecomes(null, false) - - test(array[index], reduce) - } - - function reduce (er, result) { - if (er) return hecomes(er, false) - if (result) return hecomes(null, result) - - index++ - map() - } -} - -// Array.prototype.slice on arguments arraylike is expensive -function slice(args) { - var l = args.length, a = [], i - for (i = 0; i < l; i++) a[i] = args[i] - return a -} diff --git a/deps/npm/node_modules/async-some/test/base-case.js b/deps/npm/node_modules/async-some/test/base-case.js deleted file mode 100644 index 356890521d6bd7..00000000000000 --- a/deps/npm/node_modules/async-some/test/base-case.js +++ /dev/null @@ -1,35 +0,0 @@ -var test = require("tap").test - -var some = require("../some.js") - -test("some() array base case", function (t) { - some([], failer, function (error, match) { - t.ifError(error, "ran successfully") - - t.notOk(match, "nothing to find, so nothing found") - - t.end() - }) - - function failer(value, cb) { - cb(new Error("test should never have been called")) - } -}) - -test("some() arguments arraylike base case", function (t) { - go() - - function go() { - some(arguments, failer, function (error, match) { - t.ifError(error, "ran successfully") - - t.notOk(match, "nothing to find, so nothing found") - - t.end() - }) - - function failer(value, cb) { - cb(new Error("test should never have been called")) - } - } -}) diff --git a/deps/npm/node_modules/async-some/test/parameters.js b/deps/npm/node_modules/async-some/test/parameters.js deleted file mode 100644 index 0706d1da6fc628..00000000000000 --- a/deps/npm/node_modules/async-some/test/parameters.js +++ /dev/null @@ -1,37 +0,0 @@ -var test = require("tap").test - -var some = require("../some.js") - -var NOP = function () {} - -test("some() called with bogus parameters", function (t) { - t.throws(function () { - some() - }, "throws when called with no parameters") - - t.throws(function () { - some(null, NOP, NOP) - }, "throws when called with no list") - - t.throws(function () { - some([], null, NOP) - }, "throws when called with no predicate") - - t.throws(function () { - some([], NOP, null) - }, "throws when called with no callback") - - t.throws(function () { - some({}, NOP, NOP) - }, "throws when called with wrong list type") - - t.throws(function () { - some([], "ham", NOP) - }, "throws when called with wrong test type") - - t.throws(function () { - some([], NOP, "ham") - }, "throws when called with wrong test type") - - t.end() -}) diff --git a/deps/npm/node_modules/async-some/test/simple.js b/deps/npm/node_modules/async-some/test/simple.js deleted file mode 100644 index 3d68e1e5076c0d..00000000000000 --- a/deps/npm/node_modules/async-some/test/simple.js +++ /dev/null @@ -1,60 +0,0 @@ -var test = require("tap").test - -var some = require("../some.js") - -test("some() doesn't find anything asynchronously", function (t) { - some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) { - t.ifError(error, "ran successfully") - - t.notOk(match, "nothing to find, so nothing found") - - t.end() - }) - - function predicate(value, cb) { - // dezalgo ensures it's safe to not do this, but just in case - setTimeout(function () { cb(null, value > "j" && value) }) - } -}) - -test("some() doesn't find anything synchronously", function (t) { - some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) { - t.ifError(error, "ran successfully") - - t.notOk(match, "nothing to find, so nothing found") - - t.end() - }) - - function predicate(value, cb) { - cb(null, value > "j" && value) - } -}) - -test("some() doesn't find anything asynchronously", function (t) { - some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) { - t.ifError(error, "ran successfully") - - t.equals(match, "d", "found expected element") - - t.end() - }) - - function predicate(value, cb) { - setTimeout(function () { cb(null, value > "c" && value) }) - } -}) - -test("some() doesn't find anything synchronously", function (t) { - some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) { - t.ifError(error, "ran successfully") - - t.equals(match, "d", "found expected") - - t.end() - }) - - function predicate(value, cb) { - cb(null, value > "c" && value) - } -}) diff --git a/deps/npm/node_modules/lodash._baseuniq/README.md b/deps/npm/node_modules/lodash._baseuniq/README.md index 5e73270f91cf33..1d02b801f9bb3b 100644 --- a/deps/npm/node_modules/lodash._baseuniq/README.md +++ b/deps/npm/node_modules/lodash._baseuniq/README.md @@ -1,4 +1,4 @@ -# lodash._baseuniq v4.5.0 +# lodash._baseuniq v4.5.1 The internal [lodash](https://lodash.com/) function `baseUniq` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseUniq = require('lodash._baseuniq'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.5.0-npm-packages/lodash._baseuniq) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.5.1-npm-packages/lodash._baseuniq) for more details. diff --git a/deps/npm/node_modules/lodash._baseuniq/index.js b/deps/npm/node_modules/lodash._baseuniq/index.js index 894eb34c758383..ffdc06f7b57aff 100644 --- a/deps/npm/node_modules/lodash._baseuniq/index.js +++ b/deps/npm/node_modules/lodash._baseuniq/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.5.0 (Custom Build) + * lodash 4.5.1 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -29,8 +29,7 @@ function arrayIncludes(array, value) { } /** - * A specialized version of `_.includesWith` for arrays without support for - * specifying an index to search from. + * This function is like `arrayIncludes` except that it accepts a comparator. * * @private * @param {Array} array The array to search. diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md index 117109172bf8a6..fe6cc9b5121339 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md @@ -1,4 +1,4 @@ -# lodash._createset v4.0.0 +# lodash._createset v4.0.1 The internal [lodash](https://lodash.com/) function `createSet` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var createSet = require('lodash._createset'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash._createset) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash._createset) for more details. diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js index 3fd2f360d6a011..8c85b236d13461 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.0.0 (Custom Build) + * lodash 4.0.1 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -129,7 +129,7 @@ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object == null ? undefined : object[key]; + var value = object[key]; return isNative(value) ? value : undefined; } @@ -151,8 +151,8 @@ function getNative(object, key) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json index 62cb810c669479..857e620a91b611 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json @@ -1,19 +1,19 @@ { "_args": [ [ - "lodash._createset@^4.0.0", - "/Users/rebecca/code/npm/node_modules/lodash._baseuniq" + "lodash._createset@~4.0.0", + "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq" ] ], - "_from": "lodash._createset@>=4.0.0 <5.0.0", - "_id": "lodash._createset@4.0.0", + "_from": "lodash._createset@>=4.0.0 <4.1.0", + "_id": "lodash._createset@4.0.1", "_inCache": true, "_installable": true, "_location": "/lodash._baseuniq/lodash._createset", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-6-west.internal.npmjs.com", - "tmp": "tmp/lodash._createset-4.0.0.tgz_1456330780129_0.0739455302245915" + "host": "packages-13-west.internal.npmjs.com", + "tmp": "tmp/lodash._createset-4.0.1.tgz_1456896434807_0.3753381560090929" }, "_npmUser": { "email": "john.david.dalton@gmail.com", @@ -23,20 +23,20 @@ "_phantomChildren": {}, "_requested": { "name": "lodash._createset", - "raw": "lodash._createset@^4.0.0", - "rawSpec": "^4.0.0", + "raw": "lodash._createset@~4.0.0", + "rawSpec": "~4.0.0", "scope": null, - "spec": ">=4.0.0 <5.0.0", + "spec": ">=4.0.0 <4.1.0", "type": "range" }, "_requiredBy": [ "/lodash._baseuniq" ], - "_resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.0.tgz", - "_shasum": "92b46092919dd7270e9fab70294feadb3a835822", + "_resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.1.tgz", + "_shasum": "00e891e3dd386c4512fcb1f49060dfa4d02a9819", "_shrinkwrap": null, - "_spec": "lodash._createset@^4.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/lodash._baseuniq", + "_spec": "lodash._createset@~4.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -52,7 +52,7 @@ "url": "http://allyoucanleet.com/" }, { - "email": "blaine@iceddev.com", + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", "url": "https://github.com/phated" }, @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "92b46092919dd7270e9fab70294feadb3a835822", - "tarball": "http://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.0.tgz" + "shasum": "00e891e3dd386c4512fcb1f49060dfa4d02a9819", + "tarball": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -77,6 +77,14 @@ { "email": "john.david.dalton@gmail.com", "name": "jdalton" + }, + { + "email": "mathias@qiwi.be", + "name": "mathias" + }, + { + "email": "blaine.bublitz@gmail.com", + "name": "phated" } ], "name": "lodash._createset", @@ -89,5 +97,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.0.0" + "version": "4.0.1" } diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/README.md b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/README.md index 37f7ddfcad86d5..696e7cd135725c 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/README.md +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/README.md @@ -1,4 +1,4 @@ -# lodash._setcache v4.1.0 +# lodash._setcache v4.1.1 The internal [lodash](https://lodash.com/) function `SetCache` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var SetCache = require('lodash._setcache'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash._setcache) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash._setcache) for more details. diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js index 4260d6390e1800..dd96de49f1fa96 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.1.1 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -415,7 +415,7 @@ function assocSet(array, key, value) { * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object == null ? undefined : object[key]; + var value = object[key]; return isNative(value) ? value : undefined; } @@ -484,8 +484,8 @@ function eq(value, other) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json index e8d85999d6d989..2fedb703b4b97b 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash._setcache@^4.0.0", - "/Users/rebecca/code/npm/node_modules/lodash._baseuniq" + "lodash._setcache@~4.1.0", + "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq" ] ], - "_from": "lodash._setcache@>=4.0.0 <5.0.0", - "_id": "lodash._setcache@4.1.0", + "_from": "lodash._setcache@>=4.1.0 <4.2.0", + "_id": "lodash._setcache@4.1.1", "_inCache": true, "_installable": true, "_location": "/lodash._baseuniq/lodash._setcache", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-5-east.internal.npmjs.com", - "tmp": "tmp/lodash._setcache-4.1.0.tgz_1455699934524_0.5983484762255102" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/lodash._setcache-4.1.1.tgz_1456896443505_0.39592266851104796" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.18", + "_npmVersion": "2.14.17", "_phantomChildren": {}, "_requested": { "name": "lodash._setcache", - "raw": "lodash._setcache@^4.0.0", - "rawSpec": "^4.0.0", + "raw": "lodash._setcache@~4.1.0", + "rawSpec": "~4.1.0", "scope": null, - "spec": ">=4.0.0 <5.0.0", + "spec": ">=4.1.0 <4.2.0", "type": "range" }, "_requiredBy": [ "/lodash._baseuniq" ], - "_resolved": "https://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.0.tgz", - "_shasum": "ecc48719346faf667343b390b4572a3063f3827c", + "_resolved": "https://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.1.tgz", + "_shasum": "338f47e49f21ba8bb89e621e7815d781bd4dbd97", "_shrinkwrap": null, - "_spec": "lodash._setcache@^4.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/lodash._baseuniq", + "_spec": "lodash._setcache@~4.1.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -52,7 +52,7 @@ "url": "http://allyoucanleet.com/" }, { - "email": "blaine@iceddev.com", + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", "url": "https://github.com/phated" }, @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "ecc48719346faf667343b390b4572a3063f3827c", - "tarball": "http://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.0.tgz" + "shasum": "338f47e49f21ba8bb89e621e7815d781bd4dbd97", + "tarball": "https://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -97,5 +97,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.1.0" + "version": "4.1.1" } diff --git a/deps/npm/node_modules/lodash._baseuniq/package.json b/deps/npm/node_modules/lodash._baseuniq/package.json index c39fc30276ac87..f4cffe5507b59f 100644 --- a/deps/npm/node_modules/lodash._baseuniq/package.json +++ b/deps/npm/node_modules/lodash._baseuniq/package.json @@ -1,44 +1,44 @@ { "_args": [ [ - "lodash._baseuniq@latest", - "/Users/rebecca/code/npm" + "lodash._baseuniq@4.5.1", + "/Users/zkat/Documents/code/npm" ] ], - "_from": "lodash._baseuniq@latest", - "_id": "lodash._baseuniq@4.5.0", + "_from": "lodash._baseuniq@4.5.1", + "_id": "lodash._baseuniq@4.5.1", "_inCache": true, "_installable": true, "_location": "/lodash._baseuniq", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-5-east.internal.npmjs.com", - "tmp": "tmp/lodash._baseuniq-4.5.0.tgz_1456330775872_0.6085790924262255" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/lodash._baseuniq-4.5.1.tgz_1459310621859_0.6014031588565558" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.17", + "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "name": "lodash._baseuniq", - "raw": "lodash._baseuniq@latest", - "rawSpec": "latest", + "raw": "lodash._baseuniq@4.5.1", + "rawSpec": "4.5.1", "scope": null, - "spec": "latest", - "type": "tag" + "spec": "4.5.1", + "type": "version" }, "_requiredBy": [ "/", "/lodash.union", "/lodash.uniq" ], - "_resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.5.0.tgz", - "_shasum": "50e82673ae56f5fd07160584864648b7e3c528e8", + "_resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.5.1.tgz", + "_shasum": "1980430c2e64ee86df6dd35794e1a301b2ab74de", "_shrinkwrap": null, - "_spec": "lodash._baseuniq@latest", - "_where": "/Users/rebecca/code/npm", + "_spec": "lodash._baseuniq@4.5.1", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -54,7 +54,7 @@ "url": "http://allyoucanleet.com/" }, { - "email": "blaine@iceddev.com", + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", "url": "https://github.com/phated" }, @@ -65,15 +65,15 @@ } ], "dependencies": { - "lodash._createset": "^4.0.0", - "lodash._setcache": "^4.0.0" + "lodash._createset": "~4.0.0", + "lodash._setcache": "~4.1.0" }, "description": "The internal lodash function `baseUniq` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "50e82673ae56f5fd07160584864648b7e3c528e8", - "tarball": "http://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.5.0.tgz" + "shasum": "1980430c2e64ee86df6dd35794e1a301b2ab74de", + "tarball": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.5.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -102,5 +102,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.5.0" + "version": "4.5.1" } diff --git a/deps/npm/node_modules/lodash.clonedeep/README.md b/deps/npm/node_modules/lodash.clonedeep/README.md index 4112f245f08689..1287ee1c00732a 100644 --- a/deps/npm/node_modules/lodash.clonedeep/README.md +++ b/deps/npm/node_modules/lodash.clonedeep/README.md @@ -1,4 +1,4 @@ -# lodash.clonedeep v4.3.1 +# lodash.clonedeep v4.3.2 The [lodash](https://lodash.com/) method `_.cloneDeep` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var cloneDeep = require('lodash.clonedeep'); ``` -See the [documentation](https://lodash.com/docs#cloneDeep) or [package source](https://github.com/lodash/lodash/blob/4.3.1-npm-packages/lodash.clonedeep) for more details. +See the [documentation](https://lodash.com/docs#cloneDeep) or [package source](https://github.com/lodash/lodash/blob/4.3.2-npm-packages/lodash.clonedeep) for more details. diff --git a/deps/npm/node_modules/lodash.clonedeep/index.js b/deps/npm/node_modules/lodash.clonedeep/index.js index cc9d2b08094f98..88794c2c4a3bfe 100644 --- a/deps/npm/node_modules/lodash.clonedeep/index.js +++ b/deps/npm/node_modules/lodash.clonedeep/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.3.1 (Custom Build) + * lodash 4.3.2 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/deps/npm/node_modules/lodash.clonedeep/package.json b/deps/npm/node_modules/lodash.clonedeep/package.json index 008d0943e10d5c..9da20a9494d7fc 100644 --- a/deps/npm/node_modules/lodash.clonedeep/package.json +++ b/deps/npm/node_modules/lodash.clonedeep/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash.clonedeep@~4.3.0", - "/Users/rebecca/code/npm" + "lodash.clonedeep@4.3.2", + "/Users/zkat/Documents/code/npm" ] ], - "_from": "lodash.clonedeep@>=4.3.0 <4.4.0", - "_id": "lodash.clonedeep@4.3.1", + "_from": "lodash.clonedeep@4.3.2", + "_id": "lodash.clonedeep@4.3.2", "_inCache": true, "_installable": true, "_location": "/lodash.clonedeep", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash.clonedeep-4.3.1.tgz_1456902680114_0.3442365804221481" + "tmp": "tmp/lodash.clonedeep-4.3.2.tgz_1459310662712_0.4621682942379266" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.17", + "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "name": "lodash.clonedeep", - "raw": "lodash.clonedeep@~4.3.0", - "rawSpec": "~4.3.0", + "raw": "lodash.clonedeep@4.3.2", + "rawSpec": "4.3.2", "scope": null, - "spec": ">=4.3.0 <4.4.0", - "type": "range" + "spec": "4.3.2", + "type": "version" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.3.1.tgz", - "_shasum": "94bd4e5267be2f72f567aa0b7b650c5044e24e71", + "_resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.3.2.tgz", + "_shasum": "d0112c02c76b5223833aebc6a4b6e334f0d057de", "_shrinkwrap": null, - "_spec": "lodash.clonedeep@~4.3.0", - "_where": "/Users/rebecca/code/npm", + "_spec": "lodash.clonedeep@4.3.2", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -63,14 +63,14 @@ } ], "dependencies": { - "lodash._baseclone": "^4.0.0" + "lodash._baseclone": "~4.5.0" }, "description": "The lodash method `_.cloneDeep` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "94bd4e5267be2f72f567aa0b7b650c5044e24e71", - "tarball": "http://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.3.1.tgz" + "shasum": "d0112c02c76b5223833aebc6a4b6e334f0d057de", + "tarball": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.3.2.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -103,5 +103,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.3.1" + "version": "4.3.2" } diff --git a/deps/npm/node_modules/lodash.union/README.md b/deps/npm/node_modules/lodash.union/README.md index e23dd0771f85a3..51b5100b9a6352 100644 --- a/deps/npm/node_modules/lodash.union/README.md +++ b/deps/npm/node_modules/lodash.union/README.md @@ -1,4 +1,4 @@ -# lodash.union v4.2.0 +# lodash.union v4.2.1 The [lodash](https://lodash.com/) method `_.union` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var union = require('lodash.union'); ``` -See the [documentation](https://lodash.com/docs#union) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.union) for more details. +See the [documentation](https://lodash.com/docs#union) or [package source](https://github.com/lodash/lodash/blob/4.2.1-npm-packages/lodash.union) for more details. diff --git a/deps/npm/node_modules/lodash.union/index.js b/deps/npm/node_modules/lodash.union/index.js index 36cc1e6bcde506..158c0d75c04d41 100644 --- a/deps/npm/node_modules/lodash.union/index.js +++ b/deps/npm/node_modules/lodash.union/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.2.0 (Custom Build) + * lodash 4.2.1 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md index c9d54a894abad8..4250ad4af77c0e 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md @@ -1,4 +1,4 @@ -# lodash._baseflatten v4.1.0 +# lodash._baseflatten v4.1.1 The internal [lodash](https://lodash.com/) function `baseFlatten` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseFlatten = require('lodash._baseflatten'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash._baseflatten) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash._baseflatten) for more details. diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js index d684b47929272c..cf05fe5f1a59a6 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.1.1 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -179,8 +179,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); + return value != null && isLength(getLength(value)) && !isFunction(value); } /** @@ -228,8 +227,8 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json index c21e5e4ebb163a..8b2e4529bf0a75 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash._baseflatten@^4.0.0", - "/Users/rebecca/code/npm/node_modules/lodash.union" + "lodash._baseflatten@~4.1.0", + "/Users/zkat/Documents/code/npm/node_modules/lodash.union" ] ], - "_from": "lodash._baseflatten@>=4.0.0 <5.0.0", - "_id": "lodash._baseflatten@4.1.0", + "_from": "lodash._baseflatten@>=4.1.0 <4.2.0", + "_id": "lodash._baseflatten@4.1.1", "_inCache": true, "_installable": true, "_location": "/lodash.union/lodash._baseflatten", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-6-west.internal.npmjs.com", - "tmp": "tmp/lodash._baseflatten-4.1.0.tgz_1455615012034_0.06309569417499006" + "host": "packages-13-west.internal.npmjs.com", + "tmp": "tmp/lodash._baseflatten-4.1.1.tgz_1456896418067_0.31963246082887053" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.18", + "_npmVersion": "2.14.17", "_phantomChildren": {}, "_requested": { "name": "lodash._baseflatten", - "raw": "lodash._baseflatten@^4.0.0", - "rawSpec": "^4.0.0", + "raw": "lodash._baseflatten@~4.1.0", + "rawSpec": "~4.1.0", "scope": null, - "spec": ">=4.0.0 <5.0.0", + "spec": ">=4.1.0 <4.2.0", "type": "range" }, "_requiredBy": [ "/lodash.union" ], - "_resolved": "https://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.1.0.tgz", - "_shasum": "8548ac47576a8dd5f2702cb1ebeae4a980ac3bae", + "_resolved": "https://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.1.1.tgz", + "_shasum": "5c87403b88f3687a88d26424faadf3aa054aab0d", "_shrinkwrap": null, - "_spec": "lodash._baseflatten@^4.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/lodash.union", + "_spec": "lodash._baseflatten@~4.1.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/lodash.union", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -52,7 +52,7 @@ "url": "http://allyoucanleet.com/" }, { - "email": "blaine@iceddev.com", + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", "url": "https://github.com/phated" }, @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "8548ac47576a8dd5f2702cb1ebeae4a980ac3bae", - "tarball": "http://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.1.0.tgz" + "shasum": "5c87403b88f3687a88d26424faadf3aa054aab0d", + "tarball": "http://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.1.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -97,5 +97,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.1.0" + "version": "4.1.1" } diff --git a/deps/npm/node_modules/lodash.union/package.json b/deps/npm/node_modules/lodash.union/package.json index 2a05b98497740c..d00522437f94d2 100644 --- a/deps/npm/node_modules/lodash.union/package.json +++ b/deps/npm/node_modules/lodash.union/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash.union@latest", - "/Users/rebecca/code/npm" + "lodash.union@4.2.1", + "/Users/zkat/Documents/code/npm" ] ], - "_from": "lodash.union@latest", - "_id": "lodash.union@4.2.0", + "_from": "lodash.union@4.2.1", + "_id": "lodash.union@4.2.1", "_inCache": true, "_installable": true, "_location": "/lodash.union", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-9-west.internal.npmjs.com", - "tmp": "tmp/lodash.union-4.2.0.tgz_1455615727631_0.14597112801857293" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/lodash.union-4.2.1.tgz_1459310986493_0.07747984793968499" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.18", + "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "name": "lodash.union", - "raw": "lodash.union@latest", - "rawSpec": "latest", + "raw": "lodash.union@4.2.1", + "rawSpec": "4.2.1", "scope": null, - "spec": "latest", - "type": "tag" + "spec": "4.2.1", + "type": "version" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.2.0.tgz", - "_shasum": "490c86803d2ed7ca01e26fe53e7d6519e2506505", + "_resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.2.1.tgz", + "_shasum": "6871017b9b1ff71952c1e2bb2e25b1046a7e2842", "_shrinkwrap": null, - "_spec": "lodash.union@latest", - "_where": "/Users/rebecca/code/npm", + "_spec": "lodash.union@4.2.1", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -52,7 +52,7 @@ "url": "http://allyoucanleet.com/" }, { - "email": "blaine@iceddev.com", + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", "url": "https://github.com/phated" }, @@ -63,16 +63,16 @@ } ], "dependencies": { - "lodash._baseflatten": "^4.0.0", - "lodash._baseuniq": "^4.0.0", + "lodash._baseflatten": "~4.1.0", + "lodash._baseuniq": "~4.5.0", "lodash.rest": "^4.0.0" }, "description": "The lodash method `_.union` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "490c86803d2ed7ca01e26fe53e7d6519e2506505", - "tarball": "http://registry.npmjs.org/lodash.union/-/lodash.union-4.2.0.tgz" + "shasum": "6871017b9b1ff71952c1e2bb2e25b1046a7e2842", + "tarball": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.2.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -105,5 +105,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.2.0" + "version": "4.2.1" } diff --git a/deps/npm/node_modules/lodash.uniq/README.md b/deps/npm/node_modules/lodash.uniq/README.md index 3204e5847cde13..31e7c591ea3cb9 100644 --- a/deps/npm/node_modules/lodash.uniq/README.md +++ b/deps/npm/node_modules/lodash.uniq/README.md @@ -1,4 +1,4 @@ -# lodash.uniq v4.2.0 +# lodash.uniq v4.2.1 The [lodash](https://lodash.com/) method `_.uniq` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var uniq = require('lodash.uniq'); ``` -See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.uniq) for more details. +See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/4.2.1-npm-packages/lodash.uniq) for more details. diff --git a/deps/npm/node_modules/lodash.uniq/index.js b/deps/npm/node_modules/lodash.uniq/index.js index 6c7bde11096293..567c6ece6a4d25 100644 --- a/deps/npm/node_modules/lodash.uniq/index.js +++ b/deps/npm/node_modules/lodash.uniq/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.2.0 (Custom Build) + * lodash 4.2.1 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/deps/npm/node_modules/lodash.uniq/package.json b/deps/npm/node_modules/lodash.uniq/package.json index d14db6ba90bc3d..2823bb8d2c9e17 100644 --- a/deps/npm/node_modules/lodash.uniq/package.json +++ b/deps/npm/node_modules/lodash.uniq/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash.uniq@~4.2.0", - "/Users/rebecca/code/npm" + "lodash.uniq@4.2.1", + "/Users/zkat/Documents/code/npm" ] ], - "_from": "lodash.uniq@>=4.2.0 <4.3.0", - "_id": "lodash.uniq@4.2.0", + "_from": "lodash.uniq@4.2.1", + "_id": "lodash.uniq@4.2.1", "_inCache": true, "_installable": true, "_location": "/lodash.uniq", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-5-east.internal.npmjs.com", - "tmp": "tmp/lodash.uniq-4.2.0.tgz_1455615740326_0.14619768620468676" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/lodash.uniq-4.2.1.tgz_1459310991318_0.029993396950885653" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.18", + "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "name": "lodash.uniq", - "raw": "lodash.uniq@~4.2.0", - "rawSpec": "~4.2.0", + "raw": "lodash.uniq@4.2.1", + "rawSpec": "4.2.1", "scope": null, - "spec": ">=4.2.0 <4.3.0", - "type": "range" + "spec": "4.2.1", + "type": "version" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.2.0.tgz", - "_shasum": "e0cb2ac57e11b6a0d0c87674f6ff4a1986f78739", + "_resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.2.1.tgz", + "_shasum": "4210d4b90647ee24211b469aed0ef84902069743", "_shrinkwrap": null, - "_spec": "lodash.uniq@~4.2.0", - "_where": "/Users/rebecca/code/npm", + "_spec": "lodash.uniq@4.2.1", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -52,7 +52,7 @@ "url": "http://allyoucanleet.com/" }, { - "email": "blaine@iceddev.com", + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", "url": "https://github.com/phated" }, @@ -63,14 +63,14 @@ } ], "dependencies": { - "lodash._baseuniq": "^4.0.0" + "lodash._baseuniq": "~4.5.0" }, "description": "The lodash method `_.uniq` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "e0cb2ac57e11b6a0d0c87674f6ff4a1986f78739", - "tarball": "http://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.2.0.tgz" + "shasum": "4210d4b90647ee24211b469aed0ef84902069743", + "tarball": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.2.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -103,5 +103,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.2.0" + "version": "4.2.1" } diff --git a/deps/npm/node_modules/lodash.without/README.md b/deps/npm/node_modules/lodash.without/README.md index 3c2e6b98c99a66..3299e4c531993b 100644 --- a/deps/npm/node_modules/lodash.without/README.md +++ b/deps/npm/node_modules/lodash.without/README.md @@ -1,4 +1,4 @@ -# lodash.without v4.1.1 +# lodash.without v4.1.2 The [lodash](https://lodash.com/) method `_.without` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var without = require('lodash.without'); ``` -See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.without) for more details. +See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.without) for more details. diff --git a/deps/npm/node_modules/lodash.without/index.js b/deps/npm/node_modules/lodash.without/index.js index 049466d2aaea9a..f9ed54a01cebf9 100644 --- a/deps/npm/node_modules/lodash.without/index.js +++ b/deps/npm/node_modules/lodash.without/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.1.2 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md index 0f5e0fad20fd0a..0ff2f166076c3b 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md @@ -1,4 +1,4 @@ -# lodash._basedifference v4.4.0 +# lodash._basedifference v4.4.1 The internal [lodash](https://lodash.com/) function `baseDifference` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseDifference = require('lodash._basedifference'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.4.0-npm-packages/lodash._basedifference) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash._basedifference) for more details. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js index 783488521bddd2..5fa779dfdd4391 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.4.0 (Custom Build) + * lodash 4.4.1 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -28,8 +28,7 @@ function arrayIncludes(array, value) { } /** - * A specialized version of `_.includesWith` for arrays without support for - * specifying an index to search from. + * This function is like `arrayIncludes` except that it accepts a comparator. * * @private * @param {Array} array The array to search. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json index 5aebde78cd1eda..5442d0abf9a3c4 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash._basedifference@^4.0.0", - "/Users/rebecca/code/npm/node_modules/lodash.without" + "lodash._basedifference@~4.4.0", + "/Users/zkat/Documents/code/npm/node_modules/lodash.without" ] ], - "_from": "lodash._basedifference@>=4.0.0 <5.0.0", - "_id": "lodash._basedifference@4.4.0", + "_from": "lodash._basedifference@>=4.4.0 <4.5.0", + "_id": "lodash._basedifference@4.4.1", "_inCache": true, "_installable": true, "_location": "/lodash.without/lodash._basedifference", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-9-west.internal.npmjs.com", - "tmp": "tmp/lodash._basedifference-4.4.0.tgz_1455614999271_0.6685796829406172" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/lodash._basedifference-4.4.1.tgz_1459310599651_0.6456912821158767" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.18", + "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "name": "lodash._basedifference", - "raw": "lodash._basedifference@^4.0.0", - "rawSpec": "^4.0.0", + "raw": "lodash._basedifference@~4.4.0", + "rawSpec": "~4.4.0", "scope": null, - "spec": ">=4.0.0 <5.0.0", + "spec": ">=4.4.0 <4.5.0", "type": "range" }, "_requiredBy": [ "/lodash.without" ], - "_resolved": "https://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.4.0.tgz", - "_shasum": "b0c364ecd319c7669092dc1f84c466f798642be3", + "_resolved": "https://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.4.1.tgz", + "_shasum": "537bde6fd0f3eeec28e37288dd51459765181b4d", "_shrinkwrap": null, - "_spec": "lodash._basedifference@^4.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/lodash.without", + "_spec": "lodash._basedifference@~4.4.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/lodash.without", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -52,7 +52,7 @@ "url": "http://allyoucanleet.com/" }, { - "email": "blaine@iceddev.com", + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", "url": "https://github.com/phated" }, @@ -63,14 +63,14 @@ } ], "dependencies": { - "lodash._setcache": "^4.0.0" + "lodash._setcache": "~4.1.0" }, "description": "The internal lodash function `baseDifference` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "b0c364ecd319c7669092dc1f84c466f798642be3", - "tarball": "http://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.4.0.tgz" + "shasum": "537bde6fd0f3eeec28e37288dd51459765181b4d", + "tarball": "https://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.4.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -99,5 +99,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.4.0" + "version": "4.4.1" } diff --git a/deps/npm/node_modules/lodash.without/package.json b/deps/npm/node_modules/lodash.without/package.json index 5077fe66a63789..ac1b49c2745fba 100644 --- a/deps/npm/node_modules/lodash.without/package.json +++ b/deps/npm/node_modules/lodash.without/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash.without@~4.1.0", - "/Users/rebecca/code/npm" + "lodash.without@4.1.2", + "/Users/zkat/Documents/code/npm" ] ], - "_from": "lodash.without@>=4.1.0 <4.2.0", - "_id": "lodash.without@4.1.1", + "_from": "lodash.without@4.1.2", + "_id": "lodash.without@4.1.2", "_inCache": true, "_installable": true, "_location": "/lodash.without", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash.without-4.1.1.tgz_1456896882082_0.03977343044243753" + "tmp": "tmp/lodash.without-4.1.2.tgz_1459311008459_0.16177126462571323" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.17", + "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "name": "lodash.without", - "raw": "lodash.without@~4.1.0", - "rawSpec": "~4.1.0", + "raw": "lodash.without@4.1.2", + "rawSpec": "4.1.2", "scope": null, - "spec": ">=4.1.0 <4.2.0", - "type": "range" + "spec": "4.1.2", + "type": "version" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.1.1.tgz", - "_shasum": "00ba28bb140083195c73a156da9668afe8ce1dbe", + "_resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.1.2.tgz", + "_shasum": "c68b1981e1b001bd87eef7487dba0af267846229", "_shrinkwrap": null, - "_spec": "lodash.without@~4.1.0", - "_where": "/Users/rebecca/code/npm", + "_spec": "lodash.without@4.1.2", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -63,15 +63,15 @@ } ], "dependencies": { - "lodash._basedifference": "^4.0.0", + "lodash._basedifference": "~4.4.0", "lodash.rest": "^4.0.0" }, "description": "The lodash method `_.without` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "00ba28bb140083195c73a156da9668afe8ce1dbe", - "tarball": "http://registry.npmjs.org/lodash.without/-/lodash.without-4.1.1.tgz" + "shasum": "c68b1981e1b001bd87eef7487dba0af267846229", + "tarball": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.1.2.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -104,5 +104,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.1.1" + "version": "4.1.2" } diff --git a/deps/npm/node_modules/npm-registry-client/test/fixtures/@npm/npm-registry-client/cache.json b/deps/npm/node_modules/npm-registry-client/test/fixtures/@npm/npm-registry-client/cache.json deleted file mode 100644 index 4561db502b18e5..00000000000000 --- a/deps/npm/node_modules/npm-registry-client/test/fixtures/@npm/npm-registry-client/cache.json +++ /dev/null @@ -1 +0,0 @@ -{"_id":"@npm%2fnpm-registry-client","_rev":"213-0a1049cf56172b7d9a1184742c6477b9","name":"@npm/npm-registry-client","description":"Client for the npm registry","dist-tags":{"latest":"2.0.4","v2.0":"2.0.3"},"versions":{"0.0.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"engines":{"node":"*"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"_id":"@npm%2fnpm-registry-client@0.0.1","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.7.10-pre","_defaultsLoaded":true,"dist":{"shasum":"693a08f6d2faea22bbd2bf412508a63d3e6229a7","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.1.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.2":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.2","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"engines":{"node":"*"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"_id":"@npm%2fnpm-registry-client@0.0.2","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.7.10-pre","_defaultsLoaded":true,"dist":{"shasum":"b48c0ec5563c6a6fdc253454fc56d2c60c5a26f4","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.2.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.3":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.3","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"engines":{"node":"*"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"_id":"@npm%2fnpm-registry-client@0.0.3","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.7.10-pre","_defaultsLoaded":true,"dist":{"shasum":"ccc0254c2d59e3ea9b9050e2b16edef78df1a1e8","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.3.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.4":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.4","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"engines":{"node":"*"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"_id":"@npm%2fnpm-registry-client@0.0.4","_engineSupported":true,"_npmVersion":"1.1.25","_nodeVersion":"v0.7.10-pre","_defaultsLoaded":true,"dist":{"shasum":"faabd25ef477521c74ac21e0f4cf3a2f66d18fb3","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.4.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.5":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.5","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"engines":{"node":"*"},"_id":"@npm%2fnpm-registry-client@0.0.5","dist":{"shasum":"85219810c9d89ae8d28ea766e7cf74efbd9f1e52","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.5.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.6":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"The code that npm uses to talk to the registry","version":"0.0.6","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"engines":{"node":"*"},"_id":"@npm%2fnpm-registry-client@0.0.6","dist":{"shasum":"cc6533b3b41df65e6e9db2601fbbf1a509a7e94c","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.6.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.7":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"The code that npm uses to talk to the registry","version":"0.0.7","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"engines":{"node":"*"},"_id":"@npm%2fnpm-registry-client@0.0.7","dist":{"shasum":"0cee1d1c61f1c8e483774fe1f7bbb81c4f394a3a","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.7.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.8":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.8","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.0.8","dist":{"shasum":"1b7411c3f7310ec2a96b055b00e7ca606e47bd07","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.8.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.9":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.9","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.0.9","dist":{"shasum":"6d5bfde431559ac9e2e52a7db85f5839b874f022","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.9.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.10":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.10","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.0.10","dist":{"shasum":"0c8b6a4615bce82aa6cc04a0d1f7dc89921f7a38","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.10.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.0.11":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.0.11","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.0.11","dist":{"shasum":"afab40be5bed1faa946d8e1827844698f2ec1db7","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.0.11.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.1.0":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.1.0","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.1.0","dist":{"shasum":"1077d6bbb5e432450239dc6622a59474953ffbea","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.1.0.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.1.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.1.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.1.1","dist":{"shasum":"759765361d09b715270f59cf50f10908e4e9c5fc","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.1.1.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.1.2":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.1.2","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.1.2","dist":{"shasum":"541ce93abb3d35f5c325545c718dd3bbeaaa9ff0","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.1.2.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.1.3":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.1.3","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.1.3","dist":{"shasum":"e9a40d7031e8f809af5fd85aa9aac979e17efc97","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.1.3.tgz"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.1.4":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.1.4","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.1.4","dist":{"shasum":"b211485b046191a1085362376530316f0cab0420","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.1.4.tgz"},"_npmVersion":"1.1.48","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.0":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.0","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.0","dist":{"shasum":"6508a4b4d96f31057d5200ca5779531bafd2b840","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.0.tgz"},"_npmVersion":"1.1.49","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"node-uuid":"~1.3.3","request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.1","dist":{"shasum":"1bc8c4576c368cd88253d8a52daf40c55b89bb1a","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.1.tgz"},"_npmVersion":"1.1.49","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.5":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.5","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.5","dist":{"shasum":"2f55d675dfb977403b1ad0d96874c1d30e8058d7","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.5.tgz"},"_npmVersion":"1.1.51","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.6":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.6","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.6","dist":{"shasum":"f05df6695360360ad220e6e13a6a7bace7165fbe","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.6.tgz"},"_npmVersion":"1.1.56","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.7":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.7","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.0.14","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.7","dist":{"shasum":"867bad8854cae82ed89ee3b7f1d391af59491671","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.7.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.8":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.8","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.6","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.8","dist":{"shasum":"ef194cdb70f1ea03a576cff2c97392fa96e36563","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.8.tgz"},"_npmVersion":"1.1.62","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.9":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.9","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.9","dist":{"shasum":"3cec10431dfed1594adaf99c50f482ee56ecf9e4","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.9.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.10":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.10","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2.0.1","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.10","dist":{"shasum":"1e69726dae0944e78562fd77243f839c6a2ced1e","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.10.tgz"},"_npmVersion":"1.1.64","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.11":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.11","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.11","dist":{"shasum":"d92f33c297eb1bbd57fd597c3d8f5f7e9340a0b5","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.11.tgz"},"_npmVersion":"1.1.70","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.12":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.12","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.1.8","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.12","dist":{"shasum":"3bfb6fc0e4b131d665580cd1481c341fe521bfd3","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.12.tgz"},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.13":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.13","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.13","dist":{"shasum":"e03f2a4340065511b7184a3e2862cd5d459ef027","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.13.tgz"},"_from":".","_npmVersion":"1.2.4","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.14":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.14","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.14","dist":{"shasum":"186874a7790417a340d582b1cd4a7c338087ee12","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.14.tgz"},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.15":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.15","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.15","dist":{"shasum":"f71f32b7185855f1f8b7a5ef49e49d2357c2c552","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.15.tgz"},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.16":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.16","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.16","dist":{"shasum":"3331323b5050fc5afdf77c3a35913c16f3e43964","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.16.tgz"},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.17":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.17","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.17","dist":{"shasum":"1df2bbecac6751f5d9600fb43722aef96d956773","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.17.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.18":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.18","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.9.202","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.18","dist":{"shasum":"198c8d15ed9b1ed546faf6e431eb63a6b18193ad","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.18.tgz"},"_from":".","_npmVersion":"1.2.13","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.19":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.19","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.16","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.19","dist":{"shasum":"106da826f0d2007f6e081f2b68fb6f26fa951b20","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.19.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.20":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.20","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.16","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","_id":"@npm%2fnpm-registry-client@0.2.20","dist":{"shasum":"3fff194331e26660be2cf8ebf45ddf7d36add5f6","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.20.tgz"},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.21":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.21","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.16","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.21","dist":{"shasum":"d85dd32525f193925c46ff9eb0e0f529dfd1b254","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.21.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.22":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.22","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"~2.20.0","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.22","dist":{"shasum":"caa22ff40a1ccd632a660b8b80c333c8f92d5a17","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.22.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.23":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.23","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.20.0","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.23","dist":{"shasum":"a320ab2b1d048b4f7b88e40bd86974ca322b4c24","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.23.tgz"},"_from":".","_npmVersion":"1.2.19","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.24":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.24","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.20.0","graceful-fs":"~1.2.0","semver":"~1.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.24","dist":{"shasum":"e12f644338619319ee7f233363a1714a87f3c72d","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.24.tgz"},"_from":".","_npmVersion":"1.2.22","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.25":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.25","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.20.0","graceful-fs":"~1.2.0","semver":"~2.0.5","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.25","dist":{"shasum":"c2caeb1dcf937d6fcc4a187765d401f5e2f54027","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.25.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.26":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.26","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.20.0","graceful-fs":"~1.2.0","semver":"~2.0.5","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.26","dist":{"shasum":"4c5a2b3de946e383032f10fa497d0c15ee5f4c60","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.26.tgz"},"_from":".","_npmVersion":"1.3.1","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.27":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.27","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.20.0","graceful-fs":"~2.0.0","semver":"~2.0.5","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.15","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.27","dist":{"shasum":"8f338189d32769267886a07ad7b7fd2267446adf","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.27.tgz"},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.28":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.28","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"~2.1.0","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"_id":"@npm%2fnpm-registry-client@0.2.28","dist":{"shasum":"959141fc0180d7b1ad089e87015a8a2142a8bffc","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.28.tgz"},"_from":".","_npmVersion":"1.3.6","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.29":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.29","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.2.29","dist":{"shasum":"66ff2766f0c61d41e8a6139d3692d8833002c686","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.29.tgz"},"_from":".","_npmVersion":"1.3.12","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.30":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.30","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.2.30","dist":{"shasum":"f01cae5c51aa0a1c5dc2516cbad3ebde068d3eaa","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.30.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.2.31":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.2.31","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.2.31","dist":{"shasum":"24a23e24e43246677cb485f8391829e9536563d4","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.2.31.tgz"},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.3.0":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.3.0","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.3.0","dist":{"shasum":"66eab02a69be67f232ac14023eddfb8308c2eccd","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.3.0.tgz"},"_from":".","_npmVersion":"1.3.18","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.3.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.3.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.3.1","dist":{"shasum":"16dba07cc304442edcece378218672d0a1258ef8","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.3.1.tgz"},"_from":".","_npmVersion":"1.3.18","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.3.2":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.3.2","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.3.2","dist":{"shasum":"ea3060bd0a87fb1d97b87433b50f38f7272b1686","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.3.2.tgz"},"_from":".","_npmVersion":"1.3.20","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.3.3":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.3.3","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.3.3","dist":{"shasum":"da08bb681fb24aa5c988ca71f8c10f27f09daf4a","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.3.3.tgz"},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.3.4":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.3.4","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.3.4","dist":{"shasum":"25d771771590b1ca39277aea4506af234c5f4342","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.3.4.tgz"},"_from":".","_npmVersion":"1.3.25","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.3.5":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.3.5","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","couch-login":"~0.1.18","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.3.5","dist":{"shasum":"98ba1ac851a3939a3fb9917c28fa8da522dc635f","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.3.5.tgz"},"_from":".","_npmVersion":"1.3.25","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.3.6":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.3.6","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.3.6","dist":{"shasum":"c48a2a03643769acc49672860f7920ec6bffac6e","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.3.6.tgz"},"_from":".","_npmVersion":"1.3.26","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.0":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.0","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.0","dist":{"shasum":"30d0c178b7f2e54183a6a3fc9fe4071eb10290bf","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.0.tgz"},"_from":".","_npmVersion":"1.3.26","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.1","dist":{"shasum":"9c49b3e44558e2072158fb085be8a083c5f83537","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.1.tgz"},"_from":".","_npmVersion":"1.4.0","_npmUser":{"name":"npm-www","email":"npm@npmjs.com"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.2":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.2","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.2","dist":{"shasum":"d9568a9413bee14951201ce73f3b3992ec6658c0","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.2.tgz"},"_from":".","_npmVersion":"1.4.1","_npmUser":{"name":"npm-www","email":"npm@npmjs.com"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.3":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.3","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.3","dist":{"shasum":"aa188fc5067158e991a57f4697c54994108f5389","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.3.tgz"},"_from":".","_npmVersion":"1.4.2","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.4":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.4","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.4","dist":{"shasum":"f9dbc383a49069d8c7f67755a3ff6e424aff584f","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.4.tgz"},"_from":".","_npmVersion":"1.4.2","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.5":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.5","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.5","dist":{"shasum":"7d6fdca46139470715f9477ddb5ad3e770d4de7b","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.5.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.6":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.6","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.6","_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"657f69a79543fc4cc264c3b2de958bd15f7140fe","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.6.tgz"},"directories":{}},"0.4.7":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.7","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.7","dist":{"shasum":"f4369b59890da7882527eb7c427dd95d43707afb","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.7.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"directories":{}},"0.4.8":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.8","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.8","_shasum":"a6685a161033101be6064b7af887ab440e8695d0","_from":".","_npmVersion":"1.4.8","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"a6685a161033101be6064b7af887ab440e8695d0","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.8.tgz"},"directories":{}},"0.4.9":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.9","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.9","_shasum":"304d3d4726a58e33d8cc965afdc9ed70b996580c","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"304d3d4726a58e33d8cc965afdc9ed70b996580c","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.9.tgz"},"directories":{}},"0.4.10":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.10","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"^2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.10","_shasum":"ab7bf1be3ba07d769eaf74dee3c9347e02283116","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"ab7bf1be3ba07d769eaf74dee3c9347e02283116","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.10.tgz"},"directories":{}},"0.4.11":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.11","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"2 >=2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.11","_shasum":"032e9b6b050ed052ee9441841a945a184ea6bc33","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"032e9b6b050ed052ee9441841a945a184ea6bc33","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.11.tgz"},"directories":{}},"0.4.12":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"0.4.12","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"request":"2 >=2.25.0","graceful-fs":"~2.0.0","semver":"2 >=2.2.1","slide":"~1.1.3","chownr":"0","mkdirp":"~0.3.3","rimraf":"~2","retry":"0.6.0","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@0.4.12","_shasum":"34303422f6a3da93ca3a387a2650d707c8595b99","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"34303422f6a3da93ca3a387a2650d707c8595b99","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-0.4.12.tgz"},"directories":{}},"1.0.0":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"1.0.0","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"~2.0.0","mkdirp":"~0.3.3","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@1.0.0","_shasum":"2a6f9dfdce5f8ebf4b9af4dbfd738384d25014e5","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"2a6f9dfdce5f8ebf4b9af4dbfd738384d25014e5","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-1.0.0.tgz"},"directories":{}},"1.0.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"1.0.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"~2.0.0","mkdirp":"~0.3.3","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"98b1278c230cf6c159f189e2f8c69daffa727ab8","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@1.0.1","_shasum":"c5f6a87d285f2005a35d3f67d9c724bce551b0f1","_from":".","_npmVersion":"1.4.13","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"c5f6a87d285f2005a35d3f67d9c724bce551b0f1","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-1.0.1.tgz"},"directories":{}},"2.0.0":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"2.0.0","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"~2.0.0","mkdirp":"~0.3.3","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"47a98069b6a34e751cbd5b84ce92858cae5abe70","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@2.0.0","_shasum":"88810dac2d534c0df1d905c79e723392fcfc791a","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"dist":{"shasum":"88810dac2d534c0df1d905c79e723392fcfc791a","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-2.0.0.tgz"},"directories":{}},"2.0.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"2.0.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.3.3","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"123e40131f83f7265f66ecd2a558cce44a3aea86","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@2.0.1","_shasum":"611c7cb7c8f7ff22be2ebc6398423b5de10db0e2","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"611c7cb7c8f7ff22be2ebc6398423b5de10db0e2","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-2.0.1.tgz"},"directories":{}},"2.0.2":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"2.0.2","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.3.3","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"6ecc311c9dd4890f2d9b6bae60447070a3321e12","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@2.0.2","_shasum":"a82b000354c7f830114fb18444764bc477d5740f","_from":".","_npmVersion":"1.4.15","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"a82b000354c7f830114fb18444764bc477d5740f","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-2.0.2.tgz"},"directories":{}},"3.0.0":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"3.0.0","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.3.3","normalize-package-data":"^0.4.0","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"6bb1aec1e85fa82ee075bd997d6fb9f2dbb7f643","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@3.0.0","_shasum":"4febc5cdb274e9fa06bc3008910e3fa1ec007994","_from":".","_npmVersion":"1.5.0-pre","_npmUser":{"name":"othiym23","email":"ogd@aoaioxxysz.net"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"4febc5cdb274e9fa06bc3008910e3fa1ec007994","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-3.0.0.tgz"},"directories":{}},"3.0.1":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"3.0.1","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.3.3","normalize-package-data":"^0.4.0","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"fe8382dde609ea1e3580fcdc5bc3d0bba119cfc6","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@3.0.1","_shasum":"5f3ee362ce5c237cfb798fce22c77875fc1a63c2","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"othiym23","email":"ogd@aoaioxxysz.net"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"5f3ee362ce5c237cfb798fce22c77875fc1a63c2","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-3.0.1.tgz"},"directories":{}},"2.0.3":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"2.0.3","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.3.3","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"2578fb9a807d77417554ba235ba8fac39405e832","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@2.0.3","_shasum":"93dad3d9a162c99404badb71739c622c0f3b9a72","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"othiym23","email":"ogd@aoaioxxysz.net"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"93dad3d9a162c99404badb71739c622c0f3b9a72","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-2.0.3.tgz"},"directories":{}},"3.0.2":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"3.0.2","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.3.3","normalize-package-data":"^0.4.0","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"15343019160ace0b9874cf0ec186b3425dbc7301","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@3.0.2","_shasum":"5dd0910157ce55f4286a1871d39f9a2128cd3c99","_from":".","_npmVersion":"1.5.0-alpha-2","_npmUser":{"name":"othiym23","email":"ogd@aoaioxxysz.net"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"5dd0910157ce55f4286a1871d39f9a2128cd3c99","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-3.0.2.tgz"},"directories":{}},"3.0.3":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"3.0.3","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.3.3","normalize-package-data":"^0.4.0","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1 || 3.x","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"b18a780d1185f27c06c27812147b83aba0d4a2f5","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@3.0.3","_shasum":"2377dc1cf69b4d374b3a95fb7feba8c804d8cb30","_from":".","_npmVersion":"2.0.0-alpha-5","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"2377dc1cf69b4d374b3a95fb7feba8c804d8cb30","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-3.0.3.tgz"},"directories":{}},"3.0.4":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"3.0.4","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"~0.5.0","normalize-package-data":"^0.4.0","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1 || 3.x","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"54900fe4b2eb5b99ee6dfe173f145732fdfae80e","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@3.0.4","_shasum":"d4a177d1f25615cfaef9b6844fa366ffbf5f578a","_from":".","_npmVersion":"2.0.0-alpha-5","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"d4a177d1f25615cfaef9b6844fa366ffbf5f578a","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-3.0.4.tgz"},"directories":{}},"3.0.5":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"3.0.5","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"0.5","normalize-package-data":"0.4","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"2","semver":"2 >=2.2.1 || 3.x","slide":"^1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"BSD","gitHead":"635db1654346bc86473df7b39626601425f46177","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@3.0.5","_shasum":"cdabaefa399b81ac8a86a48718aefd80e7b19ff3","_from":".","_npmVersion":"2.0.0-alpha-5","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"cdabaefa399b81ac8a86a48718aefd80e7b19ff3","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-3.0.5.tgz"},"directories":{}},"3.0.6":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"3.0.6","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"^0.5.0","normalize-package-data":"0.4","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"2","semver":"2 >=2.2.1 || 3.x","slide":"^1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"ISC","gitHead":"eba30fadd724ed5cad1aec95ac3ee907a59b7317","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@3.0.6","_shasum":"14a17d9a60ed2a80b04edcbc596dbce0d96540ee","_from":".","_npmVersion":"1.4.22","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"14a17d9a60ed2a80b04edcbc596dbce0d96540ee","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-3.0.6.tgz"},"directories":{}},"2.0.4":{"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"name":"@npm/npm-registry-client","description":"Client for the npm registry","version":"2.0.4","repository":{"url":"git://github.com/isaacs/npm-registry-client"},"main":"index.js","scripts":{"test":"tap test/*.js"},"dependencies":{"chownr":"0","graceful-fs":"^3.0.0","mkdirp":"^0.5.0","npm-cache-filename":"^1.0.0","request":"2 >=2.25.0","retry":"0.6.0","rimraf":"~2","semver":"2 >=2.2.1","slide":"~1.1.3","npmlog":""},"devDependencies":{"tap":""},"optionalDependencies":{"npmlog":""},"license":"ISC","gitHead":"a10f621d9cdc813b9d3092a14b661f65bfa6d40d","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"homepage":"https://github.com/isaacs/npm-registry-client","_id":"@npm%2fnpm-registry-client@2.0.4","_shasum":"528e08900d7655c12096d1637d1c3a7a5b451019","_from":".","_npmVersion":"1.4.22","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"dist":{"shasum":"528e08900d7655c12096d1637d1c3a7a5b451019","tarball":"http://registry.npmjs.org/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-2.0.4.tgz"},"directories":{}}},"readme":"# npm-registry-client\u000a\u000aThe code that npm uses to talk to the registry.\u000a\u000aIt handles all the caching and HTTP calls.\u000a\u000a## Usage\u000a\u000a```javascript\u000avar RegClient = require('npm-registry-client')\u000avar client = new RegClient(config)\u000avar uri = \"npm://registry.npmjs.org/npm\"\u000avar options = {timeout: 1000}\u000a\u000aclient.get(uri, options, function (error, data, raw, res) {\u000a // error is an error if there was a problem.\u000a // data is the parsed data object\u000a // raw is the json string\u000a // res is the response from couch\u000a})\u000a```\u000a\u000a# Registry URLs\u000a\u000aThe registry calls take either a full URL pointing to a resource in the\u000aregistry, or a base URL for the registry as a whole (for the base URL, any path\u000awill be ignored). In addition to `http` and `https`, `npm` URLs are allowed.\u000a`npm` URLs are `https` URLs with the additional restrictions that they will\u000aalways include authorization credentials, and the response is always registry\u000ametadata (and not tarballs or other attachments).\u000a\u000a# Configuration\u000a\u000aThis program is designed to work with\u000a[npmconf](https://npmjs.org/package/npmconf), but you can also pass in\u000aa plain-jane object with the appropriate configs, and it'll shim it\u000afor you. Any configuration thingie that has get/set/del methods will\u000aalso be accepted.\u000a\u000a* `cache` **Required** {String} Path to the cache folder\u000a* `always-auth` {Boolean} Auth even for GET requests.\u000a* `auth` {String} A base64-encoded `username:password`\u000a* `email` {String} User's email address\u000a* `tag` {String} The default tag to use when publishing new packages.\u000a Default = `\"latest\"`\u000a* `ca` {String} Cerficate signing authority certificates to trust.\u000a* `cert` {String} Client certificate (PEM encoded). Enable access\u000a to servers that require client certificates\u000a* `key` {String} Private key (PEM encoded) for client certificate 'cert'\u000a* `strict-ssl` {Boolean} Whether or not to be strict with SSL\u000a certificates. Default = `true`\u000a* `user-agent` {String} User agent header to send. Default =\u000a `\"node/{process.version} {process.platform} {process.arch}\"`\u000a* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\u000a that works, otherwise logs are disabled.\u000a* `fetch-retries` {Number} Number of times to retry on GET failures.\u000a Default=2\u000a* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10\u000a* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`.\u000a Default=10000 (10 seconds)\u000a* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`.\u000a Default=60000 (60 seconds)\u000a* `proxy` {URL} The url to proxy requests through.\u000a* `https-proxy` {URL} The url to proxy https requests through.\u000a Defaults to be the same as `proxy` if unset.\u000a* `_auth` {String} The base64-encoded authorization header.\u000a* `username` `_password` {String} Username/password to use to generate\u000a `_auth` if not supplied.\u000a* `_token` {Object} A token for use with\u000a [couch-login](https://npmjs.org/package/couch-login)\u000a\u000a# client.request(method, uri, options, cb)\u000a\u000a* `method` {String} HTTP method\u000a* `uri` {String} URI pointing to the resource to request\u000a* `options` {Object} Object containing optional per-request properties.\u000a * `what` {Stream | Buffer | String | Object} The request body. Objects\u000a that are not Buffers or Streams are encoded as JSON.\u000a * `etag` {String} The cached ETag\u000a * `follow` {Boolean} Follow 302/301 responses (defaults to true)\u000a* `cb` {Function}\u000a * `error` {Error | null}\u000a * `data` {Object} the parsed data object\u000a * `raw` {String} the json\u000a * `res` {Response Object} response from couch\u000a\u000aMake a request to the registry. All the other methods are wrappers around\u000a`request`.\u000a\u000a# client.adduser(base, username, password, email, cb)\u000a\u000a* `base` {String} Base registry URL\u000a* `username` {String}\u000a* `password` {String}\u000a* `email` {String}\u000a* `cb` {Function}\u000a\u000aAdd a user account to the registry, or verify the credentials.\u000a\u000a# client.deprecate(uri, version, message, cb)\u000a\u000a* `uri` {String} Full registry URI for the deprecated package\u000a* `version` {String} Semver version range\u000a* `message` {String} The message to use as a deprecation warning\u000a* `cb` {Function}\u000a\u000aDeprecate a version of a package in the registry.\u000a\u000a# client.bugs(uri, cb)\u000a\u000a* `uri` {String} Full registry URI for the package\u000a* `cb` {Function}\u000a\u000aGet the url for bugs of a package\u000a\u000a# client.get(uri, options, cb)\u000a\u000a* `uri` {String} The complete registry URI to fetch\u000a* `options` {Object} Object containing optional per-request properties.\u000a * `timeout` {Number} Duration before the request times out.\u000a * `follow` {Boolean} Follow 302/301 responses (defaults to true)\u000a * `staleOk` {Boolean} If there's cached data available, then return that\u000a to the callback quickly, and update the cache the background.\u000a\u000aFetches data from the registry via a GET request, saving it in the cache folder\u000awith the ETag.\u000a\u000a# client.publish(uri, data, tarball, cb)\u000a\u000a* `uri` {String} The registry URI to publish to\u000a* `data` {Object} Package data\u000a* `tarball` {String | Stream} Filename or stream of the package tarball\u000a* `cb` {Function}\u000a\u000aPublish a package to the registry.\u000a\u000aNote that this does not create the tarball from a folder. However, it can\u000aaccept a gzipped tar stream or a filename to a tarball.\u000a\u000a# client.star(uri, starred, cb)\u000a\u000a* `uri` {String} The complete registry URI to star\u000a* `starred` {Boolean} True to star the package, false to unstar it.\u000a* `cb` {Function}\u000a\u000aStar or unstar a package.\u000a\u000aNote that the user does not have to be the package owner to star or unstar a\u000apackage, though other writes do require that the user be the package owner.\u000a\u000a# client.stars(base, username, cb)\u000a\u000a* `base` {String} The base URL for the registry\u000a* `username` {String} Name of user to fetch starred packages for.\u000a* `cb` {Function}\u000a\u000aView your own or another user's starred packages.\u000a\u000a# client.tag(uri, version, tag, cb)\u000a\u000a* `uri` {String} The complete registry URI to tag\u000a* `version` {String} Version to tag\u000a* `tag` {String} Tag name to apply\u000a* `cb` {Function}\u000a\u000aMark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the\u000aspecified version.\u000a\u000a# client.unpublish(uri, [ver], cb)\u000a\u000a* `uri` {String} The complete registry URI to unpublish\u000a* `ver` {String} version to unpublish. Leave blank to unpublish all\u000a versions.\u000a* `cb` {Function}\u000a\u000aRemove a version of a package (or all versions) from the registry. When the\u000alast version us unpublished, the entire document is removed from the database.\u000a\u000a# client.upload(uri, file, [etag], [nofollow], cb)\u000a\u000a* `uri` {String} The complete registry URI to upload to\u000a* `file` {String | Stream} Either the filename or a readable stream\u000a* `etag` {String} Cache ETag\u000a* `nofollow` {Boolean} Do not follow 301/302 responses\u000a* `cb` {Function}\u000a\u000aUpload an attachment. Mostly used by `client.publish()`.\u000a","maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"othiym23","email":"ogd@aoaioxxysz.net"}],"time":{"modified":"2014-07-31T21:59:52.896Z","created":"2012-06-07T04:43:36.581Z","0.0.1":"2012-06-07T04:43:38.123Z","0.0.2":"2012-06-07T05:35:05.937Z","0.0.3":"2012-06-09T00:55:25.861Z","0.0.4":"2012-06-11T03:53:26.548Z","0.0.5":"2012-06-11T23:48:11.235Z","0.0.6":"2012-06-17T06:23:27.320Z","0.0.7":"2012-06-18T19:19:38.315Z","0.0.8":"2012-06-28T20:40:20.563Z","0.0.9":"2012-07-10T03:28:04.651Z","0.0.10":"2012-07-11T17:03:45.151Z","0.0.11":"2012-07-17T14:06:37.489Z","0.1.0":"2012-07-23T18:17:38.007Z","0.1.1":"2012-07-23T21:21:28.196Z","0.1.2":"2012-07-24T06:14:12.831Z","0.1.3":"2012-08-07T02:02:20.564Z","0.1.4":"2012-08-15T03:04:52.822Z","0.1.5":"2012-08-17T21:59:33.310Z","0.2.0":"2012-08-17T22:00:18.081Z","0.2.1":"2012-08-17T22:07:28.827Z","0.2.2":"2012-08-17T22:37:24.352Z","0.2.3":"2012-08-19T19:16:44.808Z","0.2.4":"2012-08-19T19:18:51.792Z","0.2.5":"2012-08-20T16:54:50.794Z","0.2.6":"2012-08-22T00:25:04.766Z","0.2.7":"2012-08-27T19:07:34.829Z","0.2.8":"2012-10-02T19:53:50.661Z","0.2.9":"2012-10-03T22:09:50.766Z","0.2.10":"2012-10-25T14:55:54.216Z","0.2.11":"2012-12-21T16:26:38.094Z","0.2.12":"2013-01-18T22:22:41.668Z","0.2.13":"2013-02-06T00:16:35.939Z","0.2.14":"2013-02-10T02:44:02.764Z","0.2.15":"2013-02-11T19:18:55.678Z","0.2.16":"2013-02-15T17:09:03.249Z","0.2.17":"2013-02-16T03:47:13.898Z","0.2.18":"2013-03-06T22:09:23.536Z","0.2.19":"2013-03-20T06:27:39.128Z","0.2.20":"2013-03-28T00:43:07.558Z","0.2.21":"2013-04-29T15:46:54.094Z","0.2.22":"2013-04-29T15:51:02.178Z","0.2.23":"2013-05-11T00:28:14.198Z","0.2.24":"2013-05-24T21:27:50.693Z","0.2.25":"2013-06-20T15:36:46.277Z","0.2.26":"2013-07-06T17:12:54.670Z","0.2.27":"2013-07-11T07:14:45.740Z","0.2.28":"2013-08-02T20:27:41.732Z","0.2.29":"2013-10-28T18:23:24.477Z","0.2.30":"2013-11-18T23:12:00.540Z","0.2.31":"2013-12-16T08:36:43.044Z","0.3.0":"2013-12-17T07:03:10.699Z","0.3.1":"2013-12-17T16:53:27.867Z","0.3.2":"2013-12-17T22:25:14.882Z","0.3.3":"2013-12-21T16:07:06.773Z","0.3.4":"2014-01-29T15:24:05.163Z","0.3.5":"2014-01-31T01:53:19.656Z","0.3.6":"2014-02-07T00:17:21.362Z","0.4.0":"2014-02-13T01:17:18.973Z","0.4.1":"2014-02-13T23:47:37.892Z","0.4.2":"2014-02-14T00:29:13.086Z","0.4.3":"2014-02-16T03:40:54.640Z","0.4.4":"2014-02-16T03:41:48.856Z","0.4.5":"2014-03-12T05:09:17.474Z","0.4.6":"2014-03-29T19:44:15.041Z","0.4.7":"2014-04-02T19:41:07.149Z","0.4.8":"2014-05-01T22:24:54.980Z","0.4.9":"2014-05-12T21:52:55.127Z","0.4.10":"2014-05-13T16:44:29.801Z","0.4.11":"2014-05-13T20:33:04.738Z","0.4.12":"2014-05-14T06:14:22.842Z","1.0.0":"2014-05-14T23:04:37.188Z","1.0.1":"2014-06-03T00:55:54.448Z","2.0.0":"2014-06-06T04:23:46.579Z","2.0.1":"2014-06-06T06:25:14.419Z","2.0.2":"2014-06-14T00:33:10.205Z","3.0.0":"2014-07-02T00:30:29.154Z","3.0.1":"2014-07-14T23:29:05.057Z","2.0.3":"2014-07-15T00:09:36.043Z","3.0.2":"2014-07-17T06:30:02.659Z","3.0.3":"2014-07-23T21:20:42.406Z","3.0.4":"2014-07-25T00:27:26.007Z","3.0.5":"2014-07-25T00:28:48.007Z","3.0.6":"2014-07-31T21:57:49.043Z","2.0.4":"2014-07-31T21:59:52.896Z"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"repository":{"url":"git://github.com/isaacs/npm-registry-client"},"users":{"fgribreau":true,"fengmk2":true},"readmeFilename":"README.md","homepage":"https://github.com/isaacs/npm-registry-client","bugs":{"url":"https://github.com/isaacs/npm-registry-client/issues"},"license":"ISC","_attachments":{}} diff --git a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/cache.json b/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/cache.json deleted file mode 100644 index 01da3002763731..00000000000000 --- a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/cache.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"47ac53683daf832bfa952e1774417da47817ae42","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}} \ No newline at end of file diff --git a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/package.tgz b/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/package.tgz deleted file mode 100644 index 19da9baa7fb191..00000000000000 Binary files a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/package.tgz and /dev/null differ diff --git a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/cache.json b/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/cache.json deleted file mode 100644 index d899f11922a405..00000000000000 --- a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/cache.json +++ /dev/null @@ -1 +0,0 @@ -{"_id":"underscore","_rev":"72-47f2986bfd8e8b55068b204588bbf484","name":"underscore","description":"JavaScript's functional programming helper library.","dist-tags":{"latest":"1.3.3","stable":"1.3.3"},"versions":{"1.0.3":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.0.3","_id":"underscore@1.0.3","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.0.3.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.0.4":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.0.4","_id":"underscore@1.0.4","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.0.4.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.0":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.0","_id":"underscore@1.1.0","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.0.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.1":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.1","_id":"underscore@1.1.1","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.1.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.2":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.2","_id":"underscore@1.1.2","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.2.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.3":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.3","_id":"underscore@1.1.3","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.8-1","_nodeVersion":"v0.2.5","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.3.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.4":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore.js","version":"1.1.4","_id":"underscore@1.1.4","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.9","_nodeVersion":"v0.5.0-pre","dist":{"shasum":"9e82274902865625b3a6d4c315a38ffd80047dae","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.4.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.1.5":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.5","_id":"underscore@1.1.5","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.16","_nodeVersion":"v0.4.2","directories":{},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"23601d62c75619998b2f0db24938102793336a56","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.5.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.6":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.6","_id":"underscore@1.1.6","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.2","directories":{},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"6868da1bdd72d75285be0b4e50f228e70d001a2c","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.6.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.7":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.7","devDependencies":{},"_id":"underscore@1.1.7","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"40bab84bad19d230096e8d6ef628bff055d83db0","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz"},"scripts":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.0":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.0","_npmJsonOpts":{"file":"/Users/jashkenas/.npm/underscore/1.2.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"underscore@1.2.0","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"b32ce32c8c118caa8031c10b54c7f65ab3b557fd","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.0.tgz"},"scripts":{},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"directories":{}},"1.2.1":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.1","_npmJsonOpts":{"file":"/Users/jashkenas/.npm/underscore/1.2.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"underscore@1.2.1","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"fc5c6b0765673d92a2d4ac8b4dc0aa88702e2bd4","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.1.tgz"},"scripts":{},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"directories":{}},"1.2.2":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.2","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.2","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.0","_defaultsLoaded":true,"dist":{"shasum":"74dd40e9face84e724eb2edae945b8aedc233ba3","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.2.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.3":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.3","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.0","_defaultsLoaded":true,"dist":{"shasum":"11b874da70f4683d7d48bba2b44be1e600d2f6cf","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.3.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.4":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.4","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.4","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"e8da6241aa06f64df2473bb2590b8c17c84c3c7e","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.4.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.0":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.0","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.0","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"253b2d79b7bb67943ced0fc744eb18267963ede8","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.0.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.1":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.1","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.1","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"6cb8aad0e77eb5dbbfb54b22bcd8697309cf9641","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.1.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.2":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.2","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.2","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"1b4e455089ab1d1d38ab6794ffe6cf08f764394a","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.2.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.3":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"47ac53683daf832bfa952e1774417da47817ae42","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}}},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"time":{"1.0.3":"2011-12-07T15:12:18.045Z","1.0.4":"2011-12-07T15:12:18.045Z","1.1.0":"2011-12-07T15:12:18.045Z","1.1.1":"2011-12-07T15:12:18.045Z","1.1.2":"2011-12-07T15:12:18.045Z","1.1.3":"2011-12-07T15:12:18.045Z","1.1.4":"2011-12-07T15:12:18.045Z","1.1.5":"2011-12-07T15:12:18.045Z","1.1.6":"2011-12-07T15:12:18.045Z","1.1.7":"2011-12-07T15:12:18.045Z","1.2.0":"2011-12-07T15:12:18.045Z","1.2.1":"2011-12-07T15:12:18.045Z","1.2.2":"2011-11-14T20:28:47.115Z","1.2.3":"2011-12-07T15:12:18.045Z","1.2.4":"2012-01-09T17:23:14.818Z","1.3.0":"2012-01-11T16:41:38.459Z","1.3.1":"2012-01-23T22:57:36.474Z","1.3.2":"2012-04-09T18:38:14.345Z","1.3.3":"2012-04-10T14:43:48.089Z"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"users":{"vesln":true,"mvolkmann":true,"lancehunt":true,"mikl":true,"linus":true,"vasc":true,"bat":true,"dmalam":true,"mbrevoort":true,"danielr":true,"rsimoes":true,"thlorenz":true}} \ No newline at end of file diff --git a/deps/npm/node_modules/request/.eslintrc b/deps/npm/node_modules/request/.eslintrc deleted file mode 100644 index 6ebc53601d7ba5..00000000000000 --- a/deps/npm/node_modules/request/.eslintrc +++ /dev/null @@ -1,45 +0,0 @@ -{ - "env": { - "node": true - }, - "rules": { - // 2-space indentation - "indent": [2, 2, {"SwitchCase": 1}], - // Disallow semi-colons, unless needed to disambiguate statement - "semi": [2, "never"], - // Require strings to use single quotes - "quotes": [2, "single"], - // Require curly braces for all control statements - "curly": 2, - // Disallow using variables and functions before they've been defined - "no-use-before-define": 2, - // Allow any case for variable naming - "camelcase": 0, - // Disallow unused variables, except as function arguments - "no-unused-vars": [2, {"args":"none"}], - // Allow leading underscores for method names - // REASON: we use underscores to denote private methods - "no-underscore-dangle": 0, - // Allow multi spaces around operators since they are - // used for alignment. This is not consistent in the - // code. - "no-multi-spaces": 0, - // Style rule is: most objects use { beforeColon: false, afterColon: true }, unless aligning which uses: - // - // { - // beforeColon : true, - // afterColon : true - // } - // - // eslint can't handle this, so the check is disabled. - "key-spacing": 0, - // Allow shadowing vars in outer scope (needs discussion) - "no-shadow": 0, - // Use if () { } - // ^ space - "space-after-keywords": [2, "always"], - // Use if () { } - // ^ space - "space-before-blocks": [2, "always"] - } -} diff --git a/deps/npm/package.json b/deps/npm/package.json index e7d5f3d78bf6da..ec38da222ff146 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "3.8.3", + "version": "3.8.6", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -19,7 +19,7 @@ "url": "https://github.com/npm/npm" }, "bugs": { - "url": "http://github.com/npm/npm/issues" + "url": "https://github.com/npm/npm/issues" }, "directories": { "bin": "./bin", @@ -35,7 +35,6 @@ "ansistyles": "~0.1.3", "aproba": "~1.0.1", "archy": "~1.0.0", - "async-some": "~1.0.2", "chownr": "~1.0.1", "cmd-shim": "~2.0.2", "columnify": "~1.5.4", @@ -56,13 +55,13 @@ "ini": "~1.3.4", "init-package-json": "~1.9.3", "lockfile": "~1.0.1", - "lodash._baseuniq": "~4.5.0", - "lodash.clonedeep": "~4.3.1", + "lodash._baseuniq": "~4.5.1", + "lodash.clonedeep": "~4.3.2", "lodash.isarray": "~4.0.0", "lodash.keys": "~4.0.5", - "lodash.union": "~4.2.0", - "lodash.uniq": "~4.2.0", - "lodash.without": "~4.1.1", + "lodash.union": "~4.2.1", + "lodash.uniq": "~4.2.1", + "lodash.without": "~4.1.2", "mkdirp": "~0.5.1", "node-gyp": "~3.3.1", "nopt": "~3.0.6", @@ -111,7 +110,6 @@ "ansistyles", "aproba", "archy", - "async-some", "chownr", "cmd-shim", "columnify", @@ -204,12 +202,12 @@ }, "scripts": { "dumpconf": "env | grep npm | sort | uniq", - "prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc", + "prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make doc-clean && make -j4 doc", "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true", "tap": "tap --timeout 240", "test": "standard && npm run test-tap", "test-tap": "npm run tap -- \"test/tap/*.js\"", - "test-node": "\"$NODE\" ./test/run.js && \"$NODE\" \"node_modules/.bin/tap\" --timeout 240 \"test/tap/*.js\"" + "test-node": "\"$NODE\" \"node_modules/.bin/tap\" --timeout 240 \"test/tap/*.js\"" }, "license": "Artistic-2.0" } diff --git a/deps/npm/test/fixtures/config/userconfig-with-gc b/deps/npm/test/fixtures/config/userconfig-with-gc index 7268fcb3c611f9..62ad80be113e5e 100644 --- a/deps/npm/test/fixtures/config/userconfig-with-gc +++ b/deps/npm/test/fixtures/config/userconfig-with-gc @@ -1,4 +1,4 @@ -globalconfig=/Users/ogd/Documents/projects/npm/npm/test/fixtures/config/globalconfig +globalconfig=/Users/zkat/Documents/code/npm/test/fixtures/config/globalconfig email=i@izs.me env-thing=asdf init.author.name=Isaac Z. Schlueter diff --git a/deps/npm/test/tap/deprecate.js b/deps/npm/test/tap/deprecate.js index 1d9a867cd7488f..987acb80afd409 100644 --- a/deps/npm/test/tap/deprecate.js +++ b/deps/npm/test/tap/deprecate.js @@ -126,6 +126,30 @@ test('npm deprecate bad semver range', function (t) { }) }) +test('npm deprecate a package with no semver range', function (t) { + var deprecated = JSON.parse(JSON.stringify(cache)) + deprecated.versions = { + '0.0.0': { deprecated: 'make it dead' }, + '0.0.1': { deprecated: 'make it dead' }, + '0.0.2': { deprecated: 'make it dead' } + } + server.get('/cond?write=true').reply(200, cache) + server.put('/cond', deprecated).reply(201, { deprecated: true }) + common.npm([ + 'deprecate', + 'cond', + 'make it dead', + '--registry', common.registry, + '--loglevel', 'silent' + ], {}, + function (er, code, stdout, stderr) { + t.ifError(er, 'npm deprecate') + t.equal(stderr, '', 'no error output') + t.equal(code, 0, 'exited OK') + t.end() + }) +}) + test('cleanup', function (t) { server.close() t.ok(true) diff --git a/deps/npm/test/tap/link.js b/deps/npm/test/tap/link.js index 869364c29b5e7e..e2f545520024fc 100644 --- a/deps/npm/test/tap/link.js +++ b/deps/npm/test/tap/link.js @@ -3,6 +3,7 @@ var osenv = require('osenv') var path = require('path') var rimraf = require('rimraf') var test = require('tap').test +var lstatSync = require('fs').lstatSync var writeFileSync = require('fs').writeFileSync var common = require('../common-tap.js') @@ -10,6 +11,7 @@ var common = require('../common-tap.js') var link = path.join(__dirname, 'link') var linkScoped = path.join(__dirname, 'link-scoped') var linkInstall = path.join(__dirname, 'link-install') +var linkInside = path.join(linkInstall, 'node_modules', 'inside') var linkRoot = path.join(__dirname, 'link-root') var config = 'prefix = ' + linkRoot @@ -57,6 +59,18 @@ var installJSON = { license: 'ISC' } +var insideInstallJSON = { + name: 'inside', + version: '1.0.0', + description: '', + main: 'index.js', + scripts: { + test: 'echo \"Error: no test specified\" && exit 1' + }, + author: '', + license: 'ISC' +} + test('setup', function (t) { setup() common.npm(['ls', '-g', '--depth=0'], OPTS, function (err, c, out) { @@ -81,6 +95,20 @@ test('create global link', function (t) { }) }) +test('create global inside link', function (t) { + process.chdir(linkInside) + common.npm(['link'], OPTS, function (err, c, out) { + t.ifError(err, 'link has no error') + common.npm(['ls', '-g'], OPTS, function (err, c, out, stderr) { + t.ifError(err) + t.equal(c, 0) + t.equal(stderr, '', 'got expected stderr') + t.has(out, /inside@1.0.0/, 'creates global inside link ok') + t.end() + }) + }) +}) + test('create scoped global link', function (t) { process.chdir(linkScoped) common.npm(['link'], OPTS, function (err, c, out) { @@ -108,6 +136,17 @@ test('link-install the package', function (t) { }) }) +test('link-inside-install fails', function (t) { + process.chdir(linkInstall) + t.notOk(lstatSync(linkInside).isSymbolicLink(), 'directory for linked package is not a symlink to begin with') + common.npm(['link', 'inside'], OPTS, function (err, code) { + t.ifError(err, 'npm removed the linked package without error') + t.notEqual(code, 0, 'link operation failed') + t.notOk(lstatSync(linkInside).isSymbolicLink(), 'directory for linked package has not turned into a symlink') + t.end() + }) +}) + test('link-install the scoped package', function (t) { process.chdir(linkInstall) common.npm(['link', linkScoped], OPTS, function (err) { @@ -141,6 +180,7 @@ function cleanup () { rimraf.sync(link) rimraf.sync(linkScoped) rimraf.sync(linkInstall) + rimraf.sync(linkInside) } function setup () { @@ -161,5 +201,10 @@ function setup () { path.join(linkInstall, 'package.json'), JSON.stringify(installJSON, null, 2) ) + mkdirp.sync(linkInside) + writeFileSync( + path.join(linkInside, 'package.json'), + JSON.stringify(insideInstallJSON, null, 2) + ) writeFileSync(configPath, config) } diff --git a/deps/npm/test/tap/outdated-symlink.js b/deps/npm/test/tap/outdated-symlink.js index 203df9ba8f4f0f..a5ebea0d2ead5b 100644 --- a/deps/npm/test/tap/outdated-symlink.js +++ b/deps/npm/test/tap/outdated-symlink.js @@ -51,19 +51,26 @@ test('setup', function (t) { test('when outdated is called linked packages should be displayed as such', function (t) { var regOutLinked = /my-local-package\s*1.0.0\s*linked\s*linked\n/ - var regOutInstallOne = /async\s*0.2.9\s*0.2.9\s*1.5.2\n/ - var regOutInstallTwo = /underscore\s*1.3.1\s*1.3.1\s*1.8.3\n/ + var regOutInstallOne = /async\s*0.2.9\s*0.2.9\s*0.2.10\n/ + var regOutInstallTwo = /underscore\s*1.3.1\s*1.3.1\s*1.5.1\n/ console.log = function () {} mr({ port: common.port }, function (er, s) { - common.npm(['outdated', '-g'], OPTS, function (err, c, out, stderr) { - t.ifError(err) - t.ok(out.match(regOutLinked), 'Global Link format as expected') - t.ok(out.match(regOutInstallOne), 'Global Install format as expected') - t.ok(out.match(regOutInstallTwo), 'Global Install format as expected') - s.close() - t.end() - }) + common.npm( + [ + '--registry', common.registry, + 'outdated', '-g' + ], + OPTS, + function (err, c, out, stderr) { + t.ifError(err) + t.ok(out.match(regOutLinked), 'Global Link format as expected') + t.ok(out.match(regOutInstallOne), 'Global Install format as expected') + t.ok(out.match(regOutInstallTwo), 'Global Install format as expected') + s.close() + t.end() + } + ) }) }) diff --git a/deps/npm/test/tap/search.js b/deps/npm/test/tap/search.js index 08cc7a6fe67dd5..138517c3bd13c4 100644 --- a/deps/npm/test/tap/search.js +++ b/deps/npm/test/tap/search.js @@ -74,6 +74,20 @@ test('No previous cache, init cache triggered by first search', function (t) { }) }) +test('no arguments provided should error', function (t) { + common.npm(['search'], [], function (err, code, stdout, stderr) { + if (err) throw err + t.equal(code, 1, 'search finished unsuccessfully') + + t.match( + stderr, + /search must be called with arguments/, + 'should have correct error message' + ) + t.end() + }) +}) + test('previous cache, _updated set, should trigger since request', function (t) { setupCache() diff --git a/deps/v8/src/debug/debug.js b/deps/v8/src/debug/debug.js index 33b5e6a5543f04..a863ab9cdef07e 100644 --- a/deps/v8/src/debug/debug.js +++ b/deps/v8/src/debug/debug.js @@ -2416,7 +2416,7 @@ DebugCommandProcessor.prototype.restartFrameRequest_ = function( frame_mirror = this.exec_state_.frame(); } - var result_description = Debug.LiveEdit.RestartFrame(frame_mirror); + var result_description = frame_mirror.restart(); response.body = {result: result_description}; }; diff --git a/deps/v8/tools/tickprocessor.js b/deps/v8/tools/tickprocessor.js index d8575738553aa9..381e2f9b69ffa7 100644 --- a/deps/v8/tools/tickprocessor.js +++ b/deps/v8/tools/tickprocessor.js @@ -750,8 +750,11 @@ inherits(MacCppEntriesProvider, UnixCppEntriesProvider); MacCppEntriesProvider.prototype.loadSymbols = function(libName) { this.parsePos = 0; libName = this.targetRootFS + libName; + + // It seems that in OS X `nm` thinks that `-f` is a format option, not a + // "flat" display option flag. try { - this.symbols = [os.system(this.nmExec, ['-n', '-f', libName], -1, -1), '']; + this.symbols = [os.system(this.nmExec, ['-n', libName], -1, -1), '']; } catch (e) { // If the library cannot be found on this system let's not panic. this.symbols = ''; diff --git a/doc/api/_toc.markdown b/doc/api/_toc.md similarity index 100% rename from doc/api/_toc.markdown rename to doc/api/_toc.md diff --git a/doc/api/addons.markdown b/doc/api/addons.markdown deleted file mode 100644 index c330217beffa4d..00000000000000 --- a/doc/api/addons.markdown +++ /dev/null @@ -1,1091 +0,0 @@ -# Addons - -Node.js Addons are dynamically-linked shared objects, written in C or C++, that -can be loaded into Node.js using the [`require()`][require] function, and used -just as if they were an ordinary Node.js module. They are used primarily to -provide an interface between JavaScript running in Node.js and C/C++ libraries. - -At the moment, the method for implementing Addons is rather complicated, -involving knowledge of several components and APIs : - - - V8: the C++ library Node.js currently uses to provide the - JavaScript implementation. V8 provides the mechanisms for creating objects, - calling functions, etc. V8's API is documented mostly in the - `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source - tree), which is also available [online][v8-docs]. - - - [libuv][]: The C library that implements the Node.js event loop, its worker - threads and all of the asynchronous behaviors of the platform. It also - serves as a cross-platform abstraction library, giving easy, POSIX-like - access across all major operating systems to many common system tasks, such - as interacting with the filesystem, sockets, timers and system events. libuv - also provides a pthreads-like threading abstraction that may be used to - power more sophisticated asynchronous Addons that need to move beyond the - standard event loop. Addon authors are encouraged to think about how to - avoid blocking the event loop with I/O or other time-intensive tasks by - off-loading work via libuv to non-blocking system operations, worker threads - or a custom use of libuv's threads. - - - Internal Node.js libraries. Node.js itself exports a number of C/C++ APIs - that Addons can use — the most important of which is the - `node::ObjectWrap` class. - - - Node.js includes a number of other statically linked libraries including - OpenSSL. These other libraries are located in the `deps/` directory in the - Node.js source tree. Only the V8 and OpenSSL symbols are purposefully - re-exported by Node.js and may be used to various extents by Addons. - See [Linking to Node.js' own dependencies][] for additional information. - -All of the following examples are available for [download][] and may -be used as a starting-point for your own Addon. - -## Hello world - -This "Hello world" example is a simple Addon, written in C++, that is the -equivalent of the following JavaScript code: - -```js -module.exports.hello = () => 'world'; -``` - -First, create the file `hello.cc`: - -```cpp -// hello.cc -#include - -namespace demo { - -using v8::FunctionCallbackInfo; -using v8::Isolate; -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - -void Method(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); -} - -void init(Local exports) { - NODE_SET_METHOD(exports, "hello", Method); -} - -NODE_MODULE(addon, init) - -} // namespace demo -``` - -Note that all Node.js Addons must export an initialization function following -the pattern: - -```cpp -void Initialize(Local exports); -NODE_MODULE(module_name, Initialize) -``` - -There is no semi-colon after `NODE_MODULE` as it's not a function (see -`node.h`). - -The `module_name` must match the filename of the final binary (excluding -the .node suffix). - -In the `hello.cc` example, then, the initialization function is `init` and the -Addon module name is `addon`. - -### Building - -Once the source code has been written, it must be compiled into the binary -`addon.node` file. To do so, create a file called `binding.gyp` in the -top-level of the project describing the build configuration of your module -using a JSON-like format. This file is used by [node-gyp][] -- a tool written -specifically to compile Node.js Addons. - -``` -{ - "targets": [ - { - "target_name": "addon", - "sources": [ "hello.cc" ] - } - ] -} -``` - -*Note: A version of the `node-gyp` utility is bundled and distributed with -Node.js as part of `npm`. This version is not made directly available for -developers to use and is intended only to support the ability to use the -`npm install` command to compile and install Addons. Developers who wish to -use `node-gyp` directly can install it using the command -`npm install -g node-gyp`. See the `node-gyp` [installation instructions][] for -more information, including platform-specific requirements.* - -Once the `binding.gyp` file has been created, use `node-gyp configure` to -generate the appropriate project build files for the current platform. This -will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file -(on Windows) in the `build/` directory. - -Next, invoke the `node-gyp build` command to generate the compiled `addon.node` -file. This will be put into the `build/Release/` directory. - -When using `npm install` to install a Node.js Addon, npm uses its own bundled -version of `node-gyp` to perform this same set of actions, generating a -compiled version of the Addon for the user's platform on demand. - -Once built, the binary Addon can be used from within Node.js by pointing -[`require()`][require] to the built `addon.node` module: - -```js -// hello.js -const addon = require('./build/Release/addon'); - -console.log(addon.hello()); // 'world' -``` - -Please see the examples below for further information or - for an example in production. - -Because the exact path to the compiled Addon binary can vary depending on how -it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use -the [bindings][] package to load the compiled module. - -Note that while the `bindings` package implementation is more sophisticated -in how it locates Addon modules, it is essentially using a try-catch pattern -similar to: - -```js -try { - return require('./build/Release/addon.node'); -} catch (err) { - return require('./build/Debug/addon.node'); -} -``` - -### Linking to Node.js' own dependencies - -Node.js uses a number of statically linked libraries such as V8, libuv and -OpenSSL. All Addons are required to link to V8 and may link to any of the -other dependencies as well. Typically, this is as simple as including -the appropriate `#include <...>` statements (e.g. `#include `) and -`node-gyp` will locate the appropriate headers automatically. However, there -are a few caveats to be aware of: - -* When `node-gyp` runs, it will detect the specific release version of Node.js -and download either the full source tarball or just the headers. If the full -source is downloaded, Addons will have complete access to the full set of -Node.js dependencies. However, if only the Node.js headers are downloaded, then -only the symbols exported by Node.js will be available. - -* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js -source image. Using this option, the Addon will have access to the full set of -dependencies. - -### Loading Addons using require() - -The filename extension of the compiled Addon binary is `.node` (as opposed -to `.dll` or `.so`). The [`require()`][require] function is written to look for -files with the `.node` file extension and initialize those as dynamically-linked -libraries. - -When calling [`require()`][require], the `.node` extension can usually be -omitted and Node.js will still find and initialize the Addon. One caveat, -however, is that Node.js will first attempt to locate and load modules or -JavaScript files that happen to share the same base name. For instance, if -there is a file `addon.js` in the same directory as the binary `addon.node`, -then [`require('addon')`][require] will give precedence to the `addon.js` file -and load it instead. - -## Native Abstractions for Node.js - -Each of the examples illustrated in this document make direct use of the -Node.js and V8 APIs for implementing Addons. It is important to understand -that the V8 API can, and has, changed dramatically from one V8 release to the -next (and one major Node.js release to the next). With each change, Addons may -need to be updated and recompiled in order to continue functioning. The Node.js -release schedule is designed to minimize the frequency and impact of such -changes but there is little that Node.js can do currently to ensure stability -of the V8 APIs. - -The [Native Abstractions for Node.js][] (or `nan`) provide a set of tools that -Addon developers are recommended to use to keep compatibility between past and -future releases of V8 and Node.js. See the `nan` [examples][] for an -illustration of how it can be used. - -## Addon examples - -Following are some example Addons intended to help developers get started. The -examples make use of the V8 APIs. Refer to the online [V8 reference][v8-docs] -for help with the various V8 calls, and V8's [Embedder's Guide][] for an -explanation of several concepts used such as handles, scopes, function -templates, etc. - -Each of these examples using the following `binding.gyp` file: - -``` -{ - "targets": [ - { - "target_name": "addon", - "sources": [ "addon.cc" ] - } - ] -} -``` - -In cases where there is more than one `.cc` file, simply add the additional -filename to the `sources` array. For example: - -``` -"sources": ["addon.cc", "myexample.cc"] -``` - -Once the `binding.gyp` file is ready, the example Addons can be configured and -built using `node-gyp`: - -``` -$ node-gyp configure build -``` - - -### Function arguments - -Addons will typically expose objects and functions that can be accessed from -JavaScript running within Node.js. When functions are invoked from JavaScript, -the input arguments and return value must be mapped to and from the C/C++ -code. - -The following example illustrates how to read function arguments passed from -JavaScript and how to return a result: - -```cpp -// addon.cc -#include - -namespace demo { - -using v8::Exception; -using v8::FunctionCallbackInfo; -using v8::Isolate; -using v8::Local; -using v8::Number; -using v8::Object; -using v8::String; -using v8::Value; - -// This is the implementation of the "add" method -// Input arguments are passed using the -// const FunctionCallbackInfo& args struct -void Add(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - // Check the number of arguments passed. - if (args.Length() < 2) { - // Throw an Error that is passed back to JavaScript - isolate->ThrowException(Exception::TypeError( - String::NewFromUtf8(isolate, "Wrong number of arguments"))); - return; - } - - // Check the argument types - if (!args[0]->IsNumber() || !args[1]->IsNumber()) { - isolate->ThrowException(Exception::TypeError( - String::NewFromUtf8(isolate, "Wrong arguments"))); - return; - } - - // Perform the operation - double value = args[0]->NumberValue() + args[1]->NumberValue(); - Local num = Number::New(isolate, value); - - // Set the return value (using the passed in - // FunctionCallbackInfo&) - args.GetReturnValue().Set(num); -} - -void Init(Local exports) { - NODE_SET_METHOD(exports, "add", Add); -} - -NODE_MODULE(addon, Init) - -} // namespace demo -``` - -Once compiled, the example Addon can be required and used from within Node.js: - -```js -// test.js -const addon = require('./build/Release/addon'); - -console.log('This should be eight:', addon.add(3, 5)); -``` - - -### Callbacks - -It is common practice within Addons to pass JavaScript functions to a C++ -function and execute them from there. The following example illustrates how -to invoke such callbacks: - -```cpp -// addon.cc -#include - -namespace demo { - -using v8::Function; -using v8::FunctionCallbackInfo; -using v8::Isolate; -using v8::Local; -using v8::Null; -using v8::Object; -using v8::String; -using v8::Value; - -void RunCallback(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - Local cb = Local::Cast(args[0]); - const unsigned argc = 1; - Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; - cb->Call(Null(isolate), argc, argv); -} - -void Init(Local exports, Local module) { - NODE_SET_METHOD(module, "exports", RunCallback); -} - -NODE_MODULE(addon, Init) - -} // namespace demo -``` - -Note that this example uses a two-argument form of `Init()` that receives -the full `module` object as the second argument. This allows the Addon -to completely overwrite `exports` with a single function instead of -adding the function as a property of `exports`. - -To test it, run the following JavaScript: - -```js -// test.js -const addon = require('./build/Release/addon'); - -addon((msg) => { - console.log(msg); // 'hello world' -}); -``` - -Note that, in this example, the callback function is invoked synchronously. - -### Object factory - -Addons can create and return new objects from within a C++ function as -illustrated in the following example. An object is created and returned with a -property `msg` that echoes the string passed to `createObject()`: - -```cpp -// addon.cc -#include - -namespace demo { - -using v8::FunctionCallbackInfo; -using v8::Isolate; -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - -void CreateObject(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - Local obj = Object::New(isolate); - obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); - - args.GetReturnValue().Set(obj); -} - -void Init(Local exports, Local module) { - NODE_SET_METHOD(module, "exports", CreateObject); -} - -NODE_MODULE(addon, Init) - -} // namespace demo -``` - -To test it in JavaScript: - -```js -// test.js -const addon = require('./build/Release/addon'); - -var obj1 = addon('hello'); -var obj2 = addon('world'); -console.log(obj1.msg + ' ' + obj2.msg); // 'hello world' -``` - - -### Function factory - -Another common scenario is creating JavaScript functions that wrap C++ -functions and returning those back to JavaScript: - -```cpp -// addon.cc -#include - -namespace demo { - -using v8::Function; -using v8::FunctionCallbackInfo; -using v8::FunctionTemplate; -using v8::Isolate; -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - -void MyFunction(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); -} - -void CreateFunction(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - Local tpl = FunctionTemplate::New(isolate, MyFunction); - Local fn = tpl->GetFunction(); - - // omit this to make it anonymous - fn->SetName(String::NewFromUtf8(isolate, "theFunction")); - - args.GetReturnValue().Set(fn); -} - -void Init(Local exports, Local module) { - NODE_SET_METHOD(module, "exports", CreateFunction); -} - -NODE_MODULE(addon, Init) - -} // namespace demo -``` - -To test: - -```js -// test.js -const addon = require('./build/Release/addon'); - -var fn = addon(); -console.log(fn()); // 'hello world' -``` - - -### Wrapping C++ objects - -It is also possible to wrap C++ objects/classes in a way that allows new -instances to be created using the JavaScript `new` operator: - -```cpp -// addon.cc -#include -#include "myobject.h" - -namespace demo { - -using v8::Local; -using v8::Object; - -void InitAll(Local exports) { - MyObject::Init(exports); -} - -NODE_MODULE(addon, InitAll) - -} // namespace demo -``` - -Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: - -```cpp -// myobject.h -#ifndef MYOBJECT_H -#define MYOBJECT_H - -#include -#include - -namespace demo { - -class MyObject : public node::ObjectWrap { - public: - static void Init(v8::Local exports); - - private: - explicit MyObject(double value = 0); - ~MyObject(); - - static void New(const v8::FunctionCallbackInfo& args); - static void PlusOne(const v8::FunctionCallbackInfo& args); - static v8::Persistent constructor; - double value_; -}; - -} // namespace demo - -#endif -``` - -In `myobject.cc`, implement the various methods that are to be exposed. -Below, the method `plusOne()` is exposed by adding it to the constructor's -prototype: - -```cpp -// myobject.cc -#include "myobject.h" - -namespace demo { - -using v8::Function; -using v8::FunctionCallbackInfo; -using v8::FunctionTemplate; -using v8::Isolate; -using v8::Local; -using v8::Number; -using v8::Object; -using v8::Persistent; -using v8::String; -using v8::Value; - -Persistent MyObject::constructor; - -MyObject::MyObject(double value) : value_(value) { -} - -MyObject::~MyObject() { -} - -void MyObject::Init(Local exports) { - Isolate* isolate = exports->GetIsolate(); - - // Prepare constructor template - Local tpl = FunctionTemplate::New(isolate, New); - tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - // Prototype - NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); - - constructor.Reset(isolate, tpl->GetFunction()); - exports->Set(String::NewFromUtf8(isolate, "MyObject"), - tpl->GetFunction()); -} - -void MyObject::New(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - if (args.IsConstructCall()) { - // Invoked as constructor: `new MyObject(...)` - double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); - MyObject* obj = new MyObject(value); - obj->Wrap(args.This()); - args.GetReturnValue().Set(args.This()); - } else { - // Invoked as plain function `MyObject(...)`, turn into construct call. - const int argc = 1; - Local argv[argc] = { args[0] }; - Local cons = Local::New(isolate, constructor); - args.GetReturnValue().Set(cons->NewInstance(argc, argv)); - } -} - -void MyObject::PlusOne(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - MyObject* obj = ObjectWrap::Unwrap(args.Holder()); - obj->value_ += 1; - - args.GetReturnValue().Set(Number::New(isolate, obj->value_)); -} - -} // namespace demo -``` - -To build this example, the `myobject.cc` file must be added to the -`binding.gyp`: - -``` -{ - "targets": [ - { - "target_name": "addon", - "sources": [ - "addon.cc", - "myobject.cc" - ] - } - ] -} -``` - -Test it with: - -```js -// test.js -const addon = require('./build/Release/addon'); - -var obj = new addon.MyObject(10); -console.log(obj.plusOne()); // 11 -console.log(obj.plusOne()); // 12 -console.log(obj.plusOne()); // 13 -``` - -### Factory of wrapped objects - -Alternatively, it is possible to use a factory pattern to avoid explicitly -creating object instances using the JavaScript `new` operator: - -```js -var obj = addon.createObject(); -// instead of: -// var obj = new addon.Object(); -``` - -First, the `createObject()` method is implemented in `addon.cc`: - -```cpp -// addon.cc -#include -#include "myobject.h" - -namespace demo { - -using v8::FunctionCallbackInfo; -using v8::Isolate; -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - -void CreateObject(const FunctionCallbackInfo& args) { - MyObject::NewInstance(args); -} - -void InitAll(Local exports, Local module) { - MyObject::Init(exports->GetIsolate()); - - NODE_SET_METHOD(module, "exports", CreateObject); -} - -NODE_MODULE(addon, InitAll) - -} // namespace demo -``` - -In `myobject.h`, the static method `NewInstance()` is added to handle -instantiating the object. This method takes the place of using `new` in -JavaScript: - -```cpp -// myobject.h -#ifndef MYOBJECT_H -#define MYOBJECT_H - -#include -#include - -namespace demo { - -class MyObject : public node::ObjectWrap { - public: - static void Init(v8::Isolate* isolate); - static void NewInstance(const v8::FunctionCallbackInfo& args); - - private: - explicit MyObject(double value = 0); - ~MyObject(); - - static void New(const v8::FunctionCallbackInfo& args); - static void PlusOne(const v8::FunctionCallbackInfo& args); - static v8::Persistent constructor; - double value_; -}; - -} // namespace demo - -#endif -``` - -The implementation in `myobject.cc` is similar to the previous example: - -```cpp -// myobject.cc -#include -#include "myobject.h" - -namespace demo { - -using v8::Function; -using v8::FunctionCallbackInfo; -using v8::FunctionTemplate; -using v8::Isolate; -using v8::Local; -using v8::Number; -using v8::Object; -using v8::Persistent; -using v8::String; -using v8::Value; - -Persistent MyObject::constructor; - -MyObject::MyObject(double value) : value_(value) { -} - -MyObject::~MyObject() { -} - -void MyObject::Init(Isolate* isolate) { - // Prepare constructor template - Local tpl = FunctionTemplate::New(isolate, New); - tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - // Prototype - NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); - - constructor.Reset(isolate, tpl->GetFunction()); -} - -void MyObject::New(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - if (args.IsConstructCall()) { - // Invoked as constructor: `new MyObject(...)` - double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); - MyObject* obj = new MyObject(value); - obj->Wrap(args.This()); - args.GetReturnValue().Set(args.This()); - } else { - // Invoked as plain function `MyObject(...)`, turn into construct call. - const int argc = 1; - Local argv[argc] = { args[0] }; - Local cons = Local::New(isolate, constructor); - args.GetReturnValue().Set(cons->NewInstance(argc, argv)); - } -} - -void MyObject::NewInstance(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - const unsigned argc = 1; - Local argv[argc] = { args[0] }; - Local cons = Local::New(isolate, constructor); - Local instance = cons->NewInstance(argc, argv); - - args.GetReturnValue().Set(instance); -} - -void MyObject::PlusOne(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - MyObject* obj = ObjectWrap::Unwrap(args.Holder()); - obj->value_ += 1; - - args.GetReturnValue().Set(Number::New(isolate, obj->value_)); -} - -} // namespace demo -``` - -Once again, to build this example, the `myobject.cc` file must be added to the -`binding.gyp`: - -``` -{ - "targets": [ - { - "target_name": "addon", - "sources": [ - "addon.cc", - "myobject.cc" - ] - } - ] -} -``` - -Test it with: - -```js -// test.js -const createObject = require('./build/Release/addon'); - -var obj = createObject(10); -console.log(obj.plusOne()); // 11 -console.log(obj.plusOne()); // 12 -console.log(obj.plusOne()); // 13 - -var obj2 = createObject(20); -console.log(obj2.plusOne()); // 21 -console.log(obj2.plusOne()); // 22 -console.log(obj2.plusOne()); // 23 -``` - - -### Passing wrapped objects around - -In addition to wrapping and returning C++ objects, it is possible to pass -wrapped objects around by unwrapping them with the Node.js helper function -`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` -that can take two `MyObject` objects as input arguments: - -```cpp -// addon.cc -#include -#include -#include "myobject.h" - -namespace demo { - -using v8::FunctionCallbackInfo; -using v8::Isolate; -using v8::Local; -using v8::Number; -using v8::Object; -using v8::String; -using v8::Value; - -void CreateObject(const FunctionCallbackInfo& args) { - MyObject::NewInstance(args); -} - -void Add(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - MyObject* obj1 = node::ObjectWrap::Unwrap( - args[0]->ToObject()); - MyObject* obj2 = node::ObjectWrap::Unwrap( - args[1]->ToObject()); - - double sum = obj1->value() + obj2->value(); - args.GetReturnValue().Set(Number::New(isolate, sum)); -} - -void InitAll(Local exports) { - MyObject::Init(exports->GetIsolate()); - - NODE_SET_METHOD(exports, "createObject", CreateObject); - NODE_SET_METHOD(exports, "add", Add); -} - -NODE_MODULE(addon, InitAll) - -} // namespace demo -``` - -In `myobject.h`, a new public method is added to allow access to private values -after unwrapping the object. - -```cpp -// myobject.h -#ifndef MYOBJECT_H -#define MYOBJECT_H - -#include -#include - -namespace demo { - -class MyObject : public node::ObjectWrap { - public: - static void Init(v8::Isolate* isolate); - static void NewInstance(const v8::FunctionCallbackInfo& args); - inline double value() const { return value_; } - - private: - explicit MyObject(double value = 0); - ~MyObject(); - - static void New(const v8::FunctionCallbackInfo& args); - static v8::Persistent constructor; - double value_; -}; - -} // namespace demo - -#endif -``` - -The implementation of `myobject.cc` is similar to before: - -```cpp -// myobject.cc -#include -#include "myobject.h" - -namespace demo { - -using v8::Function; -using v8::FunctionCallbackInfo; -using v8::FunctionTemplate; -using v8::Isolate; -using v8::Local; -using v8::Object; -using v8::Persistent; -using v8::String; -using v8::Value; - -Persistent MyObject::constructor; - -MyObject::MyObject(double value) : value_(value) { -} - -MyObject::~MyObject() { -} - -void MyObject::Init(Isolate* isolate) { - // Prepare constructor template - Local tpl = FunctionTemplate::New(isolate, New); - tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - constructor.Reset(isolate, tpl->GetFunction()); -} - -void MyObject::New(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - if (args.IsConstructCall()) { - // Invoked as constructor: `new MyObject(...)` - double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); - MyObject* obj = new MyObject(value); - obj->Wrap(args.This()); - args.GetReturnValue().Set(args.This()); - } else { - // Invoked as plain function `MyObject(...)`, turn into construct call. - const int argc = 1; - Local argv[argc] = { args[0] }; - Local cons = Local::New(isolate, constructor); - args.GetReturnValue().Set(cons->NewInstance(argc, argv)); - } -} - -void MyObject::NewInstance(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); - - const unsigned argc = 1; - Local argv[argc] = { args[0] }; - Local cons = Local::New(isolate, constructor); - Local instance = cons->NewInstance(argc, argv); - - args.GetReturnValue().Set(instance); -} - -} // namespace demo -``` - -Test it with: - -```js -// test.js -const addon = require('./build/Release/addon'); - -var obj1 = addon.createObject(10); -var obj2 = addon.createObject(20); -var result = addon.add(obj1, obj2); - -console.log(result); // 30 -``` - -### AtExit hooks - -An "AtExit" hook is a function that is invoked after the Node.js event loop -has ended by before the JavaScript VM is terminated and Node.js shuts down. -"AtExit" hooks are registered using the `node::AtExit` API. - -#### void AtExit(callback, args) - -* `callback`: `void (*)(void*)` - A pointer to the function to call at exit. -* `args`: `void*` - A pointer to pass to the callback at exit. - -Registers exit hooks that run after the event loop has ended but before the VM -is killed. - -AtExit takes two parameters: a pointer to a callback function to run at exit, -and a pointer to untyped context data to be passed to that callback. - -Callbacks are run in last-in first-out order. - -The following `addon.cc` implements AtExit: - -```cpp -// addon.cc -#undef NDEBUG -#include -#include -#include - -namespace demo { - -using node::AtExit; -using v8::HandleScope; -using v8::Isolate; -using v8::Local; -using v8::Object; - -static char cookie[] = "yum yum"; -static int at_exit_cb1_called = 0; -static int at_exit_cb2_called = 0; - -static void at_exit_cb1(void* arg) { - Isolate* isolate = static_cast(arg); - HandleScope scope(isolate); - Local obj = Object::New(isolate); - assert(!obj.IsEmpty()); // assert VM is still alive - assert(obj->IsObject()); - at_exit_cb1_called++; -} - -static void at_exit_cb2(void* arg) { - assert(arg == static_cast(cookie)); - at_exit_cb2_called++; -} - -static void sanity_check(void*) { - assert(at_exit_cb1_called == 1); - assert(at_exit_cb2_called == 2); -} - -void init(Local exports) { - AtExit(sanity_check); - AtExit(at_exit_cb2, cookie); - AtExit(at_exit_cb2, cookie); - AtExit(at_exit_cb1, exports->GetIsolate()); -} - -NODE_MODULE(addon, init); - -} // namespace demo -``` - -Test in JavaScript by running: - -```js -// test.js -const addon = require('./build/Release/addon'); -``` - -[bindings]: https://github.com/TooTallNate/node-bindings -[download]: https://github.com/nodejs/node-addon-examples -[Embedder's Guide]: https://developers.google.com/v8/embed -[examples]: https://github.com/nodejs/nan/tree/master/examples/ -[installation instructions]: https://github.com/nodejs/node-gyp#installation -[libuv]: https://github.com/libuv/libuv -[Linking to Node.js' own dependencies]: #linking-to-nodejs-own-dependencies -[Native Abstractions for Node.js]: https://github.com/nodejs/nan -[node-gyp]: https://github.com/nodejs/node-gyp -[require]: globals.html#globals_require -[v8-docs]: https://v8docs.nodesource.com/ diff --git a/doc/api/addons.md b/doc/api/addons.md new file mode 100644 index 00000000000000..4668bc546f26d7 --- /dev/null +++ b/doc/api/addons.md @@ -0,0 +1,1091 @@ +# Addons + +Node.js Addons are dynamically-linked shared objects, written in C or C++, that +can be loaded into Node.js using the [`require()`][require] function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs : + + - V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online][v8-docs]. + + - [libuv][]: The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. + + - Internal Node.js libraries. Node.js itself exports a number of C/C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. + + - Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the V8 and OpenSSL symbols are purposefully + re-exported by Node.js and may be used to various extents by Addons. + See [Linking to Node.js' own dependencies][] for additional information. + +All of the following examples are available for [download][] and may +be used as a starting-point for your own Addon. + +## Hello world + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```js +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```cpp +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(addon, init) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```cpp +void Initialize(Local exports); +NODE_MODULE(module_name, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the .node suffix). + +In the `hello.cc` example, then, the initialization function is `init` and the +Addon module name is `addon`. + +### Building + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of your module +using a JSON-like format. This file is used by [node-gyp][] -- a tool written +specifically to compile Node.js Addons. + +``` +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +*Note: A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions][] for +more information, including platform-specific requirements.* + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`][require] to the built `addon.node` module: + +```js +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); // 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings][] package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```js +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js +and download either the full source tarball or just the headers. If the full +source is downloaded, Addons will have complete access to the full set of +Node.js dependencies. However, if only the Node.js headers are downloaded, then +only the symbols exported by Node.js will be available. + +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js +source image. Using this option, the Addon will have access to the full set of +dependencies. + +### Loading Addons using require() + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`][require] function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`][require], the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`][require] will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js][] (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples][] for an +illustration of how it can be used. + +## Addon examples + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference][v8-docs] +for help with the various V8 calls, and V8's [Embedder's Guide][] for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +``` +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array. For example: + +``` +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +``` +$ node-gyp configure build +``` + + +### Function arguments + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```cpp +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + // Perform the operation + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```js +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + + +### Callbacks + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```cpp +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(Null(isolate), argc, argv); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```js +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); // 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```cpp +// addon.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```js +// test.js +const addon = require('./build/Release/addon'); + +var obj1 = addon('hello'); +var obj2 = addon('world'); +console.log(obj1.msg + ' ' + obj2.msg); // 'hello world' +``` + + +### Function factory + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```cpp +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test: + +```js +// test.js +const addon = require('./build/Release/addon'); + +var fn = addon(); +console.log(fn()); // 'hello world' +``` + + +### Wrapping C++ objects + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```cpp +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```cpp +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```cpp +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +``` +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```js +// test.js +const addon = require('./build/Release/addon'); + +var obj = new addon.MyObject(10); +console.log(obj.plusOne()); // 11 +console.log(obj.plusOne()); // 12 +console.log(obj.plusOne()); // 13 +``` + +### Factory of wrapped objects + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```js +var obj = addon.createObject(); +// instead of: +// var obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```cpp +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```cpp +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```cpp +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = cons->NewInstance(argc, argv); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +``` +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```js +// test.js +const createObject = require('./build/Release/addon'); + +var obj = createObject(10); +console.log(obj.plusOne()); // 11 +console.log(obj.plusOne()); // 12 +console.log(obj.plusOne()); // 13 + +var obj2 = createObject(20); +console.log(obj2.plusOne()); // 21 +console.log(obj2.plusOne()); // 22 +console.log(obj2.plusOne()); // 23 +``` + + +### Passing wrapped objects around + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```cpp +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```cpp +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```cpp +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = cons->NewInstance(argc, argv); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```js +// test.js +const addon = require('./build/Release/addon'); + +var obj1 = addon.createObject(10); +var obj2 = addon.createObject(20); +var result = addon.add(obj1, obj2); + +console.log(result); // 30 +``` + +### AtExit hooks + +An "AtExit" hook is a function that is invoked after the Node.js event loop +has ended by before the JavaScript VM is terminated and Node.js shuts down. +"AtExit" hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args) + +* `callback`: `void (*)(void*)` - A pointer to the function to call at exit. +* `args`: `void*` - A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +AtExit takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements AtExit: + +```cpp +// addon.cc +#undef NDEBUG +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(sanity_check); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); +} + +NODE_MODULE(addon, init); + +} // namespace demo +``` + +Test in JavaScript by running: + +```js +// test.js +const addon = require('./build/Release/addon'); +``` + +[bindings]: https://github.com/TooTallNate/node-bindings +[download]: https://github.com/nodejs/node-addon-examples +[Embedder's Guide]: https://developers.google.com/v8/embed +[examples]: https://github.com/nodejs/nan/tree/master/examples/ +[installation instructions]: https://github.com/nodejs/node-gyp#installation +[libuv]: https://github.com/libuv/libuv +[Linking to Node.js' own dependencies]: #addons_linking_to_node_js_own_dependencies +[Native Abstractions for Node.js]: https://github.com/nodejs/nan +[node-gyp]: https://github.com/nodejs/node-gyp +[require]: globals.html#globals_require +[v8-docs]: https://v8docs.nodesource.com/ diff --git a/doc/api/all.markdown b/doc/api/all.md similarity index 100% rename from doc/api/all.markdown rename to doc/api/all.md diff --git a/doc/api/assert.markdown b/doc/api/assert.md similarity index 100% rename from doc/api/assert.markdown rename to doc/api/assert.md diff --git a/doc/api/buffer.markdown b/doc/api/buffer.markdown deleted file mode 100644 index a5251fe7ee3be8..00000000000000 --- a/doc/api/buffer.markdown +++ /dev/null @@ -1,1767 +0,0 @@ -# Buffer - - Stability: 2 - Stable - -Prior to the introduction of `TypedArray` in ECMAScript 2015 (ES6), the -JavaScript language had no mechanism for reading or manipulating streams -of binary data. The `Buffer` class was introduced as part of the Node.js -API to make it possible to interact with octet streams in the context of things -like TCP streams and file system operations. - -Now that `TypedArray` has been added in ES6, the `Buffer` class implements the -`Uint8Array` API in a manner that is more optimized and suitable for Node.js' -use cases. - -Instances of the `Buffer` class are similar to arrays of integers but -correspond to fixed-sized, raw memory allocations outside the V8 heap. -The size of the `Buffer` is established when it is created and cannot be -resized. - -The `Buffer` class is a global within Node.js, making it unlikely that one -would need to ever use `require('buffer')`. - - -```js -const buf1 = Buffer.alloc(10); - // Creates a zero-filled Buffer of length 10. - -const buf2 = Buffer.alloc(10, 1); - // Creates a Buffer of length 10, filled with 0x01. - -const buf3 = Buffer.allocUnsafe(10); - // Creates an uninitialized buffer of length 10. - // This is faster than calling Buffer.alloc() but the returned - // Buffer instance might contain old data that needs to be - // overwritten using either fill() or write(). - -const buf4 = Buffer.from([1,2,3]); - // Creates a Buffer containing [01, 02, 03]. - -const buf5 = Buffer.from('test'); - // Creates a Buffer containing ASCII bytes [74, 65, 73, 74]. - -const buf6 = Buffer.from('tést', 'utf8'); - // Creates a Buffer containing UTF8 bytes [74, c3, a9, 73, 74]. -``` - -## `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` - -Historically, `Buffer` instances have been created using the `Buffer` -constructor function, which allocates the returned `Buffer` -differently based on what arguments are provided: - -* Passing a number as the first argument to `Buffer()` (e.g. `new Buffer(10)`), - allocates a new `Buffer` object of the specified size. The memory allocated - for such `Buffer` instances is *not* initialized and *can contain sensitive - data*. Such `Buffer` objects *must* be initialized *manually* by using either - [`buf.fill(0)`][] or by writing to the `Buffer` completely. While this - behavior is *intentional* to improve performance, development experience has - demonstrated that a more explicit distinction is required between creating a - fast-but-uninitialized `Buffer` versus creating a slower-but-safer `Buffer`. -* Passing a string, array, or `Buffer` as the first argument copies the - passed object's data into the `Buffer`. -* Passing an `ArrayBuffer` returns a `Buffer` that shares allocated memory with - the given `ArrayBuffer`. - -Because the behavior of `new Buffer()` changes significantly based on the type -of value passed as the first argument, applications that do not properly -validate the input arguments passed to `new Buffer()`, or that fail to -appropriately initialize newly allocated `Buffer` content, can inadvertently -introduce security and reliability issues into their code. - -To make the creation of `Buffer` objects more reliable and less error prone, -new `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` methods have -been introduced as an alternative means of creating `Buffer` instances. - -*Developers should migrate all existing uses of the `new Buffer()` constructors -to one of these new APIs.* - -* [`Buffer.from(array)`][buffer_from_array] returns a new `Buffer` containing - a *copy* of the provided octets. -* [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][buffer_from_arraybuf] - returns a new `Buffer` that *shares* the same allocated memory as the given - `ArrayBuffer`. -* [`Buffer.from(buffer)`][buffer_from_buffer] returns a new `Buffer` - containing a *copy* of the contents of the given `Buffer`. -* [`Buffer.from(str[, encoding])`][buffer_from_string] returns a new `Buffer` - containing a *copy* of the provided string. -* [`Buffer.alloc(size[, fill[, encoding]])`][buffer_alloc] returns a "filled" - `Buffer` instance of the specified size. This method can be significantly - slower than [`Buffer.allocUnsafe(size)`][buffer_allocunsafe] but ensures that - newly created `Buffer` instances never contain old and potentially sensitive - data. -* [`Buffer.allocUnsafe(size)`][buffer_allocunsafe] returns a new `Buffer` of - the specified `size` whose content *must* be initialized using either - [`buf.fill(0)`][] or written to completely. - -`Buffer` instances returned by `Buffer.allocUnsafe(size)` *may* be allocated -off a shared internal memory pool if the `size` is less than or equal to half -`Buffer.poolSize`. - -### What makes `Buffer.allocUnsafe(size)` "unsafe"? - -When calling `Buffer.allocUnsafe()`, the segment of allocated memory is -*uninitialized* (it is not zeroed-out). While this design makes the allocation -of memory quite fast, the allocated segment of memory might contain old data -that is potentially sensitive. Using a `Buffer` created by -`Buffer.allocUnsafe(size)` without *completely* overwriting the memory can -allow this old data to be leaked when the `Buffer` memory is read. - -While there are clear performance advantages to using `Buffer.allocUnsafe()`, -extra care *must* be taken in order to avoid introducing security -vulnerabilities into an application. - -## Buffers and Character Encodings - -Buffers are commonly used to represent sequences of encoded characters -such as UTF8, UCS2, Base64 or even Hex-encoded data. It is possible to -convert back and forth between Buffers and ordinary JavaScript string objects -by using an explicit encoding method. - -```js -const buf = Buffer.from('hello world', 'ascii'); -console.log(buf.toString('hex')); - // prints: 68656c6c6f20776f726c64 -console.log(buf.toString('base64')); - // prints: aGVsbG8gd29ybGQ= -``` - -The character encodings currently supported by Node.js include: - -* `'ascii'` - for 7-bit ASCII data only. This encoding method is very fast and - will strip the high bit if set. - -* `'utf8'` - Multibyte encoded Unicode characters. Many web pages and other - document formats use UTF-8. - -* `'utf16le'` - 2 or 4 bytes, little-endian encoded Unicode characters. - Surrogate pairs (U+10000 to U+10FFFF) are supported. - -* `'ucs2'` - Alias of `'utf16le'`. - -* `'base64'` - Base64 string encoding. When creating a buffer from a string, - this encoding will also correctly accept "URL and Filename Safe Alphabet" as - specified in [RFC 4648, Section 5]. - -* `'binary'` - A way of encoding the buffer into a one-byte (`latin-1`) - encoded string. The string `'latin-1'` is not supported. Instead, pass - `'binary'` to use `'latin-1'` encoding. - -* `'hex'` - Encode each byte as two hexadecimal characters. - -## Buffers and TypedArray - -Buffers are also `Uint8Array` TypedArray instances. However, there are subtle -incompatibilities with the TypedArray specification in ECMAScript 2015. For -instance, while `ArrayBuffer#slice()` creates a copy of the slice, -the implementation of [`Buffer#slice()`][`buf.slice()`] creates a view over the -existing Buffer without copying, making `Buffer#slice()` far more efficient. - -It is also possible to create new TypedArray instances from a `Buffer` with the -following caveats: - -1. The `Buffer` object's memory is copied to the TypedArray, not shared. - -2. The `Buffer` object's memory is interpreted as an array of distinct - elements, and not as a byte array of the target type. That is, - `new Uint32Array(Buffer.from([1,2,3,4]))` creates a 4-element `Uint32Array` - with elements `[1,2,3,4]`, not a `Uint32Array` with a single element - `[0x1020304]` or `[0x4030201]`. - -It is possible to create a new `Buffer` that shares the same allocated memory as -a TypedArray instance by using the TypeArray object's `.buffer` property: - -```js -const arr = new Uint16Array(2); -arr[0] = 5000; -arr[1] = 4000; - -const buf1 = Buffer.from(arr); // copies the buffer -const buf2 = Buffer.from(arr.buffer); // shares the memory with arr; - -console.log(buf1); - // Prints: , copied buffer has only two elements -console.log(buf2); - // Prints: - -arr[1] = 6000; -console.log(buf1); - // Prints: -console.log(buf2); - // Prints: -``` - -Note that when creating a `Buffer` using the TypedArray's `.buffer`, it is -possible to use only a portion of the underlying `ArrayBuffer` by passing in -`byteOffset` and `length` parameters: - -```js -const arr = new Uint16Array(20); -const buf = Buffer.from(arr.buffer, 0, 16); -console.log(buf.length); - // Prints: 16 -``` - -The `Buffer.from()` and [`TypedArray.from()`][] (e.g.`Uint8Array.from()`) have -different signatures and implementations. Specifically, the TypedArray variants -accept a second argument that is a mapping function that is invoked on every -element of the typed array: - -* `TypedArray.from(source[, mapFn[, thisArg]])` - -The `Buffer.from()` method, however, does not support the use of a mapping -function: - -* [`Buffer.from(array)`][buffer_from_array] -* [`Buffer.from(buffer)`][buffer_from_buffer] -* [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][buffer_from_arraybuf] -* [`Buffer.from(str[, encoding])`][buffer_from_string] - -## Buffers and ES6 iteration - -Buffers can be iterated over using the ECMAScript 2015 (ES6) `for..of` syntax: - -```js -const buf = Buffer(.from[1, 2, 3]); - -for (var b of buf) - console.log(b) - -// Prints: -// 1 -// 2 -// 3 -``` - -Additionally, the [`buf.values()`][], [`buf.keys()`][], and -[`buf.entries()`][] methods can be used to create iterators. - -## The `--zero-fill-buffers` command line option - -Node.js can be started using the `--zero-fill-buffers` command line option to -force all newly allocated `Buffer` and `SlowBuffer` instances created using -either `new Buffer(size)` and `new SlowBuffer(size)` to be *automatically -zero-filled* upon creation. Use of this flag *changes the default behavior* of -these methods and *can have a significant impact* on performance. Use of the -`--zero-fill-buffers` option is recommended only when absolutely necessary to -enforce that newly allocated `Buffer` instances cannot contain potentially -sensitive data. - -``` -$ node --zero-fill-buffers -> Buffer(5); - -``` - -## Class: Buffer - -The Buffer class is a global type for dealing with binary data directly. -It can be constructed in a variety of ways. - -### new Buffer(array) - -* `array` {Array} - -Allocates a new Buffer using an `array` of octets. - -```js -const buf = new Buffer([0x62,0x75,0x66,0x66,0x65,0x72]); - // creates a new Buffer containing ASCII bytes - // ['b','u','f','f','e','r'] -``` - -### new Buffer(buffer) - -* `buffer` {Buffer} - -Copies the passed `buffer` data onto a new `Buffer` instance. - -```js -const buf1 = new Buffer('buffer'); -const buf2 = new Buffer(buf1); - -buf1[0] = 0x61; -console.log(buf1.toString()); - // 'auffer' -console.log(buf2.toString()); - // 'buffer' (copy is not changed) -``` - -### new Buffer(arrayBuffer[, byteOffset[, length]]) - -* `arrayBuffer` - The `.buffer` property of a `TypedArray` or a `new - ArrayBuffer()` -* `byteOffset` {Number} Default: `0` -* `length` {Number} Default: `arrayBuffer.length - byteOffset` - -When passed a reference to the `.buffer` property of a `TypedArray` instance, -the newly created Buffer will share the same allocated memory as the -TypedArray. - -The optional `byteOffset` and `length` arguments specify a memory range within -the `arrayBuffer` that will be shared by the `Buffer`. - -```js -const arr = new Uint16Array(2); -arr[0] = 5000; -arr[1] = 4000; - -const buf = new Buffer(arr.buffer); // shares the memory with arr; - -console.log(buf); - // Prints: - -// changing the TypdArray changes the Buffer also -arr[1] = 6000; - -console.log(buf); - // Prints: -``` - -### new Buffer(size) - -* `size` {Number} - -Allocates a new `Buffer` of `size` bytes. The `size` must be less than -or equal to the value of `require('buffer').kMaxLength` (on 64-bit -architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is -thrown. If a `size` less than 0 is specified, a zero-length Buffer will be -created. - -Unlike `ArrayBuffers`, the underlying memory for `Buffer` instances created in -this way is *not initialized*. The contents of a newly created `Buffer` are -unknown and *could contain sensitive data*. Use [`buf.fill(0)`][] to initialize -a Buffer to zeroes. - -```js -const buf = new Buffer(5); -console.log(buf); - // - // (octets will be different, every time) -buf.fill(0); -console.log(buf); - // -``` - -### new Buffer(str[, encoding]) - -* `str` {String} String to encode. -* `encoding` {String} Default: `'utf8'` - -Creates a new Buffer containing the given JavaScript string `str`. If -provided, the `encoding` parameter identifies the strings character encoding. - -```js -const buf1 = new Buffer('this is a tést'); -console.log(buf1.toString()); - // prints: this is a tést -console.log(buf1.toString('ascii')); - // prints: this is a tC)st - -const buf2 = new Buffer('7468697320697320612074c3a97374', 'hex'); -console.log(buf2.toString()); - // prints: this is a tést -``` - -### Class Method: Buffer.alloc(size[, fill[, encoding]]) - -* `size` {Number} -* `fill` {Value} Default: `undefined` -* `encoding` {String} Default: `utf8` - -Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the -`Buffer` will be *zero-filled*. - -```js -const buf = Buffer.alloc(5); -console.log(buf); - // -``` - -The `size` must be less than or equal to the value of -`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is -`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. If a `size` less than 0 -is specified, a zero-length `Buffer` will be created. - -If `fill` is specified, the allocated `Buffer` will be initialized by calling -`buf.fill(fill)`. See [`buf.fill()`][] for more information. - -```js -const buf = Buffer.alloc(5, 'a'); -console.log(buf); - // -``` - -If both `fill` and `encoding` are specified, the allocated `Buffer` will be -initialized by calling `buf.fill(fill, encoding)`. For example: - -```js -const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); -console.log(buf); - // -``` - -Calling `Buffer.alloc(size)` can be significantly slower than the alternative -`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance -contents will *never contain sensitive data*. - -A `TypeError` will be thrown if `size` is not a number. - -### Class Method: Buffer.allocUnsafe(size) - -* `size` {Number} - -Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must -be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit -architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is -thrown. If a `size` less than 0 is specified, a zero-length `Buffer` will be -created. - -The underlying memory for `Buffer` instances created in this way is *not -initialized*. The contents of the newly created `Buffer` are unknown and -*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such -`Buffer` instances to zeroes. - -```js -const buf = Buffer.allocUnsafe(5); -console.log(buf); - // - // (octets will be different, every time) -buf.fill(0); -console.log(buf); - // -``` - -A `TypeError` will be thrown if `size` is not a number. - -Note that the `Buffer` module pre-allocates an internal `Buffer` instance of -size `Buffer.poolSize` that is used as a pool for the fast allocation of new -`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the -`new Buffer(size)` constructor) only when `size` is less than or equal to -`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default -value of `Buffer.poolSize` is `8192` but can be modified. - -Use of this pre-allocated internal memory pool is a key difference between -calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. -Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer -pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal -Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The -difference is subtle but can be important when an application requires the -additional performance that `Buffer.allocUnsafe(size)` provides. - -### Class Method: Buffer.byteLength(string[, encoding]) - -* `string` {String | Buffer | TypedArray | DataView | ArrayBuffer} -* `encoding` {String} Default: `'utf8'` -* Return: {Number} - -Returns the actual byte length of a string. This is not the same as -[`String.prototype.length`][] since that returns the number of *characters* in -a string. - -Example: - -```js -const str = '\u00bd + \u00bc = \u00be'; - -console.log(`${str}: ${str.length} characters, ` + - `${Buffer.byteLength(str, 'utf8')} bytes`); - -// ½ + ¼ = ¾: 9 characters, 12 bytes -``` - -When `string` is a `Buffer`/[`DataView`][]/[`TypedArray`][]/`ArrayBuffer`, -returns the actual byte length. - -Otherwise, converts to `String` and returns the byte length of string. - -### Class Method: Buffer.compare(buf1, buf2) - -* `buf1` {Buffer} -* `buf2` {Buffer} -* Return: {Number} - -Compares `buf1` to `buf2` typically for the purpose of sorting arrays of -Buffers. This is equivalent is calling [`buf1.compare(buf2)`][]. - -```js -const arr = [Buffer.from('1234'), Buffer.from('0123')]; -arr.sort(Buffer.compare); -``` - -### Class Method: Buffer.concat(list[, totalLength]) - -* `list` {Array} List of Buffer objects to concat -* `totalLength` {Number} Total length of the Buffers in the list when concatenated -* Return: {Buffer} - -Returns a new Buffer which is the result of concatenating all the Buffers in -the `list` together. - -If the list has no items, or if the `totalLength` is 0, then a new zero-length -Buffer is returned. - -If `totalLength` is not provided, it is calculated from the Buffers in the -`list`. This, however, adds an additional loop to the function, so it is faster -to provide the length explicitly. - -Example: build a single Buffer from a list of three Buffers: - -```js -const buf1 = Buffer.alloc(10, 0); -const buf2 = Buffer.alloc(14, 0); -const buf3 = Buffer.alloc(18, 0); -const totalLength = buf1.length + buf2.length + buf3.length; - -console.log(totalLength); -const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); -console.log(bufA); -console.log(bufA.length); - -// 42 -// -// 42 -``` - -### Class Method: Buffer.from(array) - -* `array` {Array} - -Allocates a new `Buffer` using an `array` of octets. - -```js -const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); - // creates a new Buffer containing ASCII bytes - // ['b','u','f','f','e','r'] -``` - -A `TypeError` will be thrown if `array` is not an `Array`. - -### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) - -* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or - a `new ArrayBuffer()` -* `byteOffset` {Number} Default: `0` -* `length` {Number} Default: `arrayBuffer.length - byteOffset` - -When passed a reference to the `.buffer` property of a `TypedArray` instance, -the newly created `Buffer` will share the same allocated memory as the -TypedArray. - -```js -const arr = new Uint16Array(2); -arr[0] = 5000; -arr[1] = 4000; - -const buf = Buffer.from(arr.buffer); // shares the memory with arr; - -console.log(buf); - // Prints: - -// changing the TypedArray changes the Buffer also -arr[1] = 6000; - -console.log(buf); - // Prints: -``` - -The optional `byteOffset` and `length` arguments specify a memory range within -the `arrayBuffer` that will be shared by the `Buffer`. - -```js -const ab = new ArrayBuffer(10); -const buf = Buffer.from(ab, 0, 2); -console.log(buf.length); - // Prints: 2 -``` - -A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. - -### Class Method: Buffer.from(buffer) - -* `buffer` {Buffer} - -Copies the passed `buffer` data onto a new `Buffer` instance. - -```js -const buf1 = Buffer.from('buffer'); -const buf2 = Buffer.from(buf1); - -buf1[0] = 0x61; -console.log(buf1.toString()); - // 'auffer' -console.log(buf2.toString()); - // 'buffer' (copy is not changed) -``` - -A `TypeError` will be thrown if `buffer` is not a `Buffer`. - -### Class Method: Buffer.from(str[, encoding]) - -* `str` {String} String to encode. -* `encoding` {String} Encoding to use, Default: `'utf8'` - -Creates a new `Buffer` containing the given JavaScript string `str`. If -provided, the `encoding` parameter identifies the character encoding. -If not provided, `encoding` defaults to `'utf8'`. - -```js -const buf1 = Buffer.from('this is a tést'); -console.log(buf1.toString()); - // prints: this is a tést -console.log(buf1.toString('ascii')); - // prints: this is a tC)st - -const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); -console.log(buf2.toString()); - // prints: this is a tést -``` - -A `TypeError` will be thrown if `str` is not a string. - -### Class Method: Buffer.isBuffer(obj) - -* `obj` {Object} -* Return: {Boolean} - -Returns 'true' if `obj` is a Buffer. - -### Class Method: Buffer.isEncoding(encoding) - -* `encoding` {String} The encoding string to test -* Return: {Boolean} - -Returns true if the `encoding` is a valid encoding argument, or false -otherwise. - -### buf[index] - - - - -The index operator `[index]` can be used to get and set the octet at position -`index` in the Buffer. The values refer to individual bytes, so the legal value -range is between `0x00` and `0xFF` (hex) or `0` and `255` (decimal). - -Example: copy an ASCII string into a Buffer, one byte at a time: - -```js -const str = "Node.js"; -const buf = Buffer.allocUnsafe(str.length); - -for (var i = 0; i < str.length ; i++) { - buf[i] = str.charCodeAt(i); -} - -console.log(buf.toString('ascii')); - // Prints: Node.js -``` - -### buf.compare(otherBuffer) - -* `otherBuffer` {Buffer} -* Return: {Number} - -Compares two Buffer instances and returns a number indicating whether `buf` -comes before, after, or is the same as the `otherBuffer` in sort order. -Comparison is based on the actual sequence of bytes in each Buffer. - -* `0` is returned if `otherBuffer` is the same as `buf` -* `1` is returned if `otherBuffer` should come *before* `buf` when sorted. -* `-1` is returned if `otherBuffer` should come *after* `buf` when sorted. - -```js -const buf1 = Buffer.from('ABC'); -const buf2 = Buffer.from('BCD'); -const buf3 = Buffer.from('ABCD'); - -console.log(buf1.compare(buf1)); - // Prints: 0 -console.log(buf1.compare(buf2)); - // Prints: -1 -console.log(buf1.compare(buf3)); - // Prints: 1 -console.log(buf2.compare(buf1)); - // Prints: 1 -console.log(buf2.compare(buf3)); - // Prints: 1 - -[buf1, buf2, buf3].sort(Buffer.compare); - // produces sort order [buf1, buf3, buf2] -``` - -### buf.copy(targetBuffer[, targetStart[, sourceStart[, sourceEnd]]]) - -* `targetBuffer` {Buffer} Buffer to copy into -* `targetStart` {Number} Default: 0 -* `sourceStart` {Number} Default: 0 -* `sourceEnd` {Number} Default: `buffer.length` -* Return: {Number} The number of bytes copied. - -Copies data from a region of this Buffer to a region in the target Buffer even -if the target memory region overlaps with the source. - -Example: build two Buffers, then copy `buf1` from byte 16 through byte 19 -into `buf2`, starting at the 8th byte in `buf2`. - -```js -const buf1 = Buffer.allocUnsafe(26); -const buf2 = Buffer.allocUnsafe(26).fill('!'); - -for (var i = 0 ; i < 26 ; i++) { - buf1[i] = i + 97; // 97 is ASCII a -} - -buf1.copy(buf2, 8, 16, 20); -console.log(buf2.toString('ascii', 0, 25)); - // Prints: !!!!!!!!qrst!!!!!!!!!!!!! -``` - -Example: Build a single Buffer, then copy data from one region to an overlapping -region in the same Buffer - -```js -const buf = Buffer.allocUnsafe(26); - -for (var i = 0 ; i < 26 ; i++) { - buf[i] = i + 97; // 97 is ASCII a -} - -buf.copy(buf, 0, 4, 10); -console.log(buf.toString()); - -// efghijghijklmnopqrstuvwxyz -``` - -### buf.entries() - -* Return: {Iterator} - -Creates and returns an [iterator][] of `[index, byte]` pairs from the Buffer -contents. - -```js -const buf = Buffer.from('buffer'); -for (var pair of buf.entries()) { - console.log(pair); -} -// prints: -// [0, 98] -// [1, 117] -// [2, 102] -// [3, 102] -// [4, 101] -// [5, 114] -``` - -### buf.equals(otherBuffer) - -* `otherBuffer` {Buffer} -* Return: {Boolean} - -Returns a boolean indicating whether `this` and `otherBuffer` have exactly the -same bytes. - -```js -const buf1 = Buffer.from('ABC'); -const buf2 = Buffer.from('414243', 'hex'); -const buf3 = Buffer.from('ABCD'); - -console.log(buf1.equals(buf2)); - // Prints: true -console.log(buf1.equals(buf3)); - // Prints: false -``` - -### buf.fill(value[, offset[, end]][, encoding]) - -* `value` {String|Buffer|Number} -* `offset` {Number} Default: 0 -* `end` {Number} Default: `buf.length` -* `encoding` {String} Default: `'utf8'` -* Return: {Buffer} - -Fills the Buffer with the specified value. If the `offset` (defaults to `0`) -and `end` (defaults to `buf.length`) are not given the entire buffer will be -filled. The method returns a reference to the Buffer, so calls can be chained. -This is meant as a small simplification to creating a Buffer. Allowing the -creation and fill of the Buffer to be done on a single line: - -```js -const b = Buffer.alloc(50, 'h'); -console.log(b.toString()); - // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -``` - -`encoding` is only relevant if `value` is a string. Otherwise it is ignored. -`value` is coerced to a `uint32` value if it is not a String or Number. - -The `fill()` operation writes bytes into the Buffer dumbly. If the final write -falls in between a multi-byte character then whatever bytes fit into the buffer -are written. - -```js -Buffer.alloc(3, '\u0222'); - // Prints: -``` - -### buf.indexOf(value[, byteOffset][, encoding]) - -* `value` {String|Buffer|Number} -* `byteOffset` {Number} Default: 0 -* `encoding` {String} Default: `'utf8'` -* Return: {Number} - -Operates similar to [`Array#indexOf()`][] in that it returns either the -starting index position of `value` in Buffer or `-1` if the Buffer does not -contain `value`. The `value` can be a String, Buffer or Number. Strings are by -default interpreted as UTF8. Buffers will use the entire Buffer (to compare a -partial Buffer use [`buf.slice()`][]). Numbers can range from 0 to 255. - -```js -const buf = Buffer.from('this is a buffer'); - -buf.indexOf('this'); - // returns 0 -buf.indexOf('is'); - // returns 2 -buf.indexOf(Buffer.from('a buffer')); - // returns 8 -buf.indexOf(97); // ascii for 'a' - // returns 8 -buf.indexOf(Buffer.from('a buffer example')); - // returns -1 -buf.indexOf(Buffer.from('a buffer example').slice(0,8)); - // returns 8 - -const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); - -utf16Buffer.indexOf('\u03a3', 0, 'ucs2'); - // returns 4 -utf16Buffer.indexOf('\u03a3', -4, 'ucs2'); - // returns 6 -``` - -### buf.includes(value[, byteOffset][, encoding]) - -* `value` {String|Buffer|Number} -* `byteOffset` {Number} Default: 0 -* `encoding` {String} Default: `'utf8'` -* Return: {Boolean} - -Operates similar to [`Array#includes()`][]. The `value` can be a String, Buffer -or Number. Strings are interpreted as UTF8 unless overridden with the -`encoding` argument. Buffers will use the entire Buffer (to compare a partial -Buffer use [`buf.slice()`][]). Numbers can range from 0 to 255. - -The `byteOffset` indicates the index in `buf` where searching begins. - -```js -const buf = Buffer.from('this is a buffer'); - -buf.includes('this'); - // returns true -buf.includes('is'); - // returns true -buf.includes(Buffer.from('a buffer')); - // returns true -buf.includes(97); // ascii for 'a' - // returns true -buf.includes(Buffer.from('a buffer example')); - // returns false -buf.includes(Buffer.from('a buffer example').slice(0,8)); - // returns true -buf.includes('this', 4); - // returns false -``` - -### buf.keys() - -* Return: {Iterator} - -Creates and returns an [iterator][] of Buffer keys (indices). - -```js -const buf = Buffer.from('buffer'); -for (var key of buf.keys()) { - console.log(key); -} -// prints: -// 0 -// 1 -// 2 -// 3 -// 4 -// 5 -``` - -### buf.length - -* {Number} - -Returns the amount of memory allocated for the Buffer in number of bytes. Note -that this does not necessarily reflect the amount of usable data within the -Buffer. For instance, in the example below, a Buffer with 1234 bytes is -allocated, but only 11 ASCII bytes are written. - -```js -const buf = Buffer.allocUnsafe(1234); - -console.log(buf.length); - // Prints: 1234 - -buf.write('some string', 0, 'ascii'); -console.log(buf.length); - // Prints: 1234 -``` - -While the `length` property is not immutable, changing the value of `length` -can result in undefined and inconsistent behavior. Applications that wish to -modify the length of a Buffer should therefore treat `length` as read-only and -use [`buf.slice()`][] to create a new Buffer. - -```js -var buf = Buffer.allocUnsafe(10); -buf.write('abcdefghj', 0, 'ascii'); -console.log(buf.length); - // Prints: 10 -buf = buf.slice(0,5); -console.log(buf.length); - // Prints: 5 -``` - -### buf.readDoubleBE(offset[, noAssert]) -### buf.readDoubleLE(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 8` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads a 64-bit double from the Buffer at the specified `offset` with specified -endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns -little endian). - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -```js -const buf = Buffer.from([1,2,3,4,5,6,7,8]); - -buf.readDoubleBE(); - // Returns: 8.20788039913184e-304 -buf.readDoubleLE(); - // Returns: 5.447603722011605e-270 -buf.readDoubleLE(1); - // throws RangeError: Index out of range - -buf.readDoubleLE(1, true); // Warning: reads passed end of buffer! - // Segmentation fault! don't do this! -``` - -### buf.readFloatBE(offset[, noAssert]) -### buf.readFloatLE(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads a 32-bit float from the Buffer at the specified `offset` with specified -endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns -little endian). - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -```js -const buf = Buffer.from([1,2,3,4]); - -buf.readFloatBE(); - // Returns: 2.387939260590663e-38 -buf.readFloatLE(); - // Returns: 1.539989614439558e-36 -buf.readFloatLE(1); - // throws RangeError: Index out of range - -buf.readFloatLE(1, true); // Warning: reads passed end of buffer! - // Segmentation fault! don't do this! -``` - -### buf.readInt8(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads a signed 8-bit integer from the Buffer at the specified `offset`. - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -Integers read from the Buffer are interpreted as two's complement signed values. - -```js -const buf = Buffer.from([1,-2,3,4]); - -buf.readInt8(0); - // returns 1 -buf.readInt8(1); - // returns -2 -``` - -### buf.readInt16BE(offset[, noAssert]) -### buf.readInt16LE(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads a signed 16-bit integer from the Buffer at the specified `offset` with -the specified endian format (`readInt16BE()` returns big endian, -`readInt16LE()` returns little endian). - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -Integers read from the Buffer are interpreted as two's complement signed values. - -```js -const buf = Buffer.from([1,-2,3,4]); - -buf.readInt16BE(); - // returns 510 -buf.readInt16LE(1); - // returns 1022 -``` - -### buf.readInt32BE(offset[, noAssert]) -### buf.readInt32LE(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads a signed 32-bit integer from the Buffer at the specified `offset` with -the specified endian format (`readInt32BE()` returns big endian, -`readInt32LE()` returns little endian). - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -Integers read from the Buffer are interpreted as two's complement signed values. - -```js -const buf = Buffer.from([1,-2,3,4]); - -buf.readInt32BE(); - // returns 33424132 -buf.readInt32LE(); - // returns 67370497 -buf.readInt32LE(1); - // throws RangeError: Index out of range -``` - -### buf.readIntBE(offset, byteLength[, noAssert]) -### buf.readIntLE(offset, byteLength[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - byteLength` -* `byteLength` {Number} `0 < byteLength <= 6` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads `byteLength` number of bytes from the Buffer at the specified `offset` -and interprets the result as a two's complement signed value. Supports up to 48 -bits of accuracy. For example: - -```js -const buf = Buffer.allocUnsafe(6); -buf.writeUInt16LE(0x90ab, 0); -buf.writeUInt32LE(0x12345678, 2); -buf.readIntLE(0, 6).toString(16); // Specify 6 bytes (48 bits) -// Returns: '1234567890ab' - -buf.readIntBE(0, 6).toString(16); -// Returns: -546f87a9cbee -``` - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -### buf.readUInt8(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads an unsigned 8-bit integer from the Buffer at the specified `offset`. - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -```js -const buf = Buffer.from([1,-2,3,4]); - -buf.readUInt8(0); - // returns 1 -buf.readUInt8(1); - // returns 254 -``` - -### buf.readUInt16BE(offset[, noAssert]) -### buf.readUInt16LE(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads an unsigned 16-bit integer from the Buffer at the specified `offset` with -specified endian format (`readInt32BE()` returns big endian, -`readInt32LE()` returns little endian). - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -Example: - -```js -const buf = Buffer.from([0x3, 0x4, 0x23, 0x42]); - -buf.readUInt16BE(0); - // Returns: 0x0304 -buf.readUInt16LE(0); - // Returns: 0x0403 -buf.readUInt16BE(1); - // Returns: 0x0423 -buf.readUInt16LE(1); - // Returns: 0x2304 -buf.readUInt16BE(2); - // Returns: 0x2342 -buf.readUInt16LE(2); - // Returns: 0x4223 -``` - -### buf.readUInt32BE(offset[, noAssert]) -### buf.readUInt32LE(offset[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads an unsigned 32-bit integer from the Buffer at the specified `offset` with -specified endian format (`readInt32BE()` returns big endian, -`readInt32LE()` returns little endian). - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -Example: - -```js -const buf = Buffer.from([0x3, 0x4, 0x23, 0x42]); - -buf.readUInt32BE(0); - // Returns: 0x03042342 -console.log(buf.readUInt32LE(0)); - // Returns: 0x42230403 -``` - -### buf.readUIntBE(offset, byteLength[, noAssert]) -### buf.readUIntLE(offset, byteLength[, noAssert]) - -* `offset` {Number} `0 <= offset <= buf.length - byteLength` -* `byteLength` {Number} `0 < byteLength <= 6` -* `noAssert` {Boolean} Default: false -* Return: {Number} - -Reads `byteLength` number of bytes from the Buffer at the specified `offset` -and interprets the result as an unsigned integer. Supports up to 48 -bits of accuracy. For example: - -```js -const buf = Buffer.allocUnsafe(6); -buf.writeUInt16LE(0x90ab, 0); -buf.writeUInt32LE(0x12345678, 2); -buf.readUIntLE(0, 6).toString(16); // Specify 6 bytes (48 bits) -// Returns: '1234567890ab' - -buf.readUIntBE(0, 6).toString(16); -// Returns: ab9078563412 -``` - -Setting `noAssert` to `true` skips validation of the `offset`. This allows the -`offset` to be beyond the end of the Buffer. - -### buf.slice([start[, end]]) - -* `start` {Number} Default: 0 -* `end` {Number} Default: `buffer.length` -* Return: {Buffer} - -Returns a new Buffer that references the same memory as the original, but -offset and cropped by the `start` and `end` indices. - -**Note that modifying the new Buffer slice will modify the memory in the -original Buffer because the allocated memory of the two objects overlap.** - -Example: build a Buffer with the ASCII alphabet, take a slice, then modify one -byte from the original Buffer. - -```js -const buf1 = Buffer.allocUnsafe(26); - -for (var i = 0 ; i < 26 ; i++) { - buf1[i] = i + 97; // 97 is ASCII a -} - -const buf2 = buf1.slice(0, 3); -buf2.toString('ascii', 0, buf2.length); - // Returns: 'abc' -buf1[0] = 33; -buf2.toString('ascii', 0, buf2.length); - // Returns : '!bc' -``` - -Specifying negative indexes causes the slice to be generated relative to the -end of the Buffer rather than the beginning. - -```js -const buf = Buffer.from('buffer'); - -buf.slice(-6, -1).toString(); - // Returns 'buffe', equivalent to buf.slice(0, 5) -buf.slice(-6, -2).toString(); - // Returns 'buff', equivalent to buf.slice(0, 4) -buf.slice(-5, -2).toString(); - // Returns 'uff', equivalent to buf.slice(1, 4) -``` - -### buf.swap16() - -* Return: {Buffer} - -Interprets the `Buffer` as an array of unsigned 16-bit integers and swaps -the byte-order *in-place*. Throws a `RangeError` if the `Buffer` length is -not a multiple of 16 bits. The method returns a reference to the Buffer, so -calls can be chained. - -```js -const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); -console.log(buf); - // Prints Buffer(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8) -buf.swap16(); -console.log(buf); - // Prints Buffer(0x2, 0x1, 0x4, 0x3, 0x6, 0x5, 0x8, 0x7) -``` - -### buf.swap32() - -* Return: {Buffer} - -Interprets the `Buffer` as an array of unsigned 32-bit integers and swaps -the byte-order *in-place*. Throws a `RangeError` if the `Buffer` length is -not a multiple of 32 bits. The method returns a reference to the Buffer, so -calls can be chained. - -```js -const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); -console.log(buf); - // Prints Buffer(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8) -buf.swap32(); -console.log(buf); - // Prints Buffer(0x4, 0x3, 0x2, 0x1, 0x8, 0x7, 0x6, 0x5) -``` - -### buf.toString([encoding[, start[, end]]]) - -* `encoding` {String} Default: `'utf8'` -* `start` {Number} Default: 0 -* `end` {Number} Default: `buffer.length` -* Return: {String} - -Decodes and returns a string from the Buffer data using the specified -character set `encoding`. - -```js -const buf = Buffer.allocUnsafe(26); -for (var i = 0 ; i < 26 ; i++) { - buf[i] = i + 97; // 97 is ASCII a -} -buf.toString('ascii'); - // Returns: 'abcdefghijklmnopqrstuvwxyz' -buf.toString('ascii',0,5); - // Returns: 'abcde' -buf.toString('utf8',0,5); - // Returns: 'abcde' -buf.toString(undefined,0,5); - // Returns: 'abcde', encoding defaults to 'utf8' -``` - -### buf.toJSON() - -* Return: {Object} - -Returns a JSON representation of the Buffer instance. [`JSON.stringify()`][] -implicitly calls this function when stringifying a Buffer instance. - -Example: - -```js -const buf = Buffer.from('test'); -const json = JSON.stringify(buf); - -console.log(json); -// Prints: '{"type":"Buffer","data":[116,101,115,116]}' - -const copy = JSON.parse(json, (key, value) => { - return value && value.type === 'Buffer' - ? Buffer.from(value.data) - : value; - }); - -console.log(copy.toString()); -// Prints: 'test' -``` - -### buf.values() - -* Return: {Iterator} - -Creates and returns an [iterator][] for Buffer values (bytes). This function is -called automatically when the Buffer is used in a `for..of` statement. - -```js -const buf = Buffer.from('buffer'); -for (var value of buf.values()) { - console.log(value); -} -// prints: -// 98 -// 117 -// 102 -// 102 -// 101 -// 114 - -for (var value of buf) { - console.log(value); -} -// prints: -// 98 -// 117 -// 102 -// 102 -// 101 -// 114 -``` - -### buf.write(string[, offset[, length]][, encoding]) - -* `string` {String} Bytes to be written to buffer -* `offset` {Number} Default: 0 -* `length` {Number} Default: `buffer.length - offset` -* `encoding` {String} Default: `'utf8'` -* Return: {Number} Numbers of bytes written - -Writes `string` to the Buffer at `offset` using the given `encoding`. -The `length` parameter is the number of bytes to write. If the Buffer did not -contain enough space to fit the entire string, only a partial amount of the -string will be written however, it will not write only partially encoded -characters. - -```js -const buf = Buffer.allocUnsafe(256); -const len = buf.write('\u00bd + \u00bc = \u00be', 0); -console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); - // Prints: 12 bytes: ½ + ¼ = ¾ -``` - -### buf.writeDoubleBE(value, offset[, noAssert]) -### buf.writeDoubleLE(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 8` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` with specified endian -format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little -endian). The `value` argument *should* be a valid 64-bit double. Behavior is -not defined when `value` is anything other than a 64-bit double. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -Example: - -```js -const buf = Buffer.allocUnsafe(8); -buf.writeDoubleBE(0xdeadbeefcafebabe, 0); - -console.log(buf); - // Prints: - -buf.writeDoubleLE(0xdeadbeefcafebabe, 0); - -console.log(buf); - // Prints: -``` - -### buf.writeFloatBE(value, offset[, noAssert]) -### buf.writeFloatLE(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` with specified endian -format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little -endian). Behavior is not defined when `value` is anything other than a 32-bit -float. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -Example: - -```js -const buf = Buffer.allocUnsafe(4); -buf.writeFloatBE(0xcafebabe, 0); - -console.log(buf); - // Prints: - -buf.writeFloatLE(0xcafebabe, 0); - -console.log(buf); - // Prints: -``` - -### buf.writeInt8(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset`. The `value` should be a -valid signed 8-bit integer. Behavior is not defined when `value` is anything -other than a signed 8-bit integer. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -The `value` is interpreted and written as a two's complement signed integer. - -```js -const buf = Buffer.allocUnsafe(2); -buf.writeInt8(2, 0); -buf.writeInt8(-2, 1); -console.log(buf); - // Prints: -``` - -### buf.writeInt16BE(value, offset[, noAssert]) -### buf.writeInt16LE(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` with specified endian -format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little -endian). The `value` should be a valid signed 16-bit integer. Behavior is -not defined when `value` is anything other than a signed 16-bit integer. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -The `value` is interpreted and written as a two's complement signed integer. - -```js -const buf = Buffer.allocUnsafe(4); -buf.writeInt16BE(0x0102,0); -buf.writeInt16LE(0x0304,2); -console.log(buf); - // Prints: -``` - -### buf.writeInt32BE(value, offset[, noAssert]) -### buf.writeInt32LE(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` with specified endian -format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little -endian). The `value` should be a valid signed 32-bit integer. Behavior is -not defined when `value` is anything other than a signed 32-bit integer. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -The `value` is interpreted and written as a two's complement signed integer. - -```js -const buf = Buffer.allocUnsafe(8); -buf.writeInt32BE(0x01020304,0); -buf.writeInt32LE(0x05060708,4); -console.log(buf); - // Prints: -``` - -### buf.writeIntBE(value, offset, byteLength[, noAssert]) -### buf.writeIntLE(value, offset, byteLength[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - byteLength` -* `byteLength` {Number} `0 < byteLength <= 6` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` and `byteLength`. -Supports up to 48 bits of accuracy. For example: - -```js -const buf1 = Buffer.allocUnsafe(6); -buf1.writeUIntBE(0x1234567890ab, 0, 6); -console.log(buf1); - // Prints: - -const buf2 = Buffer.allocUnsafe(6); -buf2.writeUIntLE(0x1234567890ab, 0, 6); -console.log(buf2); - // Prints: -``` - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -Behavior is not defined when `value` is anything other than an integer. - -### buf.writeUInt8(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset`. The `value` should be a -valid unsigned 8-bit integer. Behavior is not defined when `value` is anything -other than an unsigned 8-bit integer. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -Example: - -```js -const buf = Buffer.allocUnsafe(4); -buf.writeUInt8(0x3, 0); -buf.writeUInt8(0x4, 1); -buf.writeUInt8(0x23, 2); -buf.writeUInt8(0x42, 3); - -console.log(buf); - // Prints: -``` - -### buf.writeUInt16BE(value, offset[, noAssert]) -### buf.writeUInt16LE(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` with specified endian -format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little -endian). The `value` should be a valid unsigned 16-bit integer. Behavior is -not defined when `value` is anything other than an unsigned 16-bit integer. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -Example: - -```js -const buf = Buffer.allocUnsafe(4); -buf.writeUInt16BE(0xdead, 0); -buf.writeUInt16BE(0xbeef, 2); - -console.log(buf); - // Prints: - -buf.writeUInt16LE(0xdead, 0); -buf.writeUInt16LE(0xbeef, 2); - -console.log(buf); - // Prints: -``` - -### buf.writeUInt32BE(value, offset[, noAssert]) -### buf.writeUInt32LE(value, offset[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` with specified endian -format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little -endian). The `value` should be a valid unsigned 32-bit integer. Behavior is -not defined when `value` is anything other than an unsigned 32-bit integer. - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -Example: - -```js -const buf = Buffer.allocUnsafe(4); -buf.writeUInt32BE(0xfeedface, 0); - -console.log(buf); - // Prints: - -buf.writeUInt32LE(0xfeedface, 0); - -console.log(buf); - // Prints: -``` - -### buf.writeUIntBE(value, offset, byteLength[, noAssert]) -### buf.writeUIntLE(value, offset, byteLength[, noAssert]) - -* `value` {Number} Bytes to be written to Buffer -* `offset` {Number} `0 <= offset <= buf.length - byteLength` -* `byteLength` {Number} `0 < byteLength <= 6` -* `noAssert` {Boolean} Default: false -* Return: {Number} The offset plus the number of written bytes - -Writes `value` to the Buffer at the specified `offset` and `byteLength`. -Supports up to 48 bits of accuracy. For example: - -```js -const buf = Buffer.allocUnsafe(6); -buf.writeUIntBE(0x1234567890ab, 0, 6); -console.log(buf); - // Prints: -``` - -Set `noAssert` to true to skip validation of `value` and `offset`. This means -that `value` may be too large for the specific function and `offset` may be -beyond the end of the Buffer leading to the values being silently dropped. This -should not be used unless you are certain of correctness. - -Behavior is not defined when `value` is anything other than an unsigned integer. - -## buffer.INSPECT_MAX_BYTES - -* {Number} Default: 50 - -Returns the maximum number of bytes that will be returned when -`buffer.inspect()` is called. This can be overridden by user modules. See -[`util.inspect()`][] for more details on `buffer.inspect()` behavior. - -Note that this is a property on the `buffer` module as returned by -`require('buffer')`, not on the Buffer global or a Buffer instance. - -## Class: SlowBuffer - -Returns an un-pooled `Buffer`. - -In order to avoid the garbage collection overhead of creating many individually -allocated Buffers, by default allocations under 4KB are sliced from a single -larger allocated object. This approach improves both performance and memory -usage since v8 does not need to track and cleanup as many `Persistent` objects. - -In the case where a developer may need to retain a small chunk of memory from a -pool for an indeterminate amount of time, it may be appropriate to create an -un-pooled Buffer instance using `SlowBuffer` then copy out the relevant bits. - -```js -// need to keep around a few small chunks of memory -const store = []; - -socket.on('readable', () => { - var data = socket.read(); - // allocate for retained data - var sb = SlowBuffer(10); - // copy the data into the new allocation - data.copy(sb, 0, 0, 10); - store.push(sb); -}); -``` - -Use of `SlowBuffer` should be used only as a last resort *after* a developer -has observed undue memory retention in their applications. - -### new SlowBuffer(size) - -* `size` Number - -Allocates a new `SlowBuffer` of `size` bytes. The `size` must be less than -or equal to the value of `require('buffer').kMaxLength` (on 64-bit -architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is -thrown. If a `size` less than 0 is specified, a zero-length `SlowBuffer` will be -created. - -The underlying memory for `SlowBuffer` instances is *not initialized*. The -contents of a newly created `SlowBuffer` are unknown and could contain -sensitive data. Use [`buf.fill(0)`][] to initialize a `SlowBuffer` to zeroes. - -```js -const SlowBuffer = require('buffer').SlowBuffer; -const buf = new SlowBuffer(5); -console.log(buf); - // - // (octets will be different, every time) -buf.fill(0); -console.log(buf); - // -``` - -[`Array#includes()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes -[`Array#indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf -[`buf.entries()`]: #buffer_buf_entries -[`buf.fill(0)`]: #buffer_buf_fill_value_offset_end -[`buf.keys()`]: #buffer_buf_keys -[`buf.slice()`]: #buffer_buf_slice_start_end -[`buf.values()`]: #buffer_buf_values -[`buf1.compare(buf2)`]: #buffer_buf_compare_otherbuffer -[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify -[`RangeError`]: errors.html#errors_class_rangeerror -[`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length -[`util.inspect()`]: util.html#util_util_inspect_object_options -[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols -[RFC 4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5 -[buffer_from_array]: #buffer_class_method_buffer_from_array -[buffer_from_buffer]: #buffer_class_method_buffer_from_buffer -[buffer_from_arraybuf]: #buffer_class_method_buffer_from_arraybuffer -[buffer_from_string]: #buffer_class_method_buffer_from_str_encoding -[buffer_allocunsafe]: #buffer_class_method_buffer_allocraw_size -[buffer_alloc]: #buffer_class_method_buffer_alloc_size_fill_encoding -[`TypedArray.from()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from -[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView -[`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray diff --git a/doc/api/buffer.md b/doc/api/buffer.md new file mode 100644 index 00000000000000..be5d49875ab471 --- /dev/null +++ b/doc/api/buffer.md @@ -0,0 +1,1794 @@ +# Buffer + + Stability: 2 - Stable + +Prior to the introduction of `TypedArray` in ECMAScript 2015 (ES6), the +JavaScript language had no mechanism for reading or manipulating streams +of binary data. The `Buffer` class was introduced as part of the Node.js +API to make it possible to interact with octet streams in the context of things +like TCP streams and file system operations. + +Now that `TypedArray` has been added in ES6, the `Buffer` class implements the +`Uint8Array` API in a manner that is more optimized and suitable for Node.js' +use cases. + +Instances of the `Buffer` class are similar to arrays of integers but +correspond to fixed-sized, raw memory allocations outside the V8 heap. +The size of the `Buffer` is established when it is created and cannot be +resized. + +The `Buffer` class is a global within Node.js, making it unlikely that one +would need to ever use `require('buffer')`. + + +```js +const buf1 = Buffer.alloc(10); + // Creates a zero-filled Buffer of length 10. + +const buf2 = Buffer.alloc(10, 1); + // Creates a Buffer of length 10, filled with 0x01. + +const buf3 = Buffer.allocUnsafe(10); + // Creates an uninitialized buffer of length 10. + // This is faster than calling Buffer.alloc() but the returned + // Buffer instance might contain old data that needs to be + // overwritten using either fill() or write(). + +const buf4 = Buffer.from([1,2,3]); + // Creates a Buffer containing [01, 02, 03]. + +const buf5 = Buffer.from('test'); + // Creates a Buffer containing ASCII bytes [74, 65, 73, 74]. + +const buf6 = Buffer.from('tést', 'utf8'); + // Creates a Buffer containing UTF8 bytes [74, c3, a9, 73, 74]. +``` + +## `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` + +Historically, `Buffer` instances have been created using the `Buffer` +constructor function, which allocates the returned `Buffer` +differently based on what arguments are provided: + +* Passing a number as the first argument to `Buffer()` (e.g. `new Buffer(10)`), + allocates a new `Buffer` object of the specified size. The memory allocated + for such `Buffer` instances is *not* initialized and *can contain sensitive + data*. Such `Buffer` objects *must* be initialized *manually* by using either + [`buf.fill(0)`][] or by writing to the `Buffer` completely. While this + behavior is *intentional* to improve performance, development experience has + demonstrated that a more explicit distinction is required between creating a + fast-but-uninitialized `Buffer` versus creating a slower-but-safer `Buffer`. +* Passing a string, array, or `Buffer` as the first argument copies the + passed object's data into the `Buffer`. +* Passing an `ArrayBuffer` returns a `Buffer` that shares allocated memory with + the given `ArrayBuffer`. + +Because the behavior of `new Buffer()` changes significantly based on the type +of value passed as the first argument, applications that do not properly +validate the input arguments passed to `new Buffer()`, or that fail to +appropriately initialize newly allocated `Buffer` content, can inadvertently +introduce security and reliability issues into their code. + +To make the creation of `Buffer` objects more reliable and less error prone, +new `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` methods have +been introduced as an alternative means of creating `Buffer` instances. + +*Developers should migrate all existing uses of the `new Buffer()` constructors +to one of these new APIs.* + +* [`Buffer.from(array)`][buffer_from_array] returns a new `Buffer` containing + a *copy* of the provided octets. +* [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][buffer_from_arraybuf] + returns a new `Buffer` that *shares* the same allocated memory as the given + `ArrayBuffer`. +* [`Buffer.from(buffer)`][buffer_from_buffer] returns a new `Buffer` + containing a *copy* of the contents of the given `Buffer`. +* [`Buffer.from(str[, encoding])`][buffer_from_string] returns a new `Buffer` + containing a *copy* of the provided string. +* [`Buffer.alloc(size[, fill[, encoding]])`][buffer_alloc] returns a "filled" + `Buffer` instance of the specified size. This method can be significantly + slower than [`Buffer.allocUnsafe(size)`][buffer_allocunsafe] but ensures that + newly created `Buffer` instances never contain old and potentially sensitive + data. +* [`Buffer.allocUnsafe(size)`][buffer_allocunsafe] returns a new `Buffer` of + the specified `size` whose content *must* be initialized using either + [`buf.fill(0)`][] or written to completely. + +`Buffer` instances returned by `Buffer.allocUnsafe(size)` *may* be allocated +off a shared internal memory pool if the `size` is less than or equal to half +`Buffer.poolSize`. + +### What makes `Buffer.allocUnsafe(size)` "unsafe"? + +When calling `Buffer.allocUnsafe()`, the segment of allocated memory is +*uninitialized* (it is not zeroed-out). While this design makes the allocation +of memory quite fast, the allocated segment of memory might contain old data +that is potentially sensitive. Using a `Buffer` created by +`Buffer.allocUnsafe(size)` without *completely* overwriting the memory can +allow this old data to be leaked when the `Buffer` memory is read. + +While there are clear performance advantages to using `Buffer.allocUnsafe()`, +extra care *must* be taken in order to avoid introducing security +vulnerabilities into an application. + +## Buffers and Character Encodings + +Buffers are commonly used to represent sequences of encoded characters +such as UTF8, UCS2, Base64 or even Hex-encoded data. It is possible to +convert back and forth between Buffers and ordinary JavaScript string objects +by using an explicit encoding method. + +```js +const buf = Buffer.from('hello world', 'ascii'); +console.log(buf.toString('hex')); + // prints: 68656c6c6f20776f726c64 +console.log(buf.toString('base64')); + // prints: aGVsbG8gd29ybGQ= +``` + +The character encodings currently supported by Node.js include: + +* `'ascii'` - for 7-bit ASCII data only. This encoding method is very fast and + will strip the high bit if set. + +* `'utf8'` - Multibyte encoded Unicode characters. Many web pages and other + document formats use UTF-8. + +* `'utf16le'` - 2 or 4 bytes, little-endian encoded Unicode characters. + Surrogate pairs (U+10000 to U+10FFFF) are supported. + +* `'ucs2'` - Alias of `'utf16le'`. + +* `'base64'` - Base64 string encoding. When creating a buffer from a string, + this encoding will also correctly accept "URL and Filename Safe Alphabet" as + specified in [RFC 4648, Section 5]. + +* `'binary'` - A way of encoding the buffer into a one-byte (`latin-1`) + encoded string. The string `'latin-1'` is not supported. Instead, pass + `'binary'` to use `'latin-1'` encoding. + +* `'hex'` - Encode each byte as two hexadecimal characters. + +## Buffers and TypedArray + +Buffers are also `Uint8Array` TypedArray instances. However, there are subtle +incompatibilities with the TypedArray specification in ECMAScript 2015. For +instance, while `ArrayBuffer#slice()` creates a copy of the slice, +the implementation of [`Buffer#slice()`][`buf.slice()`] creates a view over the +existing Buffer without copying, making `Buffer#slice()` far more efficient. + +It is also possible to create new TypedArray instances from a `Buffer` with the +following caveats: + +1. The `Buffer` object's memory is copied to the TypedArray, not shared. + +2. The `Buffer` object's memory is interpreted as an array of distinct + elements, and not as a byte array of the target type. That is, + `new Uint32Array(Buffer.from([1,2,3,4]))` creates a 4-element `Uint32Array` + with elements `[1,2,3,4]`, not a `Uint32Array` with a single element + `[0x1020304]` or `[0x4030201]`. + +It is possible to create a new `Buffer` that shares the same allocated memory as +a TypedArray instance by using the TypeArray object's `.buffer` property: + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf1 = Buffer.from(arr); // copies the buffer +const buf2 = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf1); + // Prints: , copied buffer has only two elements +console.log(buf2); + // Prints: + +arr[1] = 6000; +console.log(buf1); + // Prints: +console.log(buf2); + // Prints: +``` + +Note that when creating a `Buffer` using the TypedArray's `.buffer`, it is +possible to use only a portion of the underlying `ArrayBuffer` by passing in +`byteOffset` and `length` parameters: + +```js +const arr = new Uint16Array(20); +const buf = Buffer.from(arr.buffer, 0, 16); +console.log(buf.length); + // Prints: 16 +``` + +The `Buffer.from()` and [`TypedArray.from()`][] (e.g.`Uint8Array.from()`) have +different signatures and implementations. Specifically, the TypedArray variants +accept a second argument that is a mapping function that is invoked on every +element of the typed array: + +* `TypedArray.from(source[, mapFn[, thisArg]])` + +The `Buffer.from()` method, however, does not support the use of a mapping +function: + +* [`Buffer.from(array)`][buffer_from_array] +* [`Buffer.from(buffer)`][buffer_from_buffer] +* [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][buffer_from_arraybuf] +* [`Buffer.from(str[, encoding])`][buffer_from_string] + +## Buffers and ES6 iteration + +Buffers can be iterated over using the ECMAScript 2015 (ES6) `for..of` syntax: + +```js +const buf = Buffer(.from[1, 2, 3]); + +for (var b of buf) + console.log(b) + +// Prints: +// 1 +// 2 +// 3 +``` + +Additionally, the [`buf.values()`][], [`buf.keys()`][], and +[`buf.entries()`][] methods can be used to create iterators. + +## The `--zero-fill-buffers` command line option + +Node.js can be started using the `--zero-fill-buffers` command line option to +force all newly allocated `Buffer` and `SlowBuffer` instances created using +either `new Buffer(size)` and `new SlowBuffer(size)` to be *automatically +zero-filled* upon creation. Use of this flag *changes the default behavior* of +these methods and *can have a significant impact* on performance. Use of the +`--zero-fill-buffers` option is recommended only when absolutely necessary to +enforce that newly allocated `Buffer` instances cannot contain potentially +sensitive data. + +``` +$ node --zero-fill-buffers +> Buffer(5); + +``` + +## Class: Buffer + +The Buffer class is a global type for dealing with binary data directly. +It can be constructed in a variety of ways. + +### new Buffer(array) + +* `array` {Array} + +Allocates a new Buffer using an `array` of octets. + +```js +const buf = new Buffer([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +### new Buffer(buffer) + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = new Buffer('buffer'); +const buf2 = new Buffer(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +### new Buffer(arrayBuffer[, byteOffset[, length]]) + +* `arrayBuffer` - The `.buffer` property of a `TypedArray` or a `new + ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created Buffer will share the same allocated memory as the +TypedArray. + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = new Buffer(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypdArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +### new Buffer(size) + +* `size` {Number} + +Allocates a new `Buffer` of `size` bytes. The `size` must be less than +or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. If a `size` less than 0 is specified, a zero-length Buffer will be +created. + +Unlike `ArrayBuffers`, the underlying memory for `Buffer` instances created in +this way is *not initialized*. The contents of a newly created `Buffer` are +unknown and *could contain sensitive data*. Use [`buf.fill(0)`][] to initialize +a Buffer to zeroes. + +```js +const buf = new Buffer(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +### new Buffer(str[, encoding]) + +* `str` {String} String to encode. +* `encoding` {String} Default: `'utf8'` + +Creates a new Buffer containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the strings character encoding. + +```js +const buf1 = new Buffer('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = new Buffer('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. If a `size` less than 0 +is specified, a zero-length `Buffer` will be created. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. If a `size` less than 0 is specified, a zero-length `Buffer` will be +created. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.byteLength(string[, encoding]) + +* `string` {String | Buffer | TypedArray | DataView | ArrayBuffer} +* `encoding` {String} Default: `'utf8'` +* Return: {Number} + +Returns the actual byte length of a string. This is not the same as +[`String.prototype.length`][] since that returns the number of *characters* in +a string. + +Example: + +```js +const str = '\u00bd + \u00bc = \u00be'; + +console.log(`${str}: ${str.length} characters, ` + + `${Buffer.byteLength(str, 'utf8')} bytes`); + +// ½ + ¼ = ¾: 9 characters, 12 bytes +``` + +When `string` is a `Buffer`/[`DataView`][]/[`TypedArray`][]/`ArrayBuffer`, +returns the actual byte length. + +Otherwise, converts to `String` and returns the byte length of string. + +### Class Method: Buffer.compare(buf1, buf2) + +* `buf1` {Buffer} +* `buf2` {Buffer} +* Return: {Number} + +Compares `buf1` to `buf2` typically for the purpose of sorting arrays of +Buffers. This is equivalent is calling [`buf1.compare(buf2)`][]. + +```js +const arr = [Buffer.from('1234'), Buffer.from('0123')]; +arr.sort(Buffer.compare); +``` + +### Class Method: Buffer.concat(list[, totalLength]) + +* `list` {Array} List of Buffer objects to concat +* `totalLength` {Number} Total length of the Buffers in the list when concatenated +* Return: {Buffer} + +Returns a new Buffer which is the result of concatenating all the Buffers in +the `list` together. + +If the list has no items, or if the `totalLength` is 0, then a new zero-length +Buffer is returned. + +If `totalLength` is not provided, it is calculated from the Buffers in the +`list`. This, however, adds an additional loop to the function, so it is faster +to provide the length explicitly. + +Example: build a single Buffer from a list of three Buffers: + +```js +const buf1 = Buffer.alloc(10, 0); +const buf2 = Buffer.alloc(14, 0); +const buf3 = Buffer.alloc(18, 0); +const totalLength = buf1.length + buf2.length + buf3.length; + +console.log(totalLength); +const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); +console.log(bufA); +console.log(bufA.length); + +// 42 +// +// 42 +``` + +### Class Method: Buffer.from(array) + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created `Buffer` will share the same allocated memory as the +TypedArray. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the character encoding. +If not provided, `encoding` defaults to `'utf8'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.isBuffer(obj) + +* `obj` {Object} +* Return: {Boolean} + +Returns 'true' if `obj` is a Buffer. + +### Class Method: Buffer.isEncoding(encoding) + +* `encoding` {String} The encoding string to test +* Return: {Boolean} + +Returns true if the `encoding` is a valid encoding argument, or false +otherwise. + +### buf[index] + + + + +The index operator `[index]` can be used to get and set the octet at position +`index` in the Buffer. The values refer to individual bytes, so the legal value +range is between `0x00` and `0xFF` (hex) or `0` and `255` (decimal). + +Example: copy an ASCII string into a Buffer, one byte at a time: + +```js +const str = "Node.js"; +const buf = Buffer.allocUnsafe(str.length); + +for (var i = 0; i < str.length ; i++) { + buf[i] = str.charCodeAt(i); +} + +console.log(buf.toString('ascii')); + // Prints: Node.js +``` + +### buf.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]]) + +* `target` {Buffer} +* `targetStart` {Integer} The offset within `target` at which to begin + comparison. default = `0`. +* `targetEnd` {Integer} The offset with `target` at which to end comparison. + Ignored when `targetStart` is `undefined`. default = `target.byteLength`. +* `sourceStart` {Integer} The offset within `buf` at which to begin comparison. + Ignored when `targetStart` is `undefined`. default = `0` +* `sourceEnd` {Integer} The offset within `buf` at which to end comparison. + Ignored when `targetStart` is `undefined`. default = `buf.byteLength`. +* Return: {Number} + +Compares two Buffer instances and returns a number indicating whether `buf` +comes before, after, or is the same as the `target` in sort order. +Comparison is based on the actual sequence of bytes in each Buffer. + +* `0` is returned if `target` is the same as `buf` +* `1` is returned if `target` should come *before* `buf` when sorted. +* `-1` is returned if `target` should come *after* `buf` when sorted. + +```js +const buf1 = Buffer.from('ABC'); +const buf2 = Buffer.from('BCD'); +const buf3 = Buffer.from('ABCD'); + +console.log(buf1.compare(buf1)); + // Prints: 0 +console.log(buf1.compare(buf2)); + // Prints: -1 +console.log(buf1.compare(buf3)); + // Prints: 1 +console.log(buf2.compare(buf1)); + // Prints: 1 +console.log(buf2.compare(buf3)); + // Prints: 1 + +[buf1, buf2, buf3].sort(Buffer.compare); + // produces sort order [buf1, buf3, buf2] +``` + +The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd` +arguments can be used to limit the comparison to specific ranges within the two +`Buffer` objects. + +```js +const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]); +const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]); + +console.log(buf1.compare(buf2, 5, 9, 0, 4)); + // Prints: 0 +console.log(buf1.compare(buf2, 0, 6, 4)); + // Prints: -1 +console.log(buf1.compare(buf2, 5, 6, 5)); + // Prints: 1 +``` + +A `RangeError` will be thrown if: `targetStart < 0`, `sourceStart < 0`, +`targetEnd > target.byteLength` or `sourceEnd > source.byteLength`. + +### buf.copy(targetBuffer[, targetStart[, sourceStart[, sourceEnd]]]) + +* `targetBuffer` {Buffer} Buffer to copy into +* `targetStart` {Number} Default: 0 +* `sourceStart` {Number} Default: 0 +* `sourceEnd` {Number} Default: `buffer.length` +* Return: {Number} The number of bytes copied. + +Copies data from a region of this Buffer to a region in the target Buffer even +if the target memory region overlaps with the source. + +Example: build two Buffers, then copy `buf1` from byte 16 through byte 19 +into `buf2`, starting at the 8th byte in `buf2`. + +```js +const buf1 = Buffer.allocUnsafe(26); +const buf2 = Buffer.allocUnsafe(26).fill('!'); + +for (var i = 0 ; i < 26 ; i++) { + buf1[i] = i + 97; // 97 is ASCII a +} + +buf1.copy(buf2, 8, 16, 20); +console.log(buf2.toString('ascii', 0, 25)); + // Prints: !!!!!!!!qrst!!!!!!!!!!!!! +``` + +Example: Build a single Buffer, then copy data from one region to an overlapping +region in the same Buffer + +```js +const buf = Buffer.allocUnsafe(26); + +for (var i = 0 ; i < 26 ; i++) { + buf[i] = i + 97; // 97 is ASCII a +} + +buf.copy(buf, 0, 4, 10); +console.log(buf.toString()); + +// efghijghijklmnopqrstuvwxyz +``` + +### buf.entries() + +* Return: {Iterator} + +Creates and returns an [iterator][] of `[index, byte]` pairs from the Buffer +contents. + +```js +const buf = Buffer.from('buffer'); +for (var pair of buf.entries()) { + console.log(pair); +} +// prints: +// [0, 98] +// [1, 117] +// [2, 102] +// [3, 102] +// [4, 101] +// [5, 114] +``` + +### buf.equals(otherBuffer) + +* `otherBuffer` {Buffer} +* Return: {Boolean} + +Returns a boolean indicating whether `this` and `otherBuffer` have exactly the +same bytes. + +```js +const buf1 = Buffer.from('ABC'); +const buf2 = Buffer.from('414243', 'hex'); +const buf3 = Buffer.from('ABCD'); + +console.log(buf1.equals(buf2)); + // Prints: true +console.log(buf1.equals(buf3)); + // Prints: false +``` + +### buf.fill(value[, offset[, end]][, encoding]) + +* `value` {String|Buffer|Number} +* `offset` {Number} Default: 0 +* `end` {Number} Default: `buf.length` +* `encoding` {String} Default: `'utf8'` +* Return: {Buffer} + +Fills the Buffer with the specified value. If the `offset` (defaults to `0`) +and `end` (defaults to `buf.length`) are not given the entire buffer will be +filled. The method returns a reference to the Buffer, so calls can be chained. +This is meant as a small simplification to creating a Buffer. Allowing the +creation and fill of the Buffer to be done on a single line: + +```js +const b = Buffer.alloc(50, 'h'); +console.log(b.toString()); + // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh +``` + +`encoding` is only relevant if `value` is a string. Otherwise it is ignored. +`value` is coerced to a `uint32` value if it is not a String or Number. + +The `fill()` operation writes bytes into the Buffer dumbly. If the final write +falls in between a multi-byte character then whatever bytes fit into the buffer +are written. + +```js +Buffer.alloc(3, '\u0222'); + // Prints: +``` + +### buf.indexOf(value[, byteOffset][, encoding]) + +* `value` {String|Buffer|Number} +* `byteOffset` {Number} Default: 0 +* `encoding` {String} Default: `'utf8'` +* Return: {Number} + +Operates similar to [`Array#indexOf()`][] in that it returns either the +starting index position of `value` in Buffer or `-1` if the Buffer does not +contain `value`. The `value` can be a String, Buffer or Number. Strings are by +default interpreted as UTF8. Buffers will use the entire Buffer (to compare a +partial Buffer use [`buf.slice()`][]). Numbers can range from 0 to 255. + +```js +const buf = Buffer.from('this is a buffer'); + +buf.indexOf('this'); + // returns 0 +buf.indexOf('is'); + // returns 2 +buf.indexOf(Buffer.from('a buffer')); + // returns 8 +buf.indexOf(97); // ascii for 'a' + // returns 8 +buf.indexOf(Buffer.from('a buffer example')); + // returns -1 +buf.indexOf(Buffer.from('a buffer example').slice(0,8)); + // returns 8 + +const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); + +utf16Buffer.indexOf('\u03a3', 0, 'ucs2'); + // returns 4 +utf16Buffer.indexOf('\u03a3', -4, 'ucs2'); + // returns 6 +``` + +### buf.includes(value[, byteOffset][, encoding]) + +* `value` {String|Buffer|Number} +* `byteOffset` {Number} Default: 0 +* `encoding` {String} Default: `'utf8'` +* Return: {Boolean} + +Operates similar to [`Array#includes()`][]. The `value` can be a String, Buffer +or Number. Strings are interpreted as UTF8 unless overridden with the +`encoding` argument. Buffers will use the entire Buffer (to compare a partial +Buffer use [`buf.slice()`][]). Numbers can range from 0 to 255. + +The `byteOffset` indicates the index in `buf` where searching begins. + +```js +const buf = Buffer.from('this is a buffer'); + +buf.includes('this'); + // returns true +buf.includes('is'); + // returns true +buf.includes(Buffer.from('a buffer')); + // returns true +buf.includes(97); // ascii for 'a' + // returns true +buf.includes(Buffer.from('a buffer example')); + // returns false +buf.includes(Buffer.from('a buffer example').slice(0,8)); + // returns true +buf.includes('this', 4); + // returns false +``` + +### buf.keys() + +* Return: {Iterator} + +Creates and returns an [iterator][] of Buffer keys (indices). + +```js +const buf = Buffer.from('buffer'); +for (var key of buf.keys()) { + console.log(key); +} +// prints: +// 0 +// 1 +// 2 +// 3 +// 4 +// 5 +``` + +### buf.length + +* {Number} + +Returns the amount of memory allocated for the Buffer in number of bytes. Note +that this does not necessarily reflect the amount of usable data within the +Buffer. For instance, in the example below, a Buffer with 1234 bytes is +allocated, but only 11 ASCII bytes are written. + +```js +const buf = Buffer.allocUnsafe(1234); + +console.log(buf.length); + // Prints: 1234 + +buf.write('some string', 0, 'ascii'); +console.log(buf.length); + // Prints: 1234 +``` + +While the `length` property is not immutable, changing the value of `length` +can result in undefined and inconsistent behavior. Applications that wish to +modify the length of a Buffer should therefore treat `length` as read-only and +use [`buf.slice()`][] to create a new Buffer. + +```js +var buf = Buffer.allocUnsafe(10); +buf.write('abcdefghj', 0, 'ascii'); +console.log(buf.length); + // Prints: 10 +buf = buf.slice(0,5); +console.log(buf.length); + // Prints: 5 +``` + +### buf.readDoubleBE(offset[, noAssert]) +### buf.readDoubleLE(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 8` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads a 64-bit double from the Buffer at the specified `offset` with specified +endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns +little endian). + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +```js +const buf = Buffer.from([1,2,3,4,5,6,7,8]); + +buf.readDoubleBE(); + // Returns: 8.20788039913184e-304 +buf.readDoubleLE(); + // Returns: 5.447603722011605e-270 +buf.readDoubleLE(1); + // throws RangeError: Index out of range + +buf.readDoubleLE(1, true); // Warning: reads passed end of buffer! + // Segmentation fault! don't do this! +``` + +### buf.readFloatBE(offset[, noAssert]) +### buf.readFloatLE(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 4` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads a 32-bit float from the Buffer at the specified `offset` with specified +endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns +little endian). + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +```js +const buf = Buffer.from([1,2,3,4]); + +buf.readFloatBE(); + // Returns: 2.387939260590663e-38 +buf.readFloatLE(); + // Returns: 1.539989614439558e-36 +buf.readFloatLE(1); + // throws RangeError: Index out of range + +buf.readFloatLE(1, true); // Warning: reads passed end of buffer! + // Segmentation fault! don't do this! +``` + +### buf.readInt8(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 1` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads a signed 8-bit integer from the Buffer at the specified `offset`. + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +Integers read from the Buffer are interpreted as two's complement signed values. + +```js +const buf = Buffer.from([1,-2,3,4]); + +buf.readInt8(0); + // returns 1 +buf.readInt8(1); + // returns -2 +``` + +### buf.readInt16BE(offset[, noAssert]) +### buf.readInt16LE(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 2` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads a signed 16-bit integer from the Buffer at the specified `offset` with +the specified endian format (`readInt16BE()` returns big endian, +`readInt16LE()` returns little endian). + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +Integers read from the Buffer are interpreted as two's complement signed values. + +```js +const buf = Buffer.from([1,-2,3,4]); + +buf.readInt16BE(); + // returns 510 +buf.readInt16LE(1); + // returns 1022 +``` + +### buf.readInt32BE(offset[, noAssert]) +### buf.readInt32LE(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 4` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads a signed 32-bit integer from the Buffer at the specified `offset` with +the specified endian format (`readInt32BE()` returns big endian, +`readInt32LE()` returns little endian). + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +Integers read from the Buffer are interpreted as two's complement signed values. + +```js +const buf = Buffer.from([1,-2,3,4]); + +buf.readInt32BE(); + // returns 33424132 +buf.readInt32LE(); + // returns 67370497 +buf.readInt32LE(1); + // throws RangeError: Index out of range +``` + +### buf.readIntBE(offset, byteLength[, noAssert]) +### buf.readIntLE(offset, byteLength[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - byteLength` +* `byteLength` {Number} `0 < byteLength <= 6` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads `byteLength` number of bytes from the Buffer at the specified `offset` +and interprets the result as a two's complement signed value. Supports up to 48 +bits of accuracy. For example: + +```js +const buf = Buffer.allocUnsafe(6); +buf.writeUInt16LE(0x90ab, 0); +buf.writeUInt32LE(0x12345678, 2); +buf.readIntLE(0, 6).toString(16); // Specify 6 bytes (48 bits) +// Returns: '1234567890ab' + +buf.readIntBE(0, 6).toString(16); +// Returns: -546f87a9cbee +``` + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +### buf.readUInt8(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 1` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads an unsigned 8-bit integer from the Buffer at the specified `offset`. + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +```js +const buf = Buffer.from([1,-2,3,4]); + +buf.readUInt8(0); + // returns 1 +buf.readUInt8(1); + // returns 254 +``` + +### buf.readUInt16BE(offset[, noAssert]) +### buf.readUInt16LE(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 2` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads an unsigned 16-bit integer from the Buffer at the specified `offset` with +specified endian format (`readUInt16BE()` returns big endian, +`readUInt16LE()` returns little endian). + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +Example: + +```js +const buf = Buffer.from([0x3, 0x4, 0x23, 0x42]); + +buf.readUInt16BE(0); + // Returns: 0x0304 +buf.readUInt16LE(0); + // Returns: 0x0403 +buf.readUInt16BE(1); + // Returns: 0x0423 +buf.readUInt16LE(1); + // Returns: 0x2304 +buf.readUInt16BE(2); + // Returns: 0x2342 +buf.readUInt16LE(2); + // Returns: 0x4223 +``` + +### buf.readUInt32BE(offset[, noAssert]) +### buf.readUInt32LE(offset[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - 4` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads an unsigned 32-bit integer from the Buffer at the specified `offset` with +specified endian format (`readUInt32BE()` returns big endian, +`readUInt32LE()` returns little endian). + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +Example: + +```js +const buf = Buffer.from([0x3, 0x4, 0x23, 0x42]); + +buf.readUInt32BE(0); + // Returns: 0x03042342 +console.log(buf.readUInt32LE(0)); + // Returns: 0x42230403 +``` + +### buf.readUIntBE(offset, byteLength[, noAssert]) +### buf.readUIntLE(offset, byteLength[, noAssert]) + +* `offset` {Number} `0 <= offset <= buf.length - byteLength` +* `byteLength` {Number} `0 < byteLength <= 6` +* `noAssert` {Boolean} Default: false +* Return: {Number} + +Reads `byteLength` number of bytes from the Buffer at the specified `offset` +and interprets the result as an unsigned integer. Supports up to 48 +bits of accuracy. For example: + +```js +const buf = Buffer.allocUnsafe(6); +buf.writeUInt16LE(0x90ab, 0); +buf.writeUInt32LE(0x12345678, 2); +buf.readUIntLE(0, 6).toString(16); // Specify 6 bytes (48 bits) +// Returns: '1234567890ab' + +buf.readUIntBE(0, 6).toString(16); +// Returns: ab9078563412 +``` + +Setting `noAssert` to `true` skips validation of the `offset`. This allows the +`offset` to be beyond the end of the Buffer. + +### buf.slice([start[, end]]) + +* `start` {Number} Default: 0 +* `end` {Number} Default: `buffer.length` +* Return: {Buffer} + +Returns a new Buffer that references the same memory as the original, but +offset and cropped by the `start` and `end` indices. + +**Note that modifying the new Buffer slice will modify the memory in the +original Buffer because the allocated memory of the two objects overlap.** + +Example: build a Buffer with the ASCII alphabet, take a slice, then modify one +byte from the original Buffer. + +```js +const buf1 = Buffer.allocUnsafe(26); + +for (var i = 0 ; i < 26 ; i++) { + buf1[i] = i + 97; // 97 is ASCII a +} + +const buf2 = buf1.slice(0, 3); +buf2.toString('ascii', 0, buf2.length); + // Returns: 'abc' +buf1[0] = 33; +buf2.toString('ascii', 0, buf2.length); + // Returns : '!bc' +``` + +Specifying negative indexes causes the slice to be generated relative to the +end of the Buffer rather than the beginning. + +```js +const buf = Buffer.from('buffer'); + +buf.slice(-6, -1).toString(); + // Returns 'buffe', equivalent to buf.slice(0, 5) +buf.slice(-6, -2).toString(); + // Returns 'buff', equivalent to buf.slice(0, 4) +buf.slice(-5, -2).toString(); + // Returns 'uff', equivalent to buf.slice(1, 4) +``` + +### buf.swap16() + +* Return: {Buffer} + +Interprets the `Buffer` as an array of unsigned 16-bit integers and swaps +the byte-order *in-place*. Throws a `RangeError` if the `Buffer` length is +not a multiple of 16 bits. The method returns a reference to the Buffer, so +calls can be chained. + +```js +const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); +console.log(buf); + // Prints Buffer(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8) +buf.swap16(); +console.log(buf); + // Prints Buffer(0x2, 0x1, 0x4, 0x3, 0x6, 0x5, 0x8, 0x7) +``` + +### buf.swap32() + +* Return: {Buffer} + +Interprets the `Buffer` as an array of unsigned 32-bit integers and swaps +the byte-order *in-place*. Throws a `RangeError` if the `Buffer` length is +not a multiple of 32 bits. The method returns a reference to the Buffer, so +calls can be chained. + +```js +const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); +console.log(buf); + // Prints Buffer(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8) +buf.swap32(); +console.log(buf); + // Prints Buffer(0x4, 0x3, 0x2, 0x1, 0x8, 0x7, 0x6, 0x5) +``` + +### buf.toString([encoding[, start[, end]]]) + +* `encoding` {String} Default: `'utf8'` +* `start` {Number} Default: 0 +* `end` {Number} Default: `buffer.length` +* Return: {String} + +Decodes and returns a string from the Buffer data using the specified +character set `encoding`. + +```js +const buf = Buffer.allocUnsafe(26); +for (var i = 0 ; i < 26 ; i++) { + buf[i] = i + 97; // 97 is ASCII a +} +buf.toString('ascii'); + // Returns: 'abcdefghijklmnopqrstuvwxyz' +buf.toString('ascii',0,5); + // Returns: 'abcde' +buf.toString('utf8',0,5); + // Returns: 'abcde' +buf.toString(undefined,0,5); + // Returns: 'abcde', encoding defaults to 'utf8' +``` + +### buf.toJSON() + +* Return: {Object} + +Returns a JSON representation of the Buffer instance. [`JSON.stringify()`][] +implicitly calls this function when stringifying a Buffer instance. + +Example: + +```js +const buf = Buffer.from('test'); +const json = JSON.stringify(buf); + +console.log(json); +// Prints: '{"type":"Buffer","data":[116,101,115,116]}' + +const copy = JSON.parse(json, (key, value) => { + return value && value.type === 'Buffer' + ? Buffer.from(value.data) + : value; + }); + +console.log(copy.toString()); +// Prints: 'test' +``` + +### buf.values() + +* Return: {Iterator} + +Creates and returns an [iterator][] for Buffer values (bytes). This function is +called automatically when the Buffer is used in a `for..of` statement. + +```js +const buf = Buffer.from('buffer'); +for (var value of buf.values()) { + console.log(value); +} +// prints: +// 98 +// 117 +// 102 +// 102 +// 101 +// 114 + +for (var value of buf) { + console.log(value); +} +// prints: +// 98 +// 117 +// 102 +// 102 +// 101 +// 114 +``` + +### buf.write(string[, offset[, length]][, encoding]) + +* `string` {String} Bytes to be written to buffer +* `offset` {Number} Default: 0 +* `length` {Number} Default: `buffer.length - offset` +* `encoding` {String} Default: `'utf8'` +* Return: {Number} Numbers of bytes written + +Writes `string` to the Buffer at `offset` using the given `encoding`. +The `length` parameter is the number of bytes to write. If the Buffer did not +contain enough space to fit the entire string, only a partial amount of the +string will be written however, it will not write only partially encoded +characters. + +```js +const buf = Buffer.allocUnsafe(256); +const len = buf.write('\u00bd + \u00bc = \u00be', 0); +console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); + // Prints: 12 bytes: ½ + ¼ = ¾ +``` + +### buf.writeDoubleBE(value, offset[, noAssert]) +### buf.writeDoubleLE(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 8` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` with specified endian +format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little +endian). The `value` argument *should* be a valid 64-bit double. Behavior is +not defined when `value` is anything other than a 64-bit double. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +Example: + +```js +const buf = Buffer.allocUnsafe(8); +buf.writeDoubleBE(0xdeadbeefcafebabe, 0); + +console.log(buf); + // Prints: + +buf.writeDoubleLE(0xdeadbeefcafebabe, 0); + +console.log(buf); + // Prints: +``` + +### buf.writeFloatBE(value, offset[, noAssert]) +### buf.writeFloatLE(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 4` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` with specified endian +format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little +endian). Behavior is not defined when `value` is anything other than a 32-bit +float. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +Example: + +```js +const buf = Buffer.allocUnsafe(4); +buf.writeFloatBE(0xcafebabe, 0); + +console.log(buf); + // Prints: + +buf.writeFloatLE(0xcafebabe, 0); + +console.log(buf); + // Prints: +``` + +### buf.writeInt8(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 1` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset`. The `value` should be a +valid signed 8-bit integer. Behavior is not defined when `value` is anything +other than a signed 8-bit integer. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +The `value` is interpreted and written as a two's complement signed integer. + +```js +const buf = Buffer.allocUnsafe(2); +buf.writeInt8(2, 0); +buf.writeInt8(-2, 1); +console.log(buf); + // Prints: +``` + +### buf.writeInt16BE(value, offset[, noAssert]) +### buf.writeInt16LE(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 2` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` with specified endian +format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little +endian). The `value` should be a valid signed 16-bit integer. Behavior is +not defined when `value` is anything other than a signed 16-bit integer. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +The `value` is interpreted and written as a two's complement signed integer. + +```js +const buf = Buffer.allocUnsafe(4); +buf.writeInt16BE(0x0102,0); +buf.writeInt16LE(0x0304,2); +console.log(buf); + // Prints: +``` + +### buf.writeInt32BE(value, offset[, noAssert]) +### buf.writeInt32LE(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 4` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` with specified endian +format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little +endian). The `value` should be a valid signed 32-bit integer. Behavior is +not defined when `value` is anything other than a signed 32-bit integer. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +The `value` is interpreted and written as a two's complement signed integer. + +```js +const buf = Buffer.allocUnsafe(8); +buf.writeInt32BE(0x01020304,0); +buf.writeInt32LE(0x05060708,4); +console.log(buf); + // Prints: +``` + +### buf.writeIntBE(value, offset, byteLength[, noAssert]) +### buf.writeIntLE(value, offset, byteLength[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - byteLength` +* `byteLength` {Number} `0 < byteLength <= 6` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` and `byteLength`. +Supports up to 48 bits of accuracy. For example: + +```js +const buf1 = Buffer.allocUnsafe(6); +buf1.writeUIntBE(0x1234567890ab, 0, 6); +console.log(buf1); + // Prints: + +const buf2 = Buffer.allocUnsafe(6); +buf2.writeUIntLE(0x1234567890ab, 0, 6); +console.log(buf2); + // Prints: +``` + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +Behavior is not defined when `value` is anything other than an integer. + +### buf.writeUInt8(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 1` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset`. The `value` should be a +valid unsigned 8-bit integer. Behavior is not defined when `value` is anything +other than an unsigned 8-bit integer. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +Example: + +```js +const buf = Buffer.allocUnsafe(4); +buf.writeUInt8(0x3, 0); +buf.writeUInt8(0x4, 1); +buf.writeUInt8(0x23, 2); +buf.writeUInt8(0x42, 3); + +console.log(buf); + // Prints: +``` + +### buf.writeUInt16BE(value, offset[, noAssert]) +### buf.writeUInt16LE(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 2` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` with specified endian +format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little +endian). The `value` should be a valid unsigned 16-bit integer. Behavior is +not defined when `value` is anything other than an unsigned 16-bit integer. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +Example: + +```js +const buf = Buffer.allocUnsafe(4); +buf.writeUInt16BE(0xdead, 0); +buf.writeUInt16BE(0xbeef, 2); + +console.log(buf); + // Prints: + +buf.writeUInt16LE(0xdead, 0); +buf.writeUInt16LE(0xbeef, 2); + +console.log(buf); + // Prints: +``` + +### buf.writeUInt32BE(value, offset[, noAssert]) +### buf.writeUInt32LE(value, offset[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - 4` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` with specified endian +format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little +endian). The `value` should be a valid unsigned 32-bit integer. Behavior is +not defined when `value` is anything other than an unsigned 32-bit integer. + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +Example: + +```js +const buf = Buffer.allocUnsafe(4); +buf.writeUInt32BE(0xfeedface, 0); + +console.log(buf); + // Prints: + +buf.writeUInt32LE(0xfeedface, 0); + +console.log(buf); + // Prints: +``` + +### buf.writeUIntBE(value, offset, byteLength[, noAssert]) +### buf.writeUIntLE(value, offset, byteLength[, noAssert]) + +* `value` {Number} Bytes to be written to Buffer +* `offset` {Number} `0 <= offset <= buf.length - byteLength` +* `byteLength` {Number} `0 < byteLength <= 6` +* `noAssert` {Boolean} Default: false +* Return: {Number} The offset plus the number of written bytes + +Writes `value` to the Buffer at the specified `offset` and `byteLength`. +Supports up to 48 bits of accuracy. For example: + +```js +const buf = Buffer.allocUnsafe(6); +buf.writeUIntBE(0x1234567890ab, 0, 6); +console.log(buf); + // Prints: +``` + +Set `noAssert` to true to skip validation of `value` and `offset`. This means +that `value` may be too large for the specific function and `offset` may be +beyond the end of the Buffer leading to the values being silently dropped. This +should not be used unless you are certain of correctness. + +Behavior is not defined when `value` is anything other than an unsigned integer. + +## buffer.INSPECT_MAX_BYTES + +* {Number} Default: 50 + +Returns the maximum number of bytes that will be returned when +`buffer.inspect()` is called. This can be overridden by user modules. See +[`util.inspect()`][] for more details on `buffer.inspect()` behavior. + +Note that this is a property on the `buffer` module as returned by +`require('buffer')`, not on the Buffer global or a Buffer instance. + +## Class: SlowBuffer + +Returns an un-pooled `Buffer`. + +In order to avoid the garbage collection overhead of creating many individually +allocated Buffers, by default allocations under 4KB are sliced from a single +larger allocated object. This approach improves both performance and memory +usage since v8 does not need to track and cleanup as many `Persistent` objects. + +In the case where a developer may need to retain a small chunk of memory from a +pool for an indeterminate amount of time, it may be appropriate to create an +un-pooled Buffer instance using `SlowBuffer` then copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + var data = socket.read(); + // allocate for retained data + var sb = SlowBuffer(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `SlowBuffer` should be used only as a last resort *after* a developer +has observed undue memory retention in their applications. + +### new SlowBuffer(size) + +* `size` Number + +Allocates a new `SlowBuffer` of `size` bytes. The `size` must be less than +or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. If a `size` less than 0 is specified, a zero-length `SlowBuffer` will be +created. + +The underlying memory for `SlowBuffer` instances is *not initialized*. The +contents of a newly created `SlowBuffer` are unknown and could contain +sensitive data. Use [`buf.fill(0)`][] to initialize a `SlowBuffer` to zeroes. + +```js +const SlowBuffer = require('buffer').SlowBuffer; +const buf = new SlowBuffer(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +[`Array#includes()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes +[`Array#indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf +[`buf.entries()`]: #buffer_buf_entries +[`buf.fill(0)`]: #buffer_buf_fill_value_offset_end_encoding +[`buf.keys()`]: #buffer_buf_keys +[`buf.slice()`]: #buffer_buf_slice_start_end +[`buf.values()`]: #buffer_buf_values +[`buf1.compare(buf2)`]: #buffer_buf_compare_target_targetstart_targetend_sourcestart_sourceend +[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify +[`RangeError`]: errors.html#errors_class_rangeerror +[`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length +[`util.inspect()`]: util.html#util_util_inspect_object_options +[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols +[RFC 4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5 +[buffer_from_array]: #buffer_class_method_buffer_from_array +[buffer_from_buffer]: #buffer_class_method_buffer_from_buffer +[buffer_from_arraybuf]: #buffer_class_method_buffer_from_arraybuffer_byteoffset_length +[buffer_from_string]: #buffer_class_method_buffer_from_str_encoding +[buffer_allocunsafe]: #buffer_class_method_buffer_allocraw_size +[buffer_alloc]: #buffer_class_method_buffer_alloc_size_fill_encoding +[`TypedArray.from()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from +[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView +[`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray diff --git a/doc/api/child_process.markdown b/doc/api/child_process.markdown deleted file mode 100644 index ae0b8ac9ed0afb..00000000000000 --- a/doc/api/child_process.markdown +++ /dev/null @@ -1,1028 +0,0 @@ -# Child Process - - Stability: 2 - Stable - -The `child_process` module provides the ability to spawn child processes in -a manner that is similar, but not identical, to [`popen(3)`][]. This capability -is primarily provided by the `child_process.spawn()` function: - -```js -const spawn = require('child_process').spawn; -const ls = spawn('ls', ['-lh', '/usr']); - -ls.stdout.on('data', (data) => { - console.log(`stdout: ${data}`); -}); - -ls.stderr.on('data', (data) => { - console.log(`stderr: ${data}`); -}); - -ls.on('close', (code) => { - console.log(`child process exited with code ${code}`); -}); -``` - -By default, pipes for `stdin`, `stdout` and `stderr` are established between -the parent Node.js process and the spawned child. It is possible to stream data -through these pipes in a non-blocking way. *Note, however, that some programs -use line-buffered I/O internally. While that does not affect Node.js, it can -mean that data sent to the child process may not be immediately consumed.* - -The `child_process.spawn()` method spawns the child process asynchronously, -without blocking the Node.js event loop. The `child_process.spawnSync()` -function provides equivalent functionality in a synchronous manner that blocks -the event loop until the spawned process either exits or is terminated. - -For convenience, the `child_process` module provides a handful of synchronous -and asynchronous alternatives to [`child_process.spawn()`][] and -[`child_process.spawnSync()`][]. *Note that each of these alternatives are -implemented on top of `child_process.spawn()` or `child_process.spawnSync()`.* - - * `child_process.exec()`: spawns a shell and runs a command within that shell, - passing the `stdout` and `stderr` to a callback function when complete. - * `child_process.execFile()`: similar to `child_process.exec()` except that - it spawns the command directly without first spawning a shell. - * `child_process.fork()`: spawns a new Node.js process and invokes a - specified module with an IPC communication channel established that allows - sending messages between parent and child. - * `child_process.execSync()`: a synchronous version of - `child_process.exec()` that *will* block the Node.js event loop. - * `child_process.execFileSync()`: a synchronous version of - `child_process.execFile()` that *will* block the Node.js event loop. - -For certain use cases, such as automating shell scripts, the -[synchronous counterparts][] may be more convenient. In many cases, however, -the synchronous methods can have significant impact on performance due to -stalling the event loop while spawned processes complete. - -## Asynchronous Process Creation - -The `child_process.spawn()`, `child_process.fork()`, `child_process.exec()`, -and `child_process.execFile()` methods all follow the idiomatic asynchronous -programming pattern typical of other Node.js APIs. - -Each of the methods returns a [`ChildProcess`][] instance. These objects -implement the Node.js [`EventEmitter`][] API, allowing the parent process to -register listener functions that are called when certain events occur during -the life cycle of the child process. - -The `child_process.exec()` and `child_process.execFile()` methods additionally -allow for an optional `callback` function to be specified that is invoked -when the child process terminates. - -### Spawning `.bat` and `.cmd` files on Windows - -The importance of the distinction between `child_process.exec()` and -`child_process.execFile()` can vary based on platform. On Unix-type operating -systems (Unix, Linux, OSX) `child_process.execFile()` can be more efficient -because it does not spawn a shell. On Windows, however, `.bat` and `.cmd` -files are not executable on their own without a terminal, and therefore cannot -be launched using `child_process.execFile()`. When running on Windows, `.bat` -and `.cmd` files can be invoked using `child_process.spawn()` with the `shell` -option set, with `child_process.exec()`, or by spawning `cmd.exe` and passing -the `.bat` or `.cmd` file as an argument (which is what the `shell` option and -`child_process.exec()` do). - -```js -// On Windows Only ... -const spawn = require('child_process').spawn; -const bat = spawn('cmd.exe', ['/c', 'my.bat']); - -bat.stdout.on('data', (data) => { - console.log(data); -}); - -bat.stderr.on('data', (data) => { - console.log(data); -}); - -bat.on('exit', (code) => { - console.log(`Child exited with code ${code}`); -}); - -// OR... -const exec = require('child_process').exec; -exec('my.bat', (err, stdout, stderr) => { - if (err) { - console.error(err); - return; - } - console.log(stdout); -}); -``` - -### child_process.exec(command[, options][, callback]) - -* `command` {String} The command to run, with space-separated arguments -* `options` {Object} - * `cwd` {String} Current working directory of the child process - * `env` {Object} Environment key-value pairs - * `encoding` {String} (Default: 'utf8') - * `shell` {String} Shell to execute the command with - (Default: '/bin/sh' on UNIX, 'cmd.exe' on Windows, The shell should - understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, - command line parsing should be compatible with `cmd.exe`.) - * `timeout` {Number} (Default: 0) - * `maxBuffer` {Number} largest amount of data (in bytes) allowed on stdout or - stderr - if exceeded child process is killed (Default: `200*1024`) - * `killSignal` {String} (Default: 'SIGTERM') - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) -* `callback` {Function} called with the output when process terminates - * `error` {Error} - * `stdout` {String|Buffer} - * `stderr` {String|Buffer} -* Return: {ChildProcess} - -Spawns a shell then executes the `command` within that shell, buffering any -generated output. - -```js -const exec = require('child_process').exec; -const child = exec('cat *.js bad_file | wc -l', - (error, stdout, stderr) => { - console.log(`stdout: ${stdout}`); - console.log(`stderr: ${stderr}`); - if (error !== null) { - console.log(`exec error: ${error}`); - } -}); -``` - -If a `callback` function is provided, it is called with the arguments -`(error, stdout, stderr)`. On success, `error` will be `null`. On error, -`error` will be an instance of [`Error`][]. The `error.code` property will be -the exit code of the child process while `error.signal` will be set to the -signal that terminated the process. Any exit code other than `0` is considered -to be an error. - -The `stdout` and `stderr` arguments passed to the callback will contain the -stdout and stderr output of the child process. By default, Node.js will decode -the output as UTF-8 and pass strings to the callback. The `encoding` option -can be used to specify the character encoding used to decode the stdout and -stderr output. If `encoding` is `'buffer'`, `Buffer` objects will be passed to -the callback instead. - -The `options` argument may be passed as the second argument to customize how -the process is spawned. The default options are: - -```js -{ - encoding: 'utf8', - timeout: 0, - maxBuffer: 200*1024, - killSignal: 'SIGTERM', - cwd: null, - env: null -} -``` - -If `timeout` is greater than `0`, the parent will send the the signal -identified by the `killSignal` property (the default is `'SIGTERM'`) if the -child runs longer than `timeout` milliseconds. - -The `maxBuffer` option specifies the largest amount of data (in bytes) allowed -on stdout or stderr - if this value is exceeded then the child process is -terminated. - -*Note: Unlike the `exec()` POSIX system call, `child_process.exec()` does not -replace the existing process and uses a shell to execute the command.* - -### child_process.execFile(file[, args][, options][, callback]) - -* `file` {String} The name or path of the executable file to run -* `args` {Array} List of string arguments -* `options` {Object} - * `cwd` {String} Current working directory of the child process - * `env` {Object} Environment key-value pairs - * `encoding` {String} (Default: 'utf8') - * `timeout` {Number} (Default: 0) - * `maxBuffer` {Number} largest amount of data (in bytes) allowed on stdout or - stderr - if exceeded child process is killed (Default: 200\*1024) - * `killSignal` {String} (Default: 'SIGTERM') - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) -* `callback` {Function} called with the output when process terminates - * `error` {Error} - * `stdout` {String|Buffer} - * `stderr` {String|Buffer} -* Return: {ChildProcess} - -The `child_process.execFile()` function is similar to [`child_process.exec()`][] -except that it does not spawn a shell. Rather, the specified executable `file` -is spawned directly as a new process making it slightly more efficient than -[`child_process.exec()`][]. - -The same options as `child_process.exec()` are supported. Since a shell is not -spawned, behaviors such as I/O redirection and file globbing are not supported. - -```js -const execFile = require('child_process').execFile; -const child = execFile('node', ['--version'], (error, stdout, stderr) => { - if (error) { - throw error; - } - console.log(stdout); -}); -``` - -The `stdout` and `stderr` arguments passed to the callback will contain the -stdout and stderr output of the child process. By default, Node.js will decode -the output as UTF-8 and pass strings to the callback. The `encoding` option -can be used to specify the character encoding used to decode the stdout and -stderr output. If `encoding` is `'buffer'`, `Buffer` objects will be passed to -the callback instead. - -### child_process.fork(modulePath[, args][, options]) - -* `modulePath` {String} The module to run in the child -* `args` {Array} List of string arguments -* `options` {Object} - * `cwd` {String} Current working directory of the child process - * `env` {Object} Environment key-value pairs - * `execPath` {String} Executable used to create the child process - * `execArgv` {Array} List of string arguments passed to the executable - (Default: `process.execArgv`) - * `silent` {Boolean} If true, stdin, stdout, and stderr of the child will be - piped to the parent, otherwise they will be inherited from the parent, see - the `'pipe'` and `'inherit'` options for [`child_process.spawn()`][]'s - [`stdio`][] for more details (default is false) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) -* Return: {ChildProcess} - -The `child_process.fork()` method is a special case of -[`child_process.spawn()`][] used specifically to spawn new Node.js processes. -Like `child_process.spawn()`, a `ChildProcess` object is returned. The returned -`ChildProcess` will have an additional communication channel built-in that -allows messages to be passed back and forth between the parent and child. See -[`ChildProcess#send()`][] for details. - -It is important to keep in mind that spawned Node.js child processes are -independent of the parent with exception of the IPC communication channel -that is established between the two. Each process has it's own memory, with -their own V8 instances. Because of the additional resource allocations -required, spawning a large number of child Node.js processes is not -recommended. - -By default, `child_process.fork()` will spawn new Node.js instances using the -`process.execPath` of the parent process. The `execPath` property in the -`options` object allows for an alternative execution path to be used. - -Node.js processes launched with a custom `execPath` will communicate with the -parent process using the file descriptor (fd) identified using the -environment variable `NODE_CHANNEL_FD` on the child process. The input and -output on this fd is expected to be line delimited JSON objects. - -*Note: Unlike the `fork()` POSIX system call, [`child_process.fork()`][] does -not clone the current process.* - -### child_process.spawn(command[, args][, options]) - -* `command` {String} The command to run -* `args` {Array} List of string arguments -* `options` {Object} - * `cwd` {String} Current working directory of the child process - * `env` {Object} Environment key-value pairs - * `stdio` {Array|String} Child's stdio configuration. (See - [`options.stdio`][]) - * `detached` {Boolean} Prepare child to run independently of its parent - process. Specific behavior depends on the platform, see - [`options.detached`][]) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses - '/bin/sh' on UNIX, and 'cmd.exe' on Windows. A different shell can be - specified as a string. The shell should understand the `-c` switch on UNIX, - or `/s /c` on Windows. Defaults to `false` (no shell). -* return: {ChildProcess} - -The `child_process.spawn()` method spawns a new process using the given -`command`, with command line arguments in `args`. If omitted, `args` defaults -to an empty array. - -A third argument may be used to specify additional options, with these defaults: - -```js -{ - cwd: undefined, - env: process.env -} -``` - -Use `cwd` to specify the working directory from which the process is spawned. -If not given, the default is to inherit the current working directory. - -Use `env` to specify environment variables that will be visible to the new -process, the default is `process.env`. - -Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the -exit code: - -```js -const spawn = require('child_process').spawn; -const ls = spawn('ls', ['-lh', '/usr']); - -ls.stdout.on('data', (data) => { - console.log(`stdout: ${data}`); -}); - -ls.stderr.on('data', (data) => { - console.log(`stderr: ${data}`); -}); - -ls.on('close', (code) => { - console.log(`child process exited with code ${code}`); -}); -``` - - -Example: A very elaborate way to run 'ps ax | grep ssh' - -```js -const spawn = require('child_process').spawn; -const ps = spawn('ps', ['ax']); -const grep = spawn('grep', ['ssh']); - -ps.stdout.on('data', (data) => { - grep.stdin.write(data); -}); - -ps.stderr.on('data', (data) => { - console.log(`ps stderr: ${data}`); -}); - -ps.on('close', (code) => { - if (code !== 0) { - console.log(`ps process exited with code ${code}`); - } - grep.stdin.end(); -}); - -grep.stdout.on('data', (data) => { - console.log(`${data}`); -}); - -grep.stderr.on('data', (data) => { - console.log(`grep stderr: ${data}`); -}); - -grep.on('close', (code) => { - if (code !== 0) { - console.log(`grep process exited with code ${code}`); - } -}); -``` - - -Example of checking for failed exec: - -```js -const spawn = require('child_process').spawn; -const child = spawn('bad_command'); - -child.on('error', (err) => { - console.log('Failed to start child process.'); -}); -``` - -#### options.detached - -On Windows, setting `options.detached` to `true` makes it possible for the -child process to continue running after the parent exits. The child will have -its own console window. *Once enabled for a child process, it cannot be -disabled*. - -On non-Windows platforms, if `options.detached` is set to `true`, the child -process will be made the leader of a new process group and session. Note that -child processes may continue running after the parent exits regardless of -whether they are detached or not. See `setsid(2)` for more information. - -By default, the parent will wait for the detached child to exit. To prevent -the parent from waiting for a given `child`, use the `child.unref()` method. -Doing so will cause the parent's event loop to not include the child in its -reference count, allowing the parent to exit independently of the child, unless -there is an established IPC channel between the child and parent. - -When using the `detached` option to start a long-running process, the process -will not stay running in the background after the parent exits unless it is -provided with a `stdio` configuration that is not connected to the parent. -If the parent's `stdio` is inherited, the child will remain attached to the -controlling terminal. - -Example of a long-running process, by detaching and also ignoring its parent -`stdio` file descriptors, in order to ignore the parent's termination: - -```js -const spawn = require('child_process').spawn; - -const child = spawn(process.argv[0], ['child_program.js'], { - detached: true, - stdio: ['ignore'] -}); - -child.unref(); -``` - -Alternatively one can redirect the child process' output into files: - -```js -const fs = require('fs'); -const spawn = require('child_process').spawn; -const out = fs.openSync('./out.log', 'a'); -const err = fs.openSync('./out.log', 'a'); - -const child = spawn('prg', [], { - detached: true, - stdio: [ 'ignore', out, err ] -}); - -child.unref(); -``` - -#### options.stdio - -The `options.stdio` option is used to configure the pipes that are established -between the parent and child process. By default, the child's stdin, stdout, -and stderr are redirected to corresponding `child.stdin`, `child.stdout`, and -`child.stderr` streams on the `ChildProcess` object. This is equivalent to -setting the `options.stdio` equal to `['pipe', 'pipe', 'pipe']`. - -For convenience, `options.stdio` may be one of the following strings: - -* `'pipe'` - equivalent to `['pipe', 'pipe', 'pipe']` (the default) -* `'ignore'` - equivalent to `['ignore', 'ignore', 'ignore']` -* `'inherit'` - equivalent to `[process.stdin, process.stdout, process.stderr]` - or `[0,1,2]` - -Otherwise, the value of `option.stdio` is an array where each index corresponds -to an fd in the child. The fds 0, 1, and 2 correspond to stdin, stdout, -and stderr, respectively. Additional fds can be specified to create additional -pipes between the parent and child. The value is one of the following: - -1. `'pipe'` - Create a pipe between the child process and the parent process. - The parent end of the pipe is exposed to the parent as a property on the - `child_process` object as `ChildProcess.stdio[fd]`. Pipes created for - fds 0 - 2 are also available as ChildProcess.stdin, ChildProcess.stdout - and ChildProcess.stderr, respectively. -2. `'ipc'` - Create an IPC channel for passing messages/file descriptors - between parent and child. A ChildProcess may have at most *one* IPC stdio - file descriptor. Setting this option enables the ChildProcess.send() method. - If the child writes JSON messages to this file descriptor, the - `ChildProcess.on('message')` event handler will be triggered in the parent. - If the child is a Node.js process, the presence of an IPC channel will enable - `process.send()`, `process.disconnect()`, `process.on('disconnect')`, and - `process.on('message')` within the child. -3. `'ignore'` - Instructs Node.js to ignore the fd in the child. While Node.js - will always open fds 0 - 2 for the processes it spawns, setting the fd to - `'ignore'` will cause Node.js to open `/dev/null` and attach it to the - child's fd. -4. `Stream` object - Share a readable or writable stream that refers to a tty, - file, socket, or a pipe with the child process. The stream's underlying - file descriptor is duplicated in the child process to the fd that - corresponds to the index in the `stdio` array. Note that the stream must - have an underlying descriptor (file streams do not until the `'open'` - event has occurred). -5. Positive integer - The integer value is interpreted as a file descriptor - that is is currently open in the parent process. It is shared with the child - process, similar to how `Stream` objects can be shared. -6. `null`, `undefined` - Use default value. For stdio fds 0, 1 and 2 (in other - words, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the - default is `'ignore'`. - -Example: - -```js -const spawn = require('child_process').spawn; - -// Child will use parent's stdios -spawn('prg', [], { stdio: 'inherit' }); - -// Spawn child sharing only stderr -spawn('prg', [], { stdio: ['pipe', 'pipe', process.stderr] }); - -// Open an extra fd=4, to interact with programs presenting a -// startd-style interface. -spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] }); -``` - -*It is worth noting that when an IPC channel is established between the -parent and child processes, and the child is a Node.js process, the child -is launched with the IPC channel unreferenced (using `unref()`) until the -child registers an event handler for the `process.on('disconnected')` event. -This allows the child to exit normally without the process being held open -by the open IPC channel.* - -See also: [`child_process.exec()`][] and [`child_process.fork()`][] - -## Synchronous Process Creation - -The `child_process.spawnSync()`, `child_process.execSync()`, and -`child_process.execFileSync()` methods are **synchronous** and **WILL** block -the Node.js event loop, pausing execution of any additional code until the -spawned process exits. - -Blocking calls like these are mostly useful for simplifying general purpose -scripting tasks and for simplifying the loading/processing of application -configuration at startup. - -### child_process.execFileSync(file[, args][, options]) - -* `file` {String} The name or path of the executable file to run -* `args` {Array} List of string arguments -* `options` {Object} - * `cwd` {String} Current working directory of the child process - * `input` {String|Buffer} The value which will be passed as stdin to the spawned process - - supplying this value will override `stdio[0]` - * `stdio` {Array} Child's stdio configuration. (Default: 'pipe') - - `stderr` by default will be output to the parent process' stderr unless - `stdio` is specified - * `env` {Object} Environment key-value pairs - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - * `timeout` {Number} In milliseconds the maximum amount of time the process is allowed to run. (Default: undefined) - * `killSignal` {String} The signal value to be used when the spawned process will be killed. (Default: 'SIGTERM') - * `maxBuffer` {Number} largest amount of data (in bytes) allowed on stdout or - stderr - if exceeded child process is killed - * `encoding` {String} The encoding used for all stdio inputs and outputs. (Default: 'buffer') -* return: {Buffer|String} The stdout from the command - -The `child_process.execFileSync()` method is generally identical to -`child_process.execFile()` with the exception that the method will not return -until the child process has fully closed. When a timeout has been encountered -and `killSignal` is sent, the method won't return until the process has -completely exited. *Note that if the child process intercepts and handles -the `SIGTERM` signal and does not exit, the parent process will still wait -until the child process has exited.* - -If the process times out, or has a non-zero exit code, this method ***will*** -throw. The [`Error`][] object will contain the entire result from -[`child_process.spawnSync()`][] - -### child_process.execSync(command[, options]) - -* `command` {String} The command to run -* `options` {Object} - * `cwd` {String} Current working directory of the child process - * `input` {String|Buffer} The value which will be passed as stdin to the spawned process - - supplying this value will override `stdio[0]` - * `stdio` {Array} Child's stdio configuration. (Default: 'pipe') - - `stderr` by default will be output to the parent process' stderr unless - `stdio` is specified - * `env` {Object} Environment key-value pairs - * `shell` {String} Shell to execute the command with - (Default: '/bin/sh' on UNIX, 'cmd.exe' on Windows, The shell should - understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, - command line parsing should be compatible with `cmd.exe`.) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - * `timeout` {Number} In milliseconds the maximum amount of time the process is allowed to run. (Default: undefined) - * `killSignal` {String} The signal value to be used when the spawned process will be killed. (Default: 'SIGTERM') - * `maxBuffer` {Number} largest amount of data (in bytes) allowed on stdout or - stderr - if exceeded child process is killed - * `encoding` {String} The encoding used for all stdio inputs and outputs. (Default: 'buffer') -* return: {Buffer|String} The stdout from the command - -The `child_process.execSync()` method is generally identical to -`child_process.exec()` with the exception that the method will not return until -the child process has fully closed. When a timeout has been encountered and -`killSignal` is sent, the method won't return until the process has completely -exited. *Note that if the child process intercepts and handles the `SIGTERM` -signal and doesn't exit, the parent process will wait until the child -process has exited.* - -If the process times out, or has a non-zero exit code, this method ***will*** -throw. The [`Error`][] object will contain the entire result from -[`child_process.spawnSync()`][] - -### child_process.spawnSync(command[, args][, options]) - -* `command` {String} The command to run -* `args` {Array} List of string arguments -* `options` {Object} - * `cwd` {String} Current working directory of the child process - * `input` {String|Buffer} The value which will be passed as stdin to the spawned process - - supplying this value will override `stdio[0]` - * `stdio` {Array} Child's stdio configuration. - * `env` {Object} Environment key-value pairs - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - * `timeout` {Number} In milliseconds the maximum amount of time the process is allowed to run. (Default: undefined) - * `killSignal` {String} The signal value to be used when the spawned process will be killed. (Default: 'SIGTERM') - * `maxBuffer` {Number} largest amount of data (in bytes) allowed on stdout or - stderr - if exceeded child process is killed - * `encoding` {String} The encoding used for all stdio inputs and outputs. (Default: 'buffer') - * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses - '/bin/sh' on UNIX, and 'cmd.exe' on Windows. A different shell can be - specified as a string. The shell should understand the `-c` switch on UNIX, - or `/s /c` on Windows. Defaults to `false` (no shell). -* return: {Object} - * `pid` {Number} Pid of the child process - * `output` {Array} Array of results from stdio output - * `stdout` {Buffer|String} The contents of `output[1]` - * `stderr` {Buffer|String} The contents of `output[2]` - * `status` {Number} The exit code of the child process - * `signal` {String} The signal used to kill the child process - * `error` {Error} The error object if the child process failed or timed out - -The `child_process.spawnSync()` method is generally identical to -`child_process.spawn()` with the exception that the function will not return -until the child process has fully closed. When a timeout has been encountered -and `killSignal` is sent, the method won't return until the process has -completely exited. Note that if the process intercepts and handles the -`SIGTERM` signal and doesn't exit, the parent process will wait until the child -process has exited. - -## Class: ChildProcess - -Instances of the `ChildProcess` class are [`EventEmitters`][] that represent -spawned child processes. - -Instances of `ChildProcess` are not intended to be created directly. Rather, -use the [`child_process.spawn()`][], [`child_process.exec()`][], -[`child_process.execFile()`][], or [`child_process.fork()`][] methods to create -instances of `ChildProcess`. - -### Event: 'close' - -* `code` {Number} the exit code if the child exited on its own. -* `signal` {String} the signal by which the child process was terminated. - -The `'close'` event is emitted when the stdio streams of a child process have -been closed. This is distinct from the `'exit'` event, since multiple -processes might share the same stdio streams. - -### Event: 'disconnect' - -The `'disconnect'` event is emitted after calling the -`ChildProcess.disconnect()` method in the parent or child process. After -disconnecting it is no longer possible to send or receive messages, and the -`ChildProcess.connected` property is false. - -### Event: 'error' - -* `err` {Error} the error. - -The `'error'` event is emitted whenever: - -1. The process could not be spawned, or -2. The process could not be killed, or -3. Sending a message to the child process failed. - -Note that the `'exit'` event may or may not fire after an error has occurred. -If you are listening to both the `'exit'` and `'error'` events, it is important -to guard against accidentally invoking handler functions multiple times. - -See also [`ChildProcess#kill()`][] and [`ChildProcess#send()`][]. - -### Event: 'exit' - -* `code` {Number} the exit code if the child exited on its own. -* `signal` {String} the signal by which the child process was terminated. - -The `'exit'` event is emitted after the child process ends. If the process -exited, `code` is the final exit code of the process, otherwise `null`. If the -process terminated due to receipt of a signal, `signal` is the string name of -the signal, otherwise `null`. One of the two will always be non-null. - -Note that when the `'exit'` event is triggered, child process stdio streams -might still be open. - -Also, note that Node.js establishes signal handlers for `SIGINT` and -`SIGTERM` and Node.js processes will not terminate immediately due to receipt -of those signals. Rather, Node.js will perform a sequence of cleanup actions -and then will re-raise the handled signal. - -See `waitpid(2)`. - -### Event: 'message' - -* `message` {Object} a parsed JSON object or primitive value. -* `sendHandle` {Handle} a [`net.Socket`][] or [`net.Server`][] object, or - undefined. - -The `'message'` event is triggered when a child process uses `process.send()` -to send messages. - -### child.connected - -* {Boolean} Set to false after `.disconnect` is called - -The `child.connected` property indicates whether it is still possible to send -and receive messages from a child process. When `child.connected` is false, it -is no longer possible to send or receive messages. - -### child.disconnect() - -Closes the IPC channel between parent and child, allowing the child to exit -gracefully once there are no other connections keeping it alive. After calling -this method the `child.connected` and `process.connected` properties in both -the parent and child (respectively) will be set to `false`, and it will be no -longer possible to pass messages between the processes. - -The `'disconnect'` event will be emitted when there are no messages in the -process of being received. This will most often be triggered immediately after -calling `child.disconnect()`. - -Note that when the child process is a Node.js instance (e.g. spawned using -[`child_process.fork()`]), the `process.disconnect()` method can be invoked -within the child process to close the IPC channel as well. - -### child.kill([signal]) - -* `signal` {String} - -The `child.kill()` methods sends a signal to the child process. If no argument -is given, the process will be sent the `'SIGTERM'` signal. See `signal(7)` for -a list of available signals. - -```js -const spawn = require('child_process').spawn; -const grep = spawn('grep', ['ssh']); - -grep.on('close', (code, signal) => { - console.log( - `child process terminated due to receipt of signal ${signal}`); -}); - -// Send SIGHUP to process -grep.kill('SIGHUP'); -``` - -The `ChildProcess` object may emit an `'error'` event if the signal cannot be -delivered. Sending a signal to a child process that has already exited is not -an error but may have unforeseen consequences. Specifically, if the process -identifier (PID) has been reassigned to another process, the signal will be -delivered to that process instead which can have unexpected results. - -Note that while the function is called `kill`, the signal delivered to the -child process may not actually terminate the process. - -See `kill(2)` - -### child.pid - -* {Number} Integer - -Returns the process identifier (PID) of the child process. - -Example: - -```js -const spawn = require('child_process').spawn; -const grep = spawn('grep', ['ssh']); - -console.log(`Spawned child pid: ${grep.pid}`); -grep.stdin.end(); -``` - -### child.send(message[, sendHandle[, options]][, callback]) - -* `message` {Object} -* `sendHandle` {Handle} -* `options` {Object} -* `callback` {Function} -* Return: {Boolean} - -When an IPC channel has been established between the parent and child ( -i.e. when using [`child_process.fork()`][]), the `child.send()` method can be -used to send messages to the child process. When the child process is a Node.js -instance, these messages can be received via the `process.on('message')` event. - -For example, in the parent script: - -```js -const cp = require('child_process'); -const n = cp.fork(`${__dirname}/sub.js`); - -n.on('message', (m) => { - console.log('PARENT got message:', m); -}); - -n.send({ hello: 'world' }); -``` - -And then the child script, `'sub.js'` might look like this: - -```js -process.on('message', (m) => { - console.log('CHILD got message:', m); -}); - -process.send({ foo: 'bar' }); -``` - -Child Node.js processes will have a `process.send()` method of their own that -allows the child to send messages back to the parent. - -There is a special case when sending a `{cmd: 'NODE_foo'}` message. All messages -containing a `NODE_` prefix in its `cmd` property are considered to be reserved -for use within Node.js core and will not be emitted in the child's -`process.on('message')` event. Rather, such messages are emitted using the -`process.on('internalMessage')` event and are consumed internally by Node.js. -Applications should avoid using such messages or listening for -`'internalMessage'` events as it is subject to change without notice. - -The optional `sendHandle` argument that may be passed to `child.send()` is for -passing a TCP server or socket object to the child process. The child will -receive the object as the second argument passed to the callback function -registered on the `process.on('message')` event. - -The `options` argument, if present, is an object used to parameterize the -sending of certain types of handles. `options` supports the following -properties: - - * `keepOpen` - A Boolean value that can be used when passing instances of - `net.Socket`. When `true`, the socket is kept open in the sending process. - Defaults to `false`. - -The optional `callback` is a function that is invoked after the message is -sent but before the child may have received it. The function is called with a -single argument: `null` on success, or an [`Error`][] object on failure. - -If no `callback` function is provided and the message cannot be sent, an -`'error'` event will be emitted by the `ChildProcess` object. This can happen, -for instance, when the child process has already exited. - -`child.send()` will return `false` if the channel has closed or when the -backlog of unsent messages exceeds a threshold that makes it unwise to send -more. Otherwise, the method returns `true`. The `callback` function can be -used to implement flow control. - -#### Example: sending a server object - -The `sendHandle` argument can be used, for instance, to pass the handle of -a TCP server object to the child process as illustrated in the example below: - -```js -const child = require('child_process').fork('child.js'); - -// Open up the server object and send the handle. -const server = require('net').createServer(); -server.on('connection', (socket) => { - socket.end('handled by parent'); -}); -server.listen(1337, () => { - child.send('server', server); -}); -``` - -The child would then receive the server object as: - -```js -process.on('message', (m, server) => { - if (m === 'server') { - server.on('connection', (socket) => { - socket.end('handled by child'); - }); - } -}); -``` - -Once the server is now shared between the parent and child, some connections -can be handled by the parent and some by the child. - -While the example above uses a server created using the `net` module, `dgram` -module servers use exactly the same workflow with the exceptions of listening on -a `'message'` event instead of `'connection'` and using `server.bind` instead of -`server.listen`. This is, however, currently only supported on UNIX platforms. - -#### Example: sending a socket object - -Similarly, the `sendHandler` argument can be used to pass the handle of a -socket to the child process. The example below spawns two children that each -handle connections with "normal" or "special" priority: - -```js -const normal = require('child_process').fork('child.js', ['normal']); -const special = require('child_process').fork('child.js', ['special']); - -// Open up the server and send sockets to child -const server = require('net').createServer(); -server.on('connection', (socket) => { - - // If this is special priority - if (socket.remoteAddress === '74.125.127.100') { - special.send('socket', socket); - return; - } - // This is normal priority - normal.send('socket', socket); -}); -server.listen(1337); -``` - -The `child.js` would receive the socket handle as the second argument passed -to the event callback function: - -```js -process.on('message', (m, socket) => { - if (m === 'socket') { - socket.end(`Request handled with ${process.argv[2]} priority`); - } -}); -``` - -Once a socket has been passed to a child, the parent is no longer capable of -tracking when the socket is destroyed. To indicate this, the `.connections` -property becomes `null`. It is recommended not to use `.maxConnections` when -this occurs. - -*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.* - -### child.stderr - -* {Stream} - -A `Readable Stream` that represents the child process's `stderr`. - -If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, -then this will be `undefined`. - -`child.stderr` is an alias for `child.stdio[2]`. Both properties will refer to -the same value. - -### child.stdin - -* {Stream} - -A `Writable Stream` that represents the child process's `stdin`. - -*Note that if a child process waits to read all of its input, the child will not -continue until this stream has been closed via `end()`.* - -If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, -then this will be `undefined`. - -`child.stdin` is an alias for `child.stdio[0]`. Both properties will refer to -the same value. - -### child.stdio - -* {Array} - -A sparse array of pipes to the child process, corresponding with positions in -the [`stdio`][] option passed to [`child_process.spawn()`][] that have been set -to the value `'pipe'`. Note that `child.stdio[0]`, `child.stdio[1]`, and -`child.stdio[2]` are also available as `child.stdin`, `child.stdout`, and -`child.stderr`, respectively. - -In the following example, only the child's fd `1` (stdout) is configured as a -pipe, so only the parent's `child.stdio[1]` is a stream, all other values in -the array are `null`. - -```js -const assert = require('assert'); -const fs = require('fs'); -const child_process = require('child_process'); - -const child = child_process.spawn('ls', { - stdio: [ - 0, // Use parents stdin for child - 'pipe', // Pipe child's stdout to parent - fs.openSync('err.out', 'w') // Direct child's stderr to a file - ] -}); - -assert.equal(child.stdio[0], null); -assert.equal(child.stdio[0], child.stdin); - -assert(child.stdout); -assert.equal(child.stdio[1], child.stdout); - -assert.equal(child.stdio[2], null); -assert.equal(child.stdio[2], child.stderr); -``` - -### child.stdout - -* {Stream} - -A `Readable Stream` that represents the child process's `stdout`. - -If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, -then this will be `undefined`. - -`child.stdout` is an alias for `child.stdio[1]`. Both properties will refer -to the same value. - -[`popen(3)`]: http://linux.die.net/man/3/popen -[`ChildProcess`]: #child_process_child_process -[`child_process.exec()`]: #child_process_child_process_exec_command_options_callback -[`child_process.execFile()`]: #child_process_child_process_execfile_file_args_options_callback -[`child_process.fork()`]: #child_process_child_process_fork_modulepath_args_options -[`child_process.spawn()`]: #child_process_child_process_spawn_command_args_options -[`child_process.spawnSync()`]: #child_process_child_process_spawnsync_command_args_options -[`ChildProcess#kill()`]: #child_process_child_kill_signal -[`ChildProcess#send()`]: #child_process_child_send_message_sendhandle_callback -[`Error`]: errors.html#errors_class_error -[`EventEmitter`]: events.html#events_class_events_eventemitter -[`EventEmitters`]: events.html#events_class_events_eventemitter -[`net.Server`]: net.html#net_class_net_server -[`net.Socket`]: net.html#net_class_net_socket -[`options.detached`]: #child_process_options_detached -[`options.stdio`]: #child_process_options_stdio -[`stdio`]: #child_process_options_stdio -[synchronous counterparts]: #child_process_synchronous_process_creation -[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify \ No newline at end of file diff --git a/doc/api/child_process.md b/doc/api/child_process.md new file mode 100644 index 00000000000000..2c8665be58f548 --- /dev/null +++ b/doc/api/child_process.md @@ -0,0 +1,1072 @@ +# Child Process + + Stability: 2 - Stable + +The `child_process` module provides the ability to spawn child processes in +a manner that is similar, but not identical, to [`popen(3)`][]. This capability +is primarily provided by the `child_process.spawn()` function: + +```js +const spawn = require('child_process').spawn; +const ls = spawn('ls', ['-lh', '/usr']); + +ls.stdout.on('data', (data) => { + console.log(`stdout: ${data}`); +}); + +ls.stderr.on('data', (data) => { + console.log(`stderr: ${data}`); +}); + +ls.on('close', (code) => { + console.log(`child process exited with code ${code}`); +}); +``` + +By default, pipes for `stdin`, `stdout` and `stderr` are established between +the parent Node.js process and the spawned child. It is possible to stream data +through these pipes in a non-blocking way. *Note, however, that some programs +use line-buffered I/O internally. While that does not affect Node.js, it can +mean that data sent to the child process may not be immediately consumed.* + +The `child_process.spawn()` method spawns the child process asynchronously, +without blocking the Node.js event loop. The `child_process.spawnSync()` +function provides equivalent functionality in a synchronous manner that blocks +the event loop until the spawned process either exits or is terminated. + +For convenience, the `child_process` module provides a handful of synchronous +and asynchronous alternatives to [`child_process.spawn()`][] and +[`child_process.spawnSync()`][]. *Note that each of these alternatives are +implemented on top of `child_process.spawn()` or `child_process.spawnSync()`.* + + * `child_process.exec()`: spawns a shell and runs a command within that shell, + passing the `stdout` and `stderr` to a callback function when complete. + * `child_process.execFile()`: similar to `child_process.exec()` except that + it spawns the command directly without first spawning a shell. + * `child_process.fork()`: spawns a new Node.js process and invokes a + specified module with an IPC communication channel established that allows + sending messages between parent and child. + * `child_process.execSync()`: a synchronous version of + `child_process.exec()` that *will* block the Node.js event loop. + * `child_process.execFileSync()`: a synchronous version of + `child_process.execFile()` that *will* block the Node.js event loop. + +For certain use cases, such as automating shell scripts, the +[synchronous counterparts][] may be more convenient. In many cases, however, +the synchronous methods can have significant impact on performance due to +stalling the event loop while spawned processes complete. + +## Asynchronous Process Creation + +The `child_process.spawn()`, `child_process.fork()`, `child_process.exec()`, +and `child_process.execFile()` methods all follow the idiomatic asynchronous +programming pattern typical of other Node.js APIs. + +Each of the methods returns a [`ChildProcess`][] instance. These objects +implement the Node.js [`EventEmitter`][] API, allowing the parent process to +register listener functions that are called when certain events occur during +the life cycle of the child process. + +The `child_process.exec()` and `child_process.execFile()` methods additionally +allow for an optional `callback` function to be specified that is invoked +when the child process terminates. + +### Spawning `.bat` and `.cmd` files on Windows + +The importance of the distinction between `child_process.exec()` and +`child_process.execFile()` can vary based on platform. On Unix-type operating +systems (Unix, Linux, OSX) `child_process.execFile()` can be more efficient +because it does not spawn a shell. On Windows, however, `.bat` and `.cmd` +files are not executable on their own without a terminal, and therefore cannot +be launched using `child_process.execFile()`. When running on Windows, `.bat` +and `.cmd` files can be invoked using `child_process.spawn()` with the `shell` +option set, with `child_process.exec()`, or by spawning `cmd.exe` and passing +the `.bat` or `.cmd` file as an argument (which is what the `shell` option and +`child_process.exec()` do). + +```js +// On Windows Only ... +const spawn = require('child_process').spawn; +const bat = spawn('cmd.exe', ['/c', 'my.bat']); + +bat.stdout.on('data', (data) => { + console.log(data); +}); + +bat.stderr.on('data', (data) => { + console.log(data); +}); + +bat.on('exit', (code) => { + console.log(`Child exited with code ${code}`); +}); + +// OR... +const exec = require('child_process').exec; +exec('my.bat', (err, stdout, stderr) => { + if (err) { + console.error(err); + return; + } + console.log(stdout); +}); +``` + +### child_process.exec(command[, options][, callback]) + +* `command` {String} The command to run, with space-separated arguments +* `options` {Object} + * `cwd` {String} Current working directory of the child process + * `env` {Object} Environment key-value pairs + * `encoding` {String} (Default: 'utf8') + * `shell` {String} Shell to execute the command with + (Default: '/bin/sh' on UNIX, 'cmd.exe' on Windows, The shell should + understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, + command line parsing should be compatible with `cmd.exe`.) + * `timeout` {Number} (Default: 0) + * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed (Default: `200*1024`) + * `killSignal` {String} (Default: 'SIGTERM') + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) +* `callback` {Function} called with the output when process terminates + * `error` {Error} + * `stdout` {String|Buffer} + * `stderr` {String|Buffer} +* Return: {ChildProcess} + +Spawns a shell then executes the `command` within that shell, buffering any +generated output. + +```js +const exec = require('child_process').exec; +const child = exec('cat *.js bad_file | wc -l', + (error, stdout, stderr) => { + console.log(`stdout: ${stdout}`); + console.log(`stderr: ${stderr}`); + if (error !== null) { + console.log(`exec error: ${error}`); + } +}); +``` + +If a `callback` function is provided, it is called with the arguments +`(error, stdout, stderr)`. On success, `error` will be `null`. On error, +`error` will be an instance of [`Error`][]. The `error.code` property will be +the exit code of the child process while `error.signal` will be set to the +signal that terminated the process. Any exit code other than `0` is considered +to be an error. + +The `stdout` and `stderr` arguments passed to the callback will contain the +stdout and stderr output of the child process. By default, Node.js will decode +the output as UTF-8 and pass strings to the callback. The `encoding` option +can be used to specify the character encoding used to decode the stdout and +stderr output. If `encoding` is `'buffer'`, `Buffer` objects will be passed to +the callback instead. + +The `options` argument may be passed as the second argument to customize how +the process is spawned. The default options are: + +```js +{ + encoding: 'utf8', + timeout: 0, + maxBuffer: 200*1024, + killSignal: 'SIGTERM', + cwd: null, + env: null +} +``` + +If `timeout` is greater than `0`, the parent will send the the signal +identified by the `killSignal` property (the default is `'SIGTERM'`) if the +child runs longer than `timeout` milliseconds. + +*Note: Unlike the `exec()` POSIX system call, `child_process.exec()` does not +replace the existing process and uses a shell to execute the command.* + +### child_process.execFile(file[, args][, options][, callback]) + +* `file` {String} The name or path of the executable file to run +* `args` {Array} List of string arguments +* `options` {Object} + * `cwd` {String} Current working directory of the child process + * `env` {Object} Environment key-value pairs + * `encoding` {String} (Default: 'utf8') + * `timeout` {Number} (Default: 0) + * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed (Default: 200\*1024) + * `killSignal` {String} (Default: 'SIGTERM') + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) +* `callback` {Function} called with the output when process terminates + * `error` {Error} + * `stdout` {String|Buffer} + * `stderr` {String|Buffer} +* Return: {ChildProcess} + +The `child_process.execFile()` function is similar to [`child_process.exec()`][] +except that it does not spawn a shell. Rather, the specified executable `file` +is spawned directly as a new process making it slightly more efficient than +[`child_process.exec()`][]. + +The same options as `child_process.exec()` are supported. Since a shell is not +spawned, behaviors such as I/O redirection and file globbing are not supported. + +```js +const execFile = require('child_process').execFile; +const child = execFile('node', ['--version'], (error, stdout, stderr) => { + if (error) { + throw error; + } + console.log(stdout); +}); +``` + +The `stdout` and `stderr` arguments passed to the callback will contain the +stdout and stderr output of the child process. By default, Node.js will decode +the output as UTF-8 and pass strings to the callback. The `encoding` option +can be used to specify the character encoding used to decode the stdout and +stderr output. If `encoding` is `'buffer'`, `Buffer` objects will be passed to +the callback instead. + +### child_process.fork(modulePath[, args][, options]) + +* `modulePath` {String} The module to run in the child +* `args` {Array} List of string arguments +* `options` {Object} + * `cwd` {String} Current working directory of the child process + * `env` {Object} Environment key-value pairs + * `execPath` {String} Executable used to create the child process + * `execArgv` {Array} List of string arguments passed to the executable + (Default: `process.execArgv`) + * `silent` {Boolean} If true, stdin, stdout, and stderr of the child will be + piped to the parent, otherwise they will be inherited from the parent, see + the `'pipe'` and `'inherit'` options for [`child_process.spawn()`][]'s + [`stdio`][] for more details (default is false) + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) +* Return: {ChildProcess} + +The `child_process.fork()` method is a special case of +[`child_process.spawn()`][] used specifically to spawn new Node.js processes. +Like `child_process.spawn()`, a `ChildProcess` object is returned. The returned +`ChildProcess` will have an additional communication channel built-in that +allows messages to be passed back and forth between the parent and child. See +[`ChildProcess#send()`][] for details. + +It is important to keep in mind that spawned Node.js child processes are +independent of the parent with exception of the IPC communication channel +that is established between the two. Each process has it's own memory, with +their own V8 instances. Because of the additional resource allocations +required, spawning a large number of child Node.js processes is not +recommended. + +By default, `child_process.fork()` will spawn new Node.js instances using the +`process.execPath` of the parent process. The `execPath` property in the +`options` object allows for an alternative execution path to be used. + +Node.js processes launched with a custom `execPath` will communicate with the +parent process using the file descriptor (fd) identified using the +environment variable `NODE_CHANNEL_FD` on the child process. The input and +output on this fd is expected to be line delimited JSON objects. + +*Note: Unlike the `fork()` POSIX system call, [`child_process.fork()`][] does +not clone the current process.* + +### child_process.spawn(command[, args][, options]) + +* `command` {String} The command to run +* `args` {Array} List of string arguments +* `options` {Object} + * `cwd` {String} Current working directory of the child process + * `env` {Object} Environment key-value pairs + * `stdio` {Array|String} Child's stdio configuration. (See + [`options.stdio`][]) + * `detached` {Boolean} Prepare child to run independently of its parent + process. Specific behavior depends on the platform, see + [`options.detached`][]) + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses + '/bin/sh' on UNIX, and 'cmd.exe' on Windows. A different shell can be + specified as a string. The shell should understand the `-c` switch on UNIX, + or `/s /c` on Windows. Defaults to `false` (no shell). +* return: {ChildProcess} + +The `child_process.spawn()` method spawns a new process using the given +`command`, with command line arguments in `args`. If omitted, `args` defaults +to an empty array. + +A third argument may be used to specify additional options, with these defaults: + +```js +{ + cwd: undefined, + env: process.env +} +``` + +Use `cwd` to specify the working directory from which the process is spawned. +If not given, the default is to inherit the current working directory. + +Use `env` to specify environment variables that will be visible to the new +process, the default is `process.env`. + +Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the +exit code: + +```js +const spawn = require('child_process').spawn; +const ls = spawn('ls', ['-lh', '/usr']); + +ls.stdout.on('data', (data) => { + console.log(`stdout: ${data}`); +}); + +ls.stderr.on('data', (data) => { + console.log(`stderr: ${data}`); +}); + +ls.on('close', (code) => { + console.log(`child process exited with code ${code}`); +}); +``` + + +Example: A very elaborate way to run 'ps ax | grep ssh' + +```js +const spawn = require('child_process').spawn; +const ps = spawn('ps', ['ax']); +const grep = spawn('grep', ['ssh']); + +ps.stdout.on('data', (data) => { + grep.stdin.write(data); +}); + +ps.stderr.on('data', (data) => { + console.log(`ps stderr: ${data}`); +}); + +ps.on('close', (code) => { + if (code !== 0) { + console.log(`ps process exited with code ${code}`); + } + grep.stdin.end(); +}); + +grep.stdout.on('data', (data) => { + console.log(`${data}`); +}); + +grep.stderr.on('data', (data) => { + console.log(`grep stderr: ${data}`); +}); + +grep.on('close', (code) => { + if (code !== 0) { + console.log(`grep process exited with code ${code}`); + } +}); +``` + + +Example of checking for failed exec: + +```js +const spawn = require('child_process').spawn; +const child = spawn('bad_command'); + +child.on('error', (err) => { + console.log('Failed to start child process.'); +}); +``` + +#### options.detached + +On Windows, setting `options.detached` to `true` makes it possible for the +child process to continue running after the parent exits. The child will have +its own console window. *Once enabled for a child process, it cannot be +disabled*. + +On non-Windows platforms, if `options.detached` is set to `true`, the child +process will be made the leader of a new process group and session. Note that +child processes may continue running after the parent exits regardless of +whether they are detached or not. See `setsid(2)` for more information. + +By default, the parent will wait for the detached child to exit. To prevent +the parent from waiting for a given `child`, use the `child.unref()` method. +Doing so will cause the parent's event loop to not include the child in its +reference count, allowing the parent to exit independently of the child, unless +there is an established IPC channel between the child and parent. + +When using the `detached` option to start a long-running process, the process +will not stay running in the background after the parent exits unless it is +provided with a `stdio` configuration that is not connected to the parent. +If the parent's `stdio` is inherited, the child will remain attached to the +controlling terminal. + +Example of a long-running process, by detaching and also ignoring its parent +`stdio` file descriptors, in order to ignore the parent's termination: + +```js +const spawn = require('child_process').spawn; + +const child = spawn(process.argv[0], ['child_program.js'], { + detached: true, + stdio: ['ignore'] +}); + +child.unref(); +``` + +Alternatively one can redirect the child process' output into files: + +```js +const fs = require('fs'); +const spawn = require('child_process').spawn; +const out = fs.openSync('./out.log', 'a'); +const err = fs.openSync('./out.log', 'a'); + +const child = spawn('prg', [], { + detached: true, + stdio: [ 'ignore', out, err ] +}); + +child.unref(); +``` + +#### options.stdio + +The `options.stdio` option is used to configure the pipes that are established +between the parent and child process. By default, the child's stdin, stdout, +and stderr are redirected to corresponding `child.stdin`, `child.stdout`, and +`child.stderr` streams on the `ChildProcess` object. This is equivalent to +setting the `options.stdio` equal to `['pipe', 'pipe', 'pipe']`. + +For convenience, `options.stdio` may be one of the following strings: + +* `'pipe'` - equivalent to `['pipe', 'pipe', 'pipe']` (the default) +* `'ignore'` - equivalent to `['ignore', 'ignore', 'ignore']` +* `'inherit'` - equivalent to `[process.stdin, process.stdout, process.stderr]` + or `[0,1,2]` + +Otherwise, the value of `option.stdio` is an array where each index corresponds +to an fd in the child. The fds 0, 1, and 2 correspond to stdin, stdout, +and stderr, respectively. Additional fds can be specified to create additional +pipes between the parent and child. The value is one of the following: + +1. `'pipe'` - Create a pipe between the child process and the parent process. + The parent end of the pipe is exposed to the parent as a property on the + `child_process` object as `ChildProcess.stdio[fd]`. Pipes created for + fds 0 - 2 are also available as ChildProcess.stdin, ChildProcess.stdout + and ChildProcess.stderr, respectively. +2. `'ipc'` - Create an IPC channel for passing messages/file descriptors + between parent and child. A ChildProcess may have at most *one* IPC stdio + file descriptor. Setting this option enables the ChildProcess.send() method. + If the child writes JSON messages to this file descriptor, the + `ChildProcess.on('message')` event handler will be triggered in the parent. + If the child is a Node.js process, the presence of an IPC channel will enable + `process.send()`, `process.disconnect()`, `process.on('disconnect')`, and + `process.on('message')` within the child. +3. `'ignore'` - Instructs Node.js to ignore the fd in the child. While Node.js + will always open fds 0 - 2 for the processes it spawns, setting the fd to + `'ignore'` will cause Node.js to open `/dev/null` and attach it to the + child's fd. +4. `Stream` object - Share a readable or writable stream that refers to a tty, + file, socket, or a pipe with the child process. The stream's underlying + file descriptor is duplicated in the child process to the fd that + corresponds to the index in the `stdio` array. Note that the stream must + have an underlying descriptor (file streams do not until the `'open'` + event has occurred). +5. Positive integer - The integer value is interpreted as a file descriptor + that is is currently open in the parent process. It is shared with the child + process, similar to how `Stream` objects can be shared. +6. `null`, `undefined` - Use default value. For stdio fds 0, 1 and 2 (in other + words, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the + default is `'ignore'`. + +Example: + +```js +const spawn = require('child_process').spawn; + +// Child will use parent's stdios +spawn('prg', [], { stdio: 'inherit' }); + +// Spawn child sharing only stderr +spawn('prg', [], { stdio: ['pipe', 'pipe', process.stderr] }); + +// Open an extra fd=4, to interact with programs presenting a +// startd-style interface. +spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] }); +``` + +*It is worth noting that when an IPC channel is established between the +parent and child processes, and the child is a Node.js process, the child +is launched with the IPC channel unreferenced (using `unref()`) until the +child registers an event handler for the `process.on('disconnected')` event. +This allows the child to exit normally without the process being held open +by the open IPC channel.* + +See also: [`child_process.exec()`][] and [`child_process.fork()`][] + +## Synchronous Process Creation + +The `child_process.spawnSync()`, `child_process.execSync()`, and +`child_process.execFileSync()` methods are **synchronous** and **WILL** block +the Node.js event loop, pausing execution of any additional code until the +spawned process exits. + +Blocking calls like these are mostly useful for simplifying general purpose +scripting tasks and for simplifying the loading/processing of application +configuration at startup. + +### child_process.execFileSync(file[, args][, options]) + +* `file` {String} The name or path of the executable file to run +* `args` {Array} List of string arguments +* `options` {Object} + * `cwd` {String} Current working directory of the child process + * `input` {String|Buffer} The value which will be passed as stdin to the + spawned process + - supplying this value will override `stdio[0]` + * `stdio` {Array} Child's stdio configuration. (Default: 'pipe') + - `stderr` by default will be output to the parent process' stderr unless + `stdio` is specified + * `env` {Object} Environment key-value pairs + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `timeout` {Number} In milliseconds the maximum amount of time the process + is allowed to run. (Default: undefined) + * `killSignal` {String} The signal value to be used when the spawned process + will be killed. (Default: 'SIGTERM') + * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed + * `encoding` {String} The encoding used for all stdio inputs and outputs. (Default: 'buffer') +* return: {Buffer|String} The stdout from the command + +The `child_process.execFileSync()` method is generally identical to +`child_process.execFile()` with the exception that the method will not return +until the child process has fully closed. When a timeout has been encountered +and `killSignal` is sent, the method won't return until the process has +completely exited. *Note that if the child process intercepts and handles +the `SIGTERM` signal and does not exit, the parent process will still wait +until the child process has exited.* + +If the process times out, or has a non-zero exit code, this method ***will*** +throw. The [`Error`][] object will contain the entire result from +[`child_process.spawnSync()`][] + +### child_process.execSync(command[, options]) + +* `command` {String} The command to run +* `options` {Object} + * `cwd` {String} Current working directory of the child process + * `input` {String|Buffer} The value which will be passed as stdin to the + spawned process + - supplying this value will override `stdio[0]` + * `stdio` {Array} Child's stdio configuration. (Default: 'pipe') + - `stderr` by default will be output to the parent process' stderr unless + `stdio` is specified + * `env` {Object} Environment key-value pairs + * `shell` {String} Shell to execute the command with + (Default: '/bin/sh' on UNIX, 'cmd.exe' on Windows, The shell should + understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, + command line parsing should be compatible with `cmd.exe`.) + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `timeout` {Number} In milliseconds the maximum amount of time the process + is allowed to run. (Default: undefined) + * `killSignal` {String} The signal value to be used when the spawned process + will be killed. (Default: 'SIGTERM') + * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed + * `encoding` {String} The encoding used for all stdio inputs and outputs. + (Default: 'buffer') +* return: {Buffer|String} The stdout from the command + +The `child_process.execSync()` method is generally identical to +`child_process.exec()` with the exception that the method will not return until +the child process has fully closed. When a timeout has been encountered and +`killSignal` is sent, the method won't return until the process has completely +exited. *Note that if the child process intercepts and handles the `SIGTERM` +signal and doesn't exit, the parent process will wait until the child +process has exited.* + +If the process times out, or has a non-zero exit code, this method ***will*** +throw. The [`Error`][] object will contain the entire result from +[`child_process.spawnSync()`][] + +### child_process.spawnSync(command[, args][, options]) + +* `command` {String} The command to run +* `args` {Array} List of string arguments +* `options` {Object} + * `cwd` {String} Current working directory of the child process + * `input` {String|Buffer} The value which will be passed as stdin to the + spawned process + - supplying this value will override `stdio[0]` + * `stdio` {Array} Child's stdio configuration. + * `env` {Object} Environment key-value pairs + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `timeout` {Number} In milliseconds the maximum amount of time the process + is allowed to run. (Default: undefined) + * `killSignal` {String} The signal value to be used when the spawned process + will be killed. (Default: 'SIGTERM') + * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed + * `encoding` {String} The encoding used for all stdio inputs and outputs. + (Default: 'buffer') + * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses + '/bin/sh' on UNIX, and 'cmd.exe' on Windows. A different shell can be + specified as a string. The shell should understand the `-c` switch on UNIX, + or `/s /c` on Windows. Defaults to `false` (no shell). +* return: {Object} + * `pid` {Number} Pid of the child process + * `output` {Array} Array of results from stdio output + * `stdout` {Buffer|String} The contents of `output[1]` + * `stderr` {Buffer|String} The contents of `output[2]` + * `status` {Number} The exit code of the child process + * `signal` {String} The signal used to kill the child process + * `error` {Error} The error object if the child process failed or timed out + +The `child_process.spawnSync()` method is generally identical to +`child_process.spawn()` with the exception that the function will not return +until the child process has fully closed. When a timeout has been encountered +and `killSignal` is sent, the method won't return until the process has +completely exited. Note that if the process intercepts and handles the +`SIGTERM` signal and doesn't exit, the parent process will wait until the child +process has exited. + +## Class: ChildProcess + +Instances of the `ChildProcess` class are [`EventEmitters`][] that represent +spawned child processes. + +Instances of `ChildProcess` are not intended to be created directly. Rather, +use the [`child_process.spawn()`][], [`child_process.exec()`][], +[`child_process.execFile()`][], or [`child_process.fork()`][] methods to create +instances of `ChildProcess`. + +### Event: 'close' + +* `code` {Number} the exit code if the child exited on its own. +* `signal` {String} the signal by which the child process was terminated. + +The `'close'` event is emitted when the stdio streams of a child process have +been closed. This is distinct from the `'exit'` event, since multiple +processes might share the same stdio streams. + +### Event: 'disconnect' + +The `'disconnect'` event is emitted after calling the +`ChildProcess.disconnect()` method in the parent or child process. After +disconnecting it is no longer possible to send or receive messages, and the +`ChildProcess.connected` property is false. + +### Event: 'error' + +* `err` {Error} the error. + +The `'error'` event is emitted whenever: + +1. The process could not be spawned, or +2. The process could not be killed, or +3. Sending a message to the child process failed. + +Note that the `'exit'` event may or may not fire after an error has occurred. +If you are listening to both the `'exit'` and `'error'` events, it is important +to guard against accidentally invoking handler functions multiple times. + +See also [`ChildProcess#kill()`][] and [`ChildProcess#send()`][]. + +### Event: 'exit' + +* `code` {Number} the exit code if the child exited on its own. +* `signal` {String} the signal by which the child process was terminated. + +The `'exit'` event is emitted after the child process ends. If the process +exited, `code` is the final exit code of the process, otherwise `null`. If the +process terminated due to receipt of a signal, `signal` is the string name of +the signal, otherwise `null`. One of the two will always be non-null. + +Note that when the `'exit'` event is triggered, child process stdio streams +might still be open. + +Also, note that Node.js establishes signal handlers for `SIGINT` and +`SIGTERM` and Node.js processes will not terminate immediately due to receipt +of those signals. Rather, Node.js will perform a sequence of cleanup actions +and then will re-raise the handled signal. + +See `waitpid(2)`. + +### Event: 'message' + +* `message` {Object} a parsed JSON object or primitive value. +* `sendHandle` {Handle} a [`net.Socket`][] or [`net.Server`][] object, or + undefined. + +The `'message'` event is triggered when a child process uses `process.send()` +to send messages. + +### child.connected + +* {Boolean} Set to false after `.disconnect` is called + +The `child.connected` property indicates whether it is still possible to send +and receive messages from a child process. When `child.connected` is false, it +is no longer possible to send or receive messages. + +### child.disconnect() + +Closes the IPC channel between parent and child, allowing the child to exit +gracefully once there are no other connections keeping it alive. After calling +this method the `child.connected` and `process.connected` properties in both +the parent and child (respectively) will be set to `false`, and it will be no +longer possible to pass messages between the processes. + +The `'disconnect'` event will be emitted when there are no messages in the +process of being received. This will most often be triggered immediately after +calling `child.disconnect()`. + +Note that when the child process is a Node.js instance (e.g. spawned using +[`child_process.fork()`]), the `process.disconnect()` method can be invoked +within the child process to close the IPC channel as well. + +### child.kill([signal]) + +* `signal` {String} + +The `child.kill()` methods sends a signal to the child process. If no argument +is given, the process will be sent the `'SIGTERM'` signal. See `signal(7)` for +a list of available signals. + +```js +const spawn = require('child_process').spawn; +const grep = spawn('grep', ['ssh']); + +grep.on('close', (code, signal) => { + console.log( + `child process terminated due to receipt of signal ${signal}`); +}); + +// Send SIGHUP to process +grep.kill('SIGHUP'); +``` + +The `ChildProcess` object may emit an `'error'` event if the signal cannot be +delivered. Sending a signal to a child process that has already exited is not +an error but may have unforeseen consequences. Specifically, if the process +identifier (PID) has been reassigned to another process, the signal will be +delivered to that process instead which can have unexpected results. + +Note that while the function is called `kill`, the signal delivered to the +child process may not actually terminate the process. + +See `kill(2)` for reference. + +Also note: on Linux, child processes of child processes will not be terminated +when attempting to kill their parent. This is likely to happen when running a +new process in a shell or with use of the `shell` option of `ChildProcess`, such +as in this example: + +```js +'use strict'; +const spawn = require('child_process').spawn; + +let child = spawn('sh', ['-c', + `node -e "setInterval(() => { + console.log(process.pid + 'is alive') + }, 500);"` + ], { + stdio: ['inherit', 'inherit', 'inherit'] + }); + +setTimeout(() => { + child.kill(); // does not terminate the node process in the shell +}, 2000); +``` + +### child.pid + +* {Number} Integer + +Returns the process identifier (PID) of the child process. + +Example: + +```js +const spawn = require('child_process').spawn; +const grep = spawn('grep', ['ssh']); + +console.log(`Spawned child pid: ${grep.pid}`); +grep.stdin.end(); +``` + +### child.send(message[, sendHandle[, options]][, callback]) + +* `message` {Object} +* `sendHandle` {Handle} +* `options` {Object} +* `callback` {Function} +* Return: {Boolean} + +When an IPC channel has been established between the parent and child ( +i.e. when using [`child_process.fork()`][]), the `child.send()` method can be +used to send messages to the child process. When the child process is a Node.js +instance, these messages can be received via the `process.on('message')` event. + +For example, in the parent script: + +```js +const cp = require('child_process'); +const n = cp.fork(`${__dirname}/sub.js`); + +n.on('message', (m) => { + console.log('PARENT got message:', m); +}); + +n.send({ hello: 'world' }); +``` + +And then the child script, `'sub.js'` might look like this: + +```js +process.on('message', (m) => { + console.log('CHILD got message:', m); +}); + +process.send({ foo: 'bar' }); +``` + +Child Node.js processes will have a `process.send()` method of their own that +allows the child to send messages back to the parent. + +There is a special case when sending a `{cmd: 'NODE_foo'}` message. All messages +containing a `NODE_` prefix in its `cmd` property are considered to be reserved +for use within Node.js core and will not be emitted in the child's +`process.on('message')` event. Rather, such messages are emitted using the +`process.on('internalMessage')` event and are consumed internally by Node.js. +Applications should avoid using such messages or listening for +`'internalMessage'` events as it is subject to change without notice. + +The optional `sendHandle` argument that may be passed to `child.send()` is for +passing a TCP server or socket object to the child process. The child will +receive the object as the second argument passed to the callback function +registered on the `process.on('message')` event. + +The `options` argument, if present, is an object used to parameterize the +sending of certain types of handles. `options` supports the following +properties: + + * `keepOpen` - A Boolean value that can be used when passing instances of + `net.Socket`. When `true`, the socket is kept open in the sending process. + Defaults to `false`. + +The optional `callback` is a function that is invoked after the message is +sent but before the child may have received it. The function is called with a +single argument: `null` on success, or an [`Error`][] object on failure. + +If no `callback` function is provided and the message cannot be sent, an +`'error'` event will be emitted by the `ChildProcess` object. This can happen, +for instance, when the child process has already exited. + +`child.send()` will return `false` if the channel has closed or when the +backlog of unsent messages exceeds a threshold that makes it unwise to send +more. Otherwise, the method returns `true`. The `callback` function can be +used to implement flow control. + +#### Example: sending a server object + +The `sendHandle` argument can be used, for instance, to pass the handle of +a TCP server object to the child process as illustrated in the example below: + +```js +const child = require('child_process').fork('child.js'); + +// Open up the server object and send the handle. +const server = require('net').createServer(); +server.on('connection', (socket) => { + socket.end('handled by parent'); +}); +server.listen(1337, () => { + child.send('server', server); +}); +``` + +The child would then receive the server object as: + +```js +process.on('message', (m, server) => { + if (m === 'server') { + server.on('connection', (socket) => { + socket.end('handled by child'); + }); + } +}); +``` + +Once the server is now shared between the parent and child, some connections +can be handled by the parent and some by the child. + +While the example above uses a server created using the `net` module, `dgram` +module servers use exactly the same workflow with the exceptions of listening on +a `'message'` event instead of `'connection'` and using `server.bind` instead of +`server.listen`. This is, however, currently only supported on UNIX platforms. + +#### Example: sending a socket object + +Similarly, the `sendHandler` argument can be used to pass the handle of a +socket to the child process. The example below spawns two children that each +handle connections with "normal" or "special" priority: + +```js +const normal = require('child_process').fork('child.js', ['normal']); +const special = require('child_process').fork('child.js', ['special']); + +// Open up the server and send sockets to child +const server = require('net').createServer(); +server.on('connection', (socket) => { + + // If this is special priority + if (socket.remoteAddress === '74.125.127.100') { + special.send('socket', socket); + return; + } + // This is normal priority + normal.send('socket', socket); +}); +server.listen(1337); +``` + +The `child.js` would receive the socket handle as the second argument passed +to the event callback function: + +```js +process.on('message', (m, socket) => { + if (m === 'socket') { + socket.end(`Request handled with ${process.argv[2]} priority`); + } +}); +``` + +Once a socket has been passed to a child, the parent is no longer capable of +tracking when the socket is destroyed. To indicate this, the `.connections` +property becomes `null`. It is recommended not to use `.maxConnections` when +this occurs. + +*Note: this function uses [`JSON.stringify()`][] internally to serialize the +`message`.* + +### child.stderr + +* {Stream} + +A `Readable Stream` that represents the child process's `stderr`. + +If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, +then this will be `undefined`. + +`child.stderr` is an alias for `child.stdio[2]`. Both properties will refer to +the same value. + +### child.stdin + +* {Stream} + +A `Writable Stream` that represents the child process's `stdin`. + +*Note that if a child process waits to read all of its input, the child will not +continue until this stream has been closed via `end()`.* + +If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, +then this will be `undefined`. + +`child.stdin` is an alias for `child.stdio[0]`. Both properties will refer to +the same value. + +### child.stdio + +* {Array} + +A sparse array of pipes to the child process, corresponding with positions in +the [`stdio`][] option passed to [`child_process.spawn()`][] that have been set +to the value `'pipe'`. Note that `child.stdio[0]`, `child.stdio[1]`, and +`child.stdio[2]` are also available as `child.stdin`, `child.stdout`, and +`child.stderr`, respectively. + +In the following example, only the child's fd `1` (stdout) is configured as a +pipe, so only the parent's `child.stdio[1]` is a stream, all other values in +the array are `null`. + +```js +const assert = require('assert'); +const fs = require('fs'); +const child_process = require('child_process'); + +const child = child_process.spawn('ls', { + stdio: [ + 0, // Use parents stdin for child + 'pipe', // Pipe child's stdout to parent + fs.openSync('err.out', 'w') // Direct child's stderr to a file + ] +}); + +assert.equal(child.stdio[0], null); +assert.equal(child.stdio[0], child.stdin); + +assert(child.stdout); +assert.equal(child.stdio[1], child.stdout); + +assert.equal(child.stdio[2], null); +assert.equal(child.stdio[2], child.stderr); +``` + +### child.stdout + +* {Stream} + +A `Readable Stream` that represents the child process's `stdout`. + +If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, +then this will be `undefined`. + +`child.stdout` is an alias for `child.stdio[1]`. Both properties will refer +to the same value. + +## `maxBuffer` and Unicode + +It is important to keep in mind that the `maxBuffer` option specifies the +largest number of *octets* allowed on `stdout` or `stderr` - if this value is +exceeded then the child process is terminated. This particularly impacts +output that includes multi-byte character encodings such as UTF-8 or UTF-16. +For instance, the following will output 13 UTF-8 encoded octets to `stdout` +although there are only 4 characters: + +```js +console.log('中文测试'); +``` + +[`popen(3)`]: http://linux.die.net/man/3/popen +[`ChildProcess`]: #child_process_child_process +[`child_process.exec()`]: #child_process_child_process_exec_command_options_callback +[`child_process.execFile()`]: #child_process_child_process_execfile_file_args_options_callback +[`child_process.fork()`]: #child_process_child_process_fork_modulepath_args_options +[`child_process.spawn()`]: #child_process_child_process_spawn_command_args_options +[`child_process.spawnSync()`]: #child_process_child_process_spawnsync_command_args_options +[`ChildProcess#kill()`]: #child_process_child_kill_signal +[`ChildProcess#send()`]: #child_process_child_send_message_sendhandle_options_callback +[`Error`]: errors.html#errors_class_error +[`EventEmitter`]: events.html#events_class_eventemitter +[`EventEmitters`]: events.html#events_class_eventemitter +[`net.Server`]: net.html#net_class_net_server +[`net.Socket`]: net.html#net_class_net_socket +[`options.detached`]: #child_process_options_detached +[`options.stdio`]: #child_process_options_stdio +[`stdio`]: #child_process_options_stdio +[synchronous counterparts]: #child_process_synchronous_process_creation +[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify +[`maxBuffer`]: #child_process_maxbuffer_and_unicode diff --git a/doc/api/cli.markdown b/doc/api/cli.markdown deleted file mode 100644 index 13e8a396e40c2a..00000000000000 --- a/doc/api/cli.markdown +++ /dev/null @@ -1,168 +0,0 @@ -# Command Line Options - - - -Node.js comes with a wide variety of CLI options. These options expose built-in -debugging, multiple ways to execute scripts, and other helpful runtime options. - -To view this documentation as a manual page in your terminal, run `man node`. - - -## Synopsis - -`node [options] [v8 options] [script.js | -e "script"] [arguments]` - -`node debug [script.js | -e "script" | :] …` - -`node --v8-options` - -Execute without arguments to start the [REPL][]. - -_For more info about `node debug`, please see the [debugger][] documentation._ - - -## Options - -### `-v`, `--version` - -Print node's version. - - -### `-h`, `--help` - -Print node command line options. -The output of this option is less detailed than this document. - - -### `-e`, `--eval "script"` - -Evaluate the following argument as JavaScript. - - -### `-p`, `--print "script"` - -Identical to `-e` but prints the result. - - -### `-c`, `--check` - -Syntax check the script without executing. - - -### `-i`, `--interactive` - -Opens the REPL even if stdin does not appear to be a terminal. - - -### `-r`, `--require module` - -Preload the specified module at startup. - -Follows `require()`'s module resolution -rules. `module` may be either a path to a file, or a node module name. - - -### `--no-deprecation` - -Silence deprecation warnings. - - -### `--trace-deprecation` - -Print stack traces for deprecations. - - -### `--throw-deprecation` - -Throw errors for deprecations. - - -### `--trace-sync-io` - -Prints a stack trace whenever synchronous I/O is detected after the first turn -of the event loop. - - -### `--zero-fill-buffers` - -Automatically zero-fills all newly allocated [Buffer][] and [SlowBuffer][] -instances. - - -### `--track-heap-objects` - -Track heap object allocations for heap snapshots. - -### `--zero-fill-buffers` - -Automatically zero-fills all newly allocated Buffer and SlowBuffer instances. - -### `--prof-process` - -Process v8 profiler output generated using the v8 option `--prof`. - - -### `--v8-options` - -Print v8 command line options. - - -### `--tls-cipher-list=list` - -Specify an alternative default TLS cipher list. (Requires Node.js to be built -with crypto support. (Default)) - - -### `--enable-fips` - -Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with -`./configure --openssl-fips`) - - -### `--force-fips` - -Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.) -(Same requirements as `--enable-fips`) - - -### `--icu-data-dir=file` - -Specify ICU data load path. (overrides `NODE_ICU_DATA`) - - -## Environment Variables - -### `NODE_DEBUG=module[,…]` - -`','`-separated list of core modules that should print debug information. - - -### `NODE_PATH=path[:…]` - -`':'`-separated list of directories prefixed to the module search path. - -_Note: on Windows, this is a `';'`-separated list instead._ - - -### `NODE_DISABLE_COLORS=1` - -When set to `1` colors will not be used in the REPL. - - -### `NODE_ICU_DATA=file` - -Data path for ICU (Intl object) data. Will extend linked-in data when compiled -with small-icu support. - - -### `NODE_REPL_HISTORY=file` - -Path to the file used to store the persistent REPL history. The default path is -`~/.node_repl_history`, which is overridden by this variable. Setting the value -to an empty string (`""` or `" "`) disables persistent REPL history. - - -[Buffer]: buffer.html#buffer_buffer -[debugger]: debugger.html -[REPL]: repl.html -[SlowBuffer]: buffer.html#buffer_class_slowbuffer diff --git a/doc/api/cli.md b/doc/api/cli.md new file mode 100644 index 00000000000000..3752e9ab4779cb --- /dev/null +++ b/doc/api/cli.md @@ -0,0 +1,169 @@ +# Command Line Options + + + +Node.js comes with a wide variety of CLI options. These options expose built-in +debugging, multiple ways to execute scripts, and other helpful runtime options. + +To view this documentation as a manual page in your terminal, run `man node`. + + +## Synopsis + +`node [options] [v8 options] [script.js | -e "script"] [arguments]` + +`node debug [script.js | -e "script" | :] …` + +`node --v8-options` + +Execute without arguments to start the [REPL][]. + +_For more info about `node debug`, please see the [debugger][] documentation._ + + +## Options + +### `-v`, `--version` + +Print node's version. + + +### `-h`, `--help` + +Print node command line options. +The output of this option is less detailed than this document. + + +### `-e`, `--eval "script"` + +Evaluate the following argument as JavaScript. The modules which are +predefined in the REPL can also be used in `script`. + + +### `-p`, `--print "script"` + +Identical to `-e` but prints the result. + + +### `-c`, `--check` + +Syntax check the script without executing. + + +### `-i`, `--interactive` + +Opens the REPL even if stdin does not appear to be a terminal. + + +### `-r`, `--require module` + +Preload the specified module at startup. + +Follows `require()`'s module resolution +rules. `module` may be either a path to a file, or a node module name. + + +### `--no-deprecation` + +Silence deprecation warnings. + + +### `--trace-deprecation` + +Print stack traces for deprecations. + + +### `--throw-deprecation` + +Throw errors for deprecations. + + +### `--trace-sync-io` + +Prints a stack trace whenever synchronous I/O is detected after the first turn +of the event loop. + + +### `--zero-fill-buffers` + +Automatically zero-fills all newly allocated [Buffer][] and [SlowBuffer][] +instances. + + +### `--track-heap-objects` + +Track heap object allocations for heap snapshots. + +### `--zero-fill-buffers` + +Automatically zero-fills all newly allocated Buffer and SlowBuffer instances. + +### `--prof-process` + +Process v8 profiler output generated using the v8 option `--prof`. + + +### `--v8-options` + +Print v8 command line options. + + +### `--tls-cipher-list=list` + +Specify an alternative default TLS cipher list. (Requires Node.js to be built +with crypto support. (Default)) + + +### `--enable-fips` + +Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with +`./configure --openssl-fips`) + + +### `--force-fips` + +Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.) +(Same requirements as `--enable-fips`) + + +### `--icu-data-dir=file` + +Specify ICU data load path. (overrides `NODE_ICU_DATA`) + + +## Environment Variables + +### `NODE_DEBUG=module[,…]` + +`','`-separated list of core modules that should print debug information. + + +### `NODE_PATH=path[:…]` + +`':'`-separated list of directories prefixed to the module search path. + +_Note: on Windows, this is a `';'`-separated list instead._ + + +### `NODE_DISABLE_COLORS=1` + +When set to `1` colors will not be used in the REPL. + + +### `NODE_ICU_DATA=file` + +Data path for ICU (Intl object) data. Will extend linked-in data when compiled +with small-icu support. + + +### `NODE_REPL_HISTORY=file` + +Path to the file used to store the persistent REPL history. The default path is +`~/.node_repl_history`, which is overridden by this variable. Setting the value +to an empty string (`""` or `" "`) disables persistent REPL history. + + +[Buffer]: buffer.html#buffer_buffer +[debugger]: debugger.html +[REPL]: repl.html +[SlowBuffer]: buffer.html#buffer_class_slowbuffer diff --git a/doc/api/cluster.markdown b/doc/api/cluster.markdown deleted file mode 100644 index b14c3aaf2bfc83..00000000000000 --- a/doc/api/cluster.markdown +++ /dev/null @@ -1,694 +0,0 @@ -# Cluster - - Stability: 2 - Stable - -A single instance of Node.js runs in a single thread. To take advantage of -multi-core systems the user will sometimes want to launch a cluster of Node.js -processes to handle the load. - -The cluster module allows you to easily create child processes that -all share server ports. - -```js -const cluster = require('cluster'); -const http = require('http'); -const numCPUs = require('os').cpus().length; - -if (cluster.isMaster) { - // Fork workers. - for (var i = 0; i < numCPUs; i++) { - cluster.fork(); - } - - cluster.on('exit', (worker, code, signal) => { - console.log(`worker ${worker.process.pid} died`); - }); -} else { - // Workers can share any TCP connection - // In this case it is an HTTP server - http.createServer((req, res) => { - res.writeHead(200); - res.end('hello world\n'); - }).listen(8000); -} -``` - -Running Node.js will now share port 8000 between the workers: - -``` -$ NODE_DEBUG=cluster node server.js -23521,Master Worker 23524 online -23521,Master Worker 23526 online -23521,Master Worker 23523 online -23521,Master Worker 23528 online -``` - -Please note that, on Windows, it is not yet possible to set up a named pipe -server in a worker. - -## How It Works - - - -The worker processes are spawned using the [`child_process.fork()`][] method, -so that they can communicate with the parent via IPC and pass server -handles back and forth. - -The cluster module supports two methods of distributing incoming -connections. - -The first one (and the default one on all platforms except Windows), -is the round-robin approach, where the master process listens on a -port, accepts new connections and distributes them across the workers -in a round-robin fashion, with some built-in smarts to avoid -overloading a worker process. - -The second approach is where the master process creates the listen -socket and sends it to interested workers. The workers then accept -incoming connections directly. - -The second approach should, in theory, give the best performance. -In practice however, distribution tends to be very unbalanced due -to operating system scheduler vagaries. Loads have been observed -where over 70% of all connections ended up in just two processes, -out of a total of eight. - -Because `server.listen()` hands off most of the work to the master -process, there are three cases where the behavior between a normal -Node.js process and a cluster worker differs: - -1. `server.listen({fd: 7})` Because the message is passed to the master, - file descriptor 7 **in the parent** will be listened on, and the - handle passed to the worker, rather than listening to the worker's - idea of what the number 7 file descriptor references. -2. `server.listen(handle)` Listening on handles explicitly will cause - the worker to use the supplied handle, rather than talk to the master - process. If the worker already has the handle, then it's presumed - that you know what you are doing. -3. `server.listen(0)` Normally, this will cause servers to listen on a - random port. However, in a cluster, each worker will receive the - same "random" port each time they do `listen(0)`. In essence, the - port is random the first time, but predictable thereafter. If you - want to listen on a unique port, generate a port number based on the - cluster worker ID. - -There is no routing logic in Node.js, or in your program, and no shared -state between the workers. Therefore, it is important to design your -program such that it does not rely too heavily on in-memory data objects -for things like sessions and login. - -Because workers are all separate processes, they can be killed or -re-spawned depending on your program's needs, without affecting other -workers. As long as there are some workers still alive, the server will -continue to accept connections. If no workers are alive, existing connections -will be dropped and new connections will be refused. Node.js does not -automatically manage the number of workers for you, however. It is your -responsibility to manage the worker pool for your application's needs. - - - -## Class: Worker - -A Worker object contains all public information and method about a worker. -In the master it can be obtained using `cluster.workers`. In a worker -it can be obtained using `cluster.worker`. - -### Event: 'disconnect' - -Similar to the `cluster.on('disconnect')` event, but specific to this worker. - -```js -cluster.fork().on('disconnect', () => { - // Worker has disconnected -}); -``` - -### Event: 'error' - -This event is the same as the one provided by [`child_process.fork()`][]. - -In a worker you can also use `process.on('error')`. - -### Event: 'exit' - -* `code` {Number} the exit code, if it exited normally. -* `signal` {String} the name of the signal (eg. `'SIGHUP'`) that caused - the process to be killed. - -Similar to the `cluster.on('exit')` event, but specific to this worker. - -```js -const worker = cluster.fork(); -worker.on('exit', (code, signal) => { - if( signal ) { - console.log(`worker was killed by signal: ${signal}`); - } else if( code !== 0 ) { - console.log(`worker exited with error code: ${code}`); - } else { - console.log('worker success!'); - } -}); -``` - -### Event: 'listening' - -* `address` {Object} - -Similar to the `cluster.on('listening')` event, but specific to this worker. - -```js -cluster.fork().on('listening', (address) => { - // Worker is listening -}); -``` - -It is not emitted in the worker. - -### Event: 'message' - -* `message` {Object} - -Similar to the `cluster.on('message')` event, but specific to this worker. - -This event is the same as the one provided by [`child_process.fork()`][]. - -In a worker you can also use `process.on('message')`. - -As an example, here is a cluster that keeps count of the number of requests -in the master process using the message system: - -```js -const cluster = require('cluster'); -const http = require('http'); - -if (cluster.isMaster) { - - // Keep track of http requests - var numReqs = 0; - setInterval(() => { - console.log('numReqs =', numReqs); - }, 1000); - - // Count requests - function messageHandler(msg) { - if (msg.cmd && msg.cmd == 'notifyRequest') { - numReqs += 1; - } - } - - // Start workers and listen for messages containing notifyRequest - const numCPUs = require('os').cpus().length; - for (var i = 0; i < numCPUs; i++) { - cluster.fork(); - } - - Object.keys(cluster.workers).forEach((id) => { - cluster.workers[id].on('message', messageHandler); - }); - -} else { - - // Worker processes have a http server. - http.Server((req, res) => { - res.writeHead(200); - res.end('hello world\n'); - - // notify master about the request - process.send({ cmd: 'notifyRequest' }); - }).listen(8000); -} -``` - -### Event: 'online' - -Similar to the `cluster.on('online')` event, but specific to this worker. - -```js -cluster.fork().on('online', () => { - // Worker is online -}); -``` - -It is not emitted in the worker. - -### worker.disconnect() - -In a worker, this function will close all servers, wait for the `'close'` event on -those servers, and then disconnect the IPC channel. - -In the master, an internal message is sent to the worker causing it to call -`.disconnect()` on itself. - -Causes `.suicide` to be set. - -Note that after a server is closed, it will no longer accept new connections, -but connections may be accepted by any other listening worker. Existing -connections will be allowed to close as usual. When no more connections exist, -see [`server.close()`][], the IPC channel to the worker will close allowing it to -die gracefully. - -The above applies *only* to server connections, client connections are not -automatically closed by workers, and disconnect does not wait for them to close -before exiting. - -Note that in a worker, `process.disconnect` exists, but it is not this function, -it is [`disconnect`][]. - -Because long living server connections may block workers from disconnecting, it -may be useful to send a message, so application specific actions may be taken to -close them. It also may be useful to implement a timeout, killing a worker if -the `'disconnect'` event has not been emitted after some time. - -```js -if (cluster.isMaster) { - var worker = cluster.fork(); - var timeout; - - worker.on('listening', (address) => { - worker.send('shutdown'); - worker.disconnect(); - timeout = setTimeout(() => { - worker.kill(); - }, 2000); - }); - - worker.on('disconnect', () => { - clearTimeout(timeout); - }); - -} else if (cluster.isWorker) { - const net = require('net'); - var server = net.createServer((socket) => { - // connections never end - }); - - server.listen(8000); - - process.on('message', (msg) => { - if(msg === 'shutdown') { - // initiate graceful close of any connections to server - } - }); -} -``` - -### worker.id - -* {Number} - -Each new worker is given its own unique id, this id is stored in the -`id`. - -While a worker is alive, this is the key that indexes it in -cluster.workers - -### worker.isConnected() - -This function returns `true` if the worker is connected to its master via its IPC -channel, `false` otherwise. A worker is connected to its master after it's been -created. It is disconnected after the `'disconnect'` event is emitted. - -### worker.isDead() - -This function returns `true` if the worker's process has terminated (either -because of exiting or being signaled). Otherwise, it returns `false`. - -### worker.kill([signal='SIGTERM']) - -* `signal` {String} Name of the kill signal to send to the worker - process. - -This function will kill the worker. In the master, it does this by disconnecting -the `worker.process`, and once disconnected, killing with `signal`. In the -worker, it does it by disconnecting the channel, and then exiting with code `0`. - -Causes `.suicide` to be set. - -This method is aliased as `worker.destroy()` for backwards compatibility. - -Note that in a worker, `process.kill()` exists, but it is not this function, -it is [`kill`][]. - -### worker.process - -* {ChildProcess} - -All workers are created using [`child_process.fork()`][], the returned object -from this function is stored as `.process`. In a worker, the global `process` -is stored. - -See: [Child Process module][] - -Note that workers will call `process.exit(0)` if the `'disconnect'` event occurs -on `process` and `.suicide` is not `true`. This protects against accidental -disconnection. - -### worker.send(message[, sendHandle][, callback]) - -* `message` {Object} -* `sendHandle` {Handle} -* `callback` {Function} -* Return: Boolean - -Send a message to a worker or master, optionally with a handle. - -In the master this sends a message to a specific worker. It is identical to -[`ChildProcess.send()`][]. - -In a worker this sends a message to the master. It is identical to -`process.send()`. - -This example will echo back all messages from the master: - -```js -if (cluster.isMaster) { - var worker = cluster.fork(); - worker.send('hi there'); - -} else if (cluster.isWorker) { - process.on('message', (msg) => { - process.send(msg); - }); -} -``` - -### worker.suicide - -* {Boolean} - -Set by calling `.kill()` or `.disconnect()`, until then it is `undefined`. - -The boolean `worker.suicide` lets you distinguish between voluntary and accidental -exit, the master may choose not to respawn a worker based on this value. - -```js -cluster.on('exit', (worker, code, signal) => { - if (worker.suicide === true) { - console.log('Oh, it was just suicide\' – no need to worry'). - } -}); - -// kill worker -worker.kill(); -``` - -## Event: 'disconnect' - -* `worker` {cluster.Worker} - -Emitted after the worker IPC channel has disconnected. This can occur when a -worker exits gracefully, is killed, or is disconnected manually (such as with -worker.disconnect()). - -There may be a delay between the `'disconnect'` and `'exit'` events. These events -can be used to detect if the process is stuck in a cleanup or if there are -long-living connections. - -```js -cluster.on('disconnect', (worker) => { - console.log(`The worker #${worker.id} has disconnected`); -}); -``` - -## Event: 'exit' - -* `worker` {cluster.Worker} -* `code` {Number} the exit code, if it exited normally. -* `signal` {String} the name of the signal (eg. `'SIGHUP'`) that caused - the process to be killed. - -When any of the workers die the cluster module will emit the `'exit'` event. - -This can be used to restart the worker by calling `.fork()` again. - -```js -cluster.on('exit', (worker, code, signal) => { - console.log('worker %d died (%s). restarting...', - worker.process.pid, signal || code); - cluster.fork(); -}); -``` - -See [child_process event: 'exit'][]. - -## Event: 'fork' - -* `worker` {cluster.Worker} - -When a new worker is forked the cluster module will emit a `'fork'` event. -This can be used to log worker activity, and create your own timeout. - -```js -var timeouts = []; -function errorMsg() { - console.error('Something must be wrong with the connection ...'); -} - -cluster.on('fork', (worker) => { - timeouts[worker.id] = setTimeout(errorMsg, 2000); -}); -cluster.on('listening', (worker, address) => { - clearTimeout(timeouts[worker.id]); -}); -cluster.on('exit', (worker, code, signal) => { - clearTimeout(timeouts[worker.id]); - errorMsg(); -}); -``` - -## Event: 'listening' - -* `worker` {cluster.Worker} -* `address` {Object} - -After calling `listen()` from a worker, when the `'listening'` event is emitted on -the server, a `'listening'` event will also be emitted on `cluster` in the master. - -The event handler is executed with two arguments, the `worker` contains the worker -object and the `address` object contains the following connection properties: -`address`, `port` and `addressType`. This is very useful if the worker is listening -on more than one address. - -```js -cluster.on('listening', (worker, address) => { - console.log( - `A worker is now connected to ${address.address}:${address.port}`); -}); -``` - -The `addressType` is one of: - -* `4` (TCPv4) -* `6` (TCPv6) -* `-1` (unix domain socket) -* `"udp4"` or `"udp6"` (UDP v4 or v6) - -## Event: 'message' - -* `worker` {cluster.Worker} -* `message` {Object} - -Emitted when any worker receives a message. - -See [child_process event: 'message'][]. - -## Event: 'online' - -* `worker` {cluster.Worker} - -After forking a new worker, the worker should respond with an online message. -When the master receives an online message it will emit this event. -The difference between `'fork'` and `'online'` is that fork is emitted when the -master forks a worker, and 'online' is emitted when the worker is running. - -```js -cluster.on('online', (worker) => { - console.log('Yay, the worker responded after it was forked'); -}); -``` - -## Event: 'setup' - -* `settings` {Object} - -Emitted every time `.setupMaster()` is called. - -The `settings` object is the `cluster.settings` object at the time -`.setupMaster()` was called and is advisory only, since multiple calls to -`.setupMaster()` can be made in a single tick. - -If accuracy is important, use `cluster.settings`. - -## cluster.disconnect([callback]) - -* `callback` {Function} called when all workers are disconnected and handles are - closed - -Calls `.disconnect()` on each worker in `cluster.workers`. - -When they are disconnected all internal handles will be closed, allowing the -master process to die gracefully if no other event is waiting. - -The method takes an optional callback argument which will be called when finished. - -This can only be called from the master process. - -## cluster.fork([env]) - -* `env` {Object} Key/value pairs to add to worker process environment. -* return {cluster.Worker} - -Spawn a new worker process. - -This can only be called from the master process. - -## cluster.isMaster - -* {Boolean} - -True if the process is a master. This is determined -by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` is -undefined, then `isMaster` is `true`. - -## cluster.isWorker - -* {Boolean} - -True if the process is not a master (it is the negation of `cluster.isMaster`). - -## cluster.schedulingPolicy - -The scheduling policy, either `cluster.SCHED_RR` for round-robin or -`cluster.SCHED_NONE` to leave it to the operating system. This is a -global setting and effectively frozen once you spawn the first worker -or call `cluster.setupMaster()`, whatever comes first. - -`SCHED_RR` is the default on all operating systems except Windows. -Windows will change to `SCHED_RR` once libuv is able to effectively -distribute IOCP handles without incurring a large performance hit. - -`cluster.schedulingPolicy` can also be set through the -`NODE_CLUSTER_SCHED_POLICY` environment variable. Valid -values are `"rr"` and `"none"`. - -## cluster.settings - -* {Object} - * `execArgv` {Array} list of string arguments passed to the Node.js - executable. (Default=`process.execArgv`) - * `exec` {String} file path to worker file. (Default=`process.argv[1]`) - * `args` {Array} string arguments passed to worker. - (Default=`process.argv.slice(2)`) - * `silent` {Boolean} whether or not to send output to parent's stdio. - (Default=`false`) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - -After calling `.setupMaster()` (or `.fork()`) this settings object will contain -the settings, including the default values. - -It is effectively frozen after being set, because `.setupMaster()` can -only be called once. - -This object is not supposed to be changed or set manually, by you. - -## cluster.setupMaster([settings]) - -* `settings` {Object} - * `exec` {String} file path to worker file. (Default=`process.argv[1]`) - * `args` {Array} string arguments passed to worker. - (Default=`process.argv.slice(2)`) - * `silent` {Boolean} whether or not to send output to parent's stdio. - (Default=`false`) - -`setupMaster` is used to change the default 'fork' behavior. Once called, -the settings will be present in `cluster.settings`. - -Note that: - -* any settings changes only affect future calls to `.fork()` and have no - effect on workers that are already running -* The *only* attribute of a worker that cannot be set via `.setupMaster()` is - the `env` passed to `.fork()` -* the defaults above apply to the first call only, the defaults for later - calls is the current value at the time of `cluster.setupMaster()` is called - -Example: - -```js -const cluster = require('cluster'); -cluster.setupMaster({ - exec: 'worker.js', - args: ['--use', 'https'], - silent: true -}); -cluster.fork(); // https worker -cluster.setupMaster({ - exec: 'worker.js', - args: ['--use', 'http'] -}); -cluster.fork(); // http worker -``` - -This can only be called from the master process. - -## cluster.worker - -* {Object} - -A reference to the current worker object. Not available in the master process. - -```js -const cluster = require('cluster'); - -if (cluster.isMaster) { - console.log('I am master'); - cluster.fork(); - cluster.fork(); -} else if (cluster.isWorker) { - console.log(`I am worker #${cluster.worker.id}`); -} -``` - -## cluster.workers - -* {Object} - -A hash that stores the active worker objects, keyed by `id` field. Makes it -easy to loop through all the workers. It is only available in the master -process. - -A worker is removed from cluster.workers after the worker has disconnected _and_ -exited. The order between these two events cannot be determined in advance. -However, it is guaranteed that the removal from the cluster.workers list happens -before last `'disconnect'` or `'exit'` event is emitted. - -```js -// Go through all workers -function eachWorker(callback) { - for (var id in cluster.workers) { - callback(cluster.workers[id]); - } -} -eachWorker((worker) => { - worker.send('big announcement to all workers'); -}); -``` - -Should you wish to reference a worker over a communication channel, using -the worker's unique id is the easiest way to find the worker. - -```js -socket.on('data', (id) => { - var worker = cluster.workers[id]; -}); -``` - -[`child_process.fork()`]: child_process.html#child_process_child_process_fork_modulepath_args_options -[`ChildProcess.send()`]: child_process.html#child_process_child_send_message_sendhandle_callback -[`disconnect`]: child_process.html#child_process_child_disconnect -[`kill`]: process.html#process_process_kill_pid_signal -[`server.close()`]: net.html#net_event_close -[Child Process module]: child_process.html#child_process_child_process_fork_modulepath_args_options -[child_process event: 'exit']: child_process.html#child_process_event_exit -[child_process event: 'message']: child_process.html#child_process_event_message diff --git a/doc/api/cluster.md b/doc/api/cluster.md new file mode 100644 index 00000000000000..fcc9f24be02a30 --- /dev/null +++ b/doc/api/cluster.md @@ -0,0 +1,694 @@ +# Cluster + + Stability: 2 - Stable + +A single instance of Node.js runs in a single thread. To take advantage of +multi-core systems the user will sometimes want to launch a cluster of Node.js +processes to handle the load. + +The cluster module allows you to easily create child processes that +all share server ports. + +```js +const cluster = require('cluster'); +const http = require('http'); +const numCPUs = require('os').cpus().length; + +if (cluster.isMaster) { + // Fork workers. + for (var i = 0; i < numCPUs; i++) { + cluster.fork(); + } + + cluster.on('exit', (worker, code, signal) => { + console.log(`worker ${worker.process.pid} died`); + }); +} else { + // Workers can share any TCP connection + // In this case it is an HTTP server + http.createServer((req, res) => { + res.writeHead(200); + res.end('hello world\n'); + }).listen(8000); +} +``` + +Running Node.js will now share port 8000 between the workers: + +``` +$ NODE_DEBUG=cluster node server.js +23521,Master Worker 23524 online +23521,Master Worker 23526 online +23521,Master Worker 23523 online +23521,Master Worker 23528 online +``` + +Please note that, on Windows, it is not yet possible to set up a named pipe +server in a worker. + +## How It Works + + + +The worker processes are spawned using the [`child_process.fork()`][] method, +so that they can communicate with the parent via IPC and pass server +handles back and forth. + +The cluster module supports two methods of distributing incoming +connections. + +The first one (and the default one on all platforms except Windows), +is the round-robin approach, where the master process listens on a +port, accepts new connections and distributes them across the workers +in a round-robin fashion, with some built-in smarts to avoid +overloading a worker process. + +The second approach is where the master process creates the listen +socket and sends it to interested workers. The workers then accept +incoming connections directly. + +The second approach should, in theory, give the best performance. +In practice however, distribution tends to be very unbalanced due +to operating system scheduler vagaries. Loads have been observed +where over 70% of all connections ended up in just two processes, +out of a total of eight. + +Because `server.listen()` hands off most of the work to the master +process, there are three cases where the behavior between a normal +Node.js process and a cluster worker differs: + +1. `server.listen({fd: 7})` Because the message is passed to the master, + file descriptor 7 **in the parent** will be listened on, and the + handle passed to the worker, rather than listening to the worker's + idea of what the number 7 file descriptor references. +2. `server.listen(handle)` Listening on handles explicitly will cause + the worker to use the supplied handle, rather than talk to the master + process. If the worker already has the handle, then it's presumed + that you know what you are doing. +3. `server.listen(0)` Normally, this will cause servers to listen on a + random port. However, in a cluster, each worker will receive the + same "random" port each time they do `listen(0)`. In essence, the + port is random the first time, but predictable thereafter. If you + want to listen on a unique port, generate a port number based on the + cluster worker ID. + +There is no routing logic in Node.js, or in your program, and no shared +state between the workers. Therefore, it is important to design your +program such that it does not rely too heavily on in-memory data objects +for things like sessions and login. + +Because workers are all separate processes, they can be killed or +re-spawned depending on your program's needs, without affecting other +workers. As long as there are some workers still alive, the server will +continue to accept connections. If no workers are alive, existing connections +will be dropped and new connections will be refused. Node.js does not +automatically manage the number of workers for you, however. It is your +responsibility to manage the worker pool for your application's needs. + + + +## Class: Worker + +A Worker object contains all public information and method about a worker. +In the master it can be obtained using `cluster.workers`. In a worker +it can be obtained using `cluster.worker`. + +### Event: 'disconnect' + +Similar to the `cluster.on('disconnect')` event, but specific to this worker. + +```js +cluster.fork().on('disconnect', () => { + // Worker has disconnected +}); +``` + +### Event: 'error' + +This event is the same as the one provided by [`child_process.fork()`][]. + +In a worker you can also use `process.on('error')`. + +### Event: 'exit' + +* `code` {Number} the exit code, if it exited normally. +* `signal` {String} the name of the signal (eg. `'SIGHUP'`) that caused + the process to be killed. + +Similar to the `cluster.on('exit')` event, but specific to this worker. + +```js +const worker = cluster.fork(); +worker.on('exit', (code, signal) => { + if( signal ) { + console.log(`worker was killed by signal: ${signal}`); + } else if( code !== 0 ) { + console.log(`worker exited with error code: ${code}`); + } else { + console.log('worker success!'); + } +}); +``` + +### Event: 'listening' + +* `address` {Object} + +Similar to the `cluster.on('listening')` event, but specific to this worker. + +```js +cluster.fork().on('listening', (address) => { + // Worker is listening +}); +``` + +It is not emitted in the worker. + +### Event: 'message' + +* `message` {Object} + +Similar to the `cluster.on('message')` event, but specific to this worker. + +This event is the same as the one provided by [`child_process.fork()`][]. + +In a worker you can also use `process.on('message')`. + +As an example, here is a cluster that keeps count of the number of requests +in the master process using the message system: + +```js +const cluster = require('cluster'); +const http = require('http'); + +if (cluster.isMaster) { + + // Keep track of http requests + var numReqs = 0; + setInterval(() => { + console.log('numReqs =', numReqs); + }, 1000); + + // Count requests + function messageHandler(msg) { + if (msg.cmd && msg.cmd == 'notifyRequest') { + numReqs += 1; + } + } + + // Start workers and listen for messages containing notifyRequest + const numCPUs = require('os').cpus().length; + for (var i = 0; i < numCPUs; i++) { + cluster.fork(); + } + + Object.keys(cluster.workers).forEach((id) => { + cluster.workers[id].on('message', messageHandler); + }); + +} else { + + // Worker processes have a http server. + http.Server((req, res) => { + res.writeHead(200); + res.end('hello world\n'); + + // notify master about the request + process.send({ cmd: 'notifyRequest' }); + }).listen(8000); +} +``` + +### Event: 'online' + +Similar to the `cluster.on('online')` event, but specific to this worker. + +```js +cluster.fork().on('online', () => { + // Worker is online +}); +``` + +It is not emitted in the worker. + +### worker.disconnect() + +In a worker, this function will close all servers, wait for the `'close'` event on +those servers, and then disconnect the IPC channel. + +In the master, an internal message is sent to the worker causing it to call +`.disconnect()` on itself. + +Causes `.suicide` to be set. + +Note that after a server is closed, it will no longer accept new connections, +but connections may be accepted by any other listening worker. Existing +connections will be allowed to close as usual. When no more connections exist, +see [`server.close()`][], the IPC channel to the worker will close allowing it to +die gracefully. + +The above applies *only* to server connections, client connections are not +automatically closed by workers, and disconnect does not wait for them to close +before exiting. + +Note that in a worker, `process.disconnect` exists, but it is not this function, +it is [`disconnect`][]. + +Because long living server connections may block workers from disconnecting, it +may be useful to send a message, so application specific actions may be taken to +close them. It also may be useful to implement a timeout, killing a worker if +the `'disconnect'` event has not been emitted after some time. + +```js +if (cluster.isMaster) { + var worker = cluster.fork(); + var timeout; + + worker.on('listening', (address) => { + worker.send('shutdown'); + worker.disconnect(); + timeout = setTimeout(() => { + worker.kill(); + }, 2000); + }); + + worker.on('disconnect', () => { + clearTimeout(timeout); + }); + +} else if (cluster.isWorker) { + const net = require('net'); + var server = net.createServer((socket) => { + // connections never end + }); + + server.listen(8000); + + process.on('message', (msg) => { + if(msg === 'shutdown') { + // initiate graceful close of any connections to server + } + }); +} +``` + +### worker.id + +* {Number} + +Each new worker is given its own unique id, this id is stored in the +`id`. + +While a worker is alive, this is the key that indexes it in +cluster.workers + +### worker.isConnected() + +This function returns `true` if the worker is connected to its master via its IPC +channel, `false` otherwise. A worker is connected to its master after it's been +created. It is disconnected after the `'disconnect'` event is emitted. + +### worker.isDead() + +This function returns `true` if the worker's process has terminated (either +because of exiting or being signaled). Otherwise, it returns `false`. + +### worker.kill([signal='SIGTERM']) + +* `signal` {String} Name of the kill signal to send to the worker + process. + +This function will kill the worker. In the master, it does this by disconnecting +the `worker.process`, and once disconnected, killing with `signal`. In the +worker, it does it by disconnecting the channel, and then exiting with code `0`. + +Causes `.suicide` to be set. + +This method is aliased as `worker.destroy()` for backwards compatibility. + +Note that in a worker, `process.kill()` exists, but it is not this function, +it is [`kill`][]. + +### worker.process + +* {ChildProcess} + +All workers are created using [`child_process.fork()`][], the returned object +from this function is stored as `.process`. In a worker, the global `process` +is stored. + +See: [Child Process module][] + +Note that workers will call `process.exit(0)` if the `'disconnect'` event occurs +on `process` and `.suicide` is not `true`. This protects against accidental +disconnection. + +### worker.send(message[, sendHandle][, callback]) + +* `message` {Object} +* `sendHandle` {Handle} +* `callback` {Function} +* Return: Boolean + +Send a message to a worker or master, optionally with a handle. + +In the master this sends a message to a specific worker. It is identical to +[`ChildProcess.send()`][]. + +In a worker this sends a message to the master. It is identical to +`process.send()`. + +This example will echo back all messages from the master: + +```js +if (cluster.isMaster) { + var worker = cluster.fork(); + worker.send('hi there'); + +} else if (cluster.isWorker) { + process.on('message', (msg) => { + process.send(msg); + }); +} +``` + +### worker.suicide + +* {Boolean} + +Set by calling `.kill()` or `.disconnect()`, until then it is `undefined`. + +The boolean `worker.suicide` lets you distinguish between voluntary and accidental +exit, the master may choose not to respawn a worker based on this value. + +```js +cluster.on('exit', (worker, code, signal) => { + if (worker.suicide === true) { + console.log('Oh, it was just suicide\' – no need to worry'). + } +}); + +// kill worker +worker.kill(); +``` + +## Event: 'disconnect' + +* `worker` {cluster.Worker} + +Emitted after the worker IPC channel has disconnected. This can occur when a +worker exits gracefully, is killed, or is disconnected manually (such as with +worker.disconnect()). + +There may be a delay between the `'disconnect'` and `'exit'` events. These events +can be used to detect if the process is stuck in a cleanup or if there are +long-living connections. + +```js +cluster.on('disconnect', (worker) => { + console.log(`The worker #${worker.id} has disconnected`); +}); +``` + +## Event: 'exit' + +* `worker` {cluster.Worker} +* `code` {Number} the exit code, if it exited normally. +* `signal` {String} the name of the signal (eg. `'SIGHUP'`) that caused + the process to be killed. + +When any of the workers die the cluster module will emit the `'exit'` event. + +This can be used to restart the worker by calling `.fork()` again. + +```js +cluster.on('exit', (worker, code, signal) => { + console.log('worker %d died (%s). restarting...', + worker.process.pid, signal || code); + cluster.fork(); +}); +``` + +See [child_process event: 'exit'][]. + +## Event: 'fork' + +* `worker` {cluster.Worker} + +When a new worker is forked the cluster module will emit a `'fork'` event. +This can be used to log worker activity, and create your own timeout. + +```js +var timeouts = []; +function errorMsg() { + console.error('Something must be wrong with the connection ...'); +} + +cluster.on('fork', (worker) => { + timeouts[worker.id] = setTimeout(errorMsg, 2000); +}); +cluster.on('listening', (worker, address) => { + clearTimeout(timeouts[worker.id]); +}); +cluster.on('exit', (worker, code, signal) => { + clearTimeout(timeouts[worker.id]); + errorMsg(); +}); +``` + +## Event: 'listening' + +* `worker` {cluster.Worker} +* `address` {Object} + +After calling `listen()` from a worker, when the `'listening'` event is emitted on +the server, a `'listening'` event will also be emitted on `cluster` in the master. + +The event handler is executed with two arguments, the `worker` contains the worker +object and the `address` object contains the following connection properties: +`address`, `port` and `addressType`. This is very useful if the worker is listening +on more than one address. + +```js +cluster.on('listening', (worker, address) => { + console.log( + `A worker is now connected to ${address.address}:${address.port}`); +}); +``` + +The `addressType` is one of: + +* `4` (TCPv4) +* `6` (TCPv6) +* `-1` (unix domain socket) +* `"udp4"` or `"udp6"` (UDP v4 or v6) + +## Event: 'message' + +* `worker` {cluster.Worker} +* `message` {Object} + +Emitted when any worker receives a message. + +See [child_process event: 'message'][]. + +## Event: 'online' + +* `worker` {cluster.Worker} + +After forking a new worker, the worker should respond with an online message. +When the master receives an online message it will emit this event. +The difference between `'fork'` and `'online'` is that fork is emitted when the +master forks a worker, and 'online' is emitted when the worker is running. + +```js +cluster.on('online', (worker) => { + console.log('Yay, the worker responded after it was forked'); +}); +``` + +## Event: 'setup' + +* `settings` {Object} + +Emitted every time `.setupMaster()` is called. + +The `settings` object is the `cluster.settings` object at the time +`.setupMaster()` was called and is advisory only, since multiple calls to +`.setupMaster()` can be made in a single tick. + +If accuracy is important, use `cluster.settings`. + +## cluster.disconnect([callback]) + +* `callback` {Function} called when all workers are disconnected and handles are + closed + +Calls `.disconnect()` on each worker in `cluster.workers`. + +When they are disconnected all internal handles will be closed, allowing the +master process to die gracefully if no other event is waiting. + +The method takes an optional callback argument which will be called when finished. + +This can only be called from the master process. + +## cluster.fork([env]) + +* `env` {Object} Key/value pairs to add to worker process environment. +* return {cluster.Worker} + +Spawn a new worker process. + +This can only be called from the master process. + +## cluster.isMaster + +* {Boolean} + +True if the process is a master. This is determined +by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` is +undefined, then `isMaster` is `true`. + +## cluster.isWorker + +* {Boolean} + +True if the process is not a master (it is the negation of `cluster.isMaster`). + +## cluster.schedulingPolicy + +The scheduling policy, either `cluster.SCHED_RR` for round-robin or +`cluster.SCHED_NONE` to leave it to the operating system. This is a +global setting and effectively frozen once you spawn the first worker +or call `cluster.setupMaster()`, whatever comes first. + +`SCHED_RR` is the default on all operating systems except Windows. +Windows will change to `SCHED_RR` once libuv is able to effectively +distribute IOCP handles without incurring a large performance hit. + +`cluster.schedulingPolicy` can also be set through the +`NODE_CLUSTER_SCHED_POLICY` environment variable. Valid +values are `"rr"` and `"none"`. + +## cluster.settings + +* {Object} + * `execArgv` {Array} list of string arguments passed to the Node.js + executable. (Default=`process.execArgv`) + * `exec` {String} file path to worker file. (Default=`process.argv[1]`) + * `args` {Array} string arguments passed to worker. + (Default=`process.argv.slice(2)`) + * `silent` {Boolean} whether or not to send output to parent's stdio. + (Default=`false`) + * `uid` {Number} Sets the user identity of the process. (See setuid(2).) + * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + +After calling `.setupMaster()` (or `.fork()`) this settings object will contain +the settings, including the default values. + +It is effectively frozen after being set, because `.setupMaster()` can +only be called once. + +This object is not supposed to be changed or set manually, by you. + +## cluster.setupMaster([settings]) + +* `settings` {Object} + * `exec` {String} file path to worker file. (Default=`process.argv[1]`) + * `args` {Array} string arguments passed to worker. + (Default=`process.argv.slice(2)`) + * `silent` {Boolean} whether or not to send output to parent's stdio. + (Default=`false`) + +`setupMaster` is used to change the default 'fork' behavior. Once called, +the settings will be present in `cluster.settings`. + +Note that: + +* any settings changes only affect future calls to `.fork()` and have no + effect on workers that are already running +* The *only* attribute of a worker that cannot be set via `.setupMaster()` is + the `env` passed to `.fork()` +* the defaults above apply to the first call only, the defaults for later + calls is the current value at the time of `cluster.setupMaster()` is called + +Example: + +```js +const cluster = require('cluster'); +cluster.setupMaster({ + exec: 'worker.js', + args: ['--use', 'https'], + silent: true +}); +cluster.fork(); // https worker +cluster.setupMaster({ + exec: 'worker.js', + args: ['--use', 'http'] +}); +cluster.fork(); // http worker +``` + +This can only be called from the master process. + +## cluster.worker + +* {Object} + +A reference to the current worker object. Not available in the master process. + +```js +const cluster = require('cluster'); + +if (cluster.isMaster) { + console.log('I am master'); + cluster.fork(); + cluster.fork(); +} else if (cluster.isWorker) { + console.log(`I am worker #${cluster.worker.id}`); +} +``` + +## cluster.workers + +* {Object} + +A hash that stores the active worker objects, keyed by `id` field. Makes it +easy to loop through all the workers. It is only available in the master +process. + +A worker is removed from cluster.workers after the worker has disconnected _and_ +exited. The order between these two events cannot be determined in advance. +However, it is guaranteed that the removal from the cluster.workers list happens +before last `'disconnect'` or `'exit'` event is emitted. + +```js +// Go through all workers +function eachWorker(callback) { + for (var id in cluster.workers) { + callback(cluster.workers[id]); + } +} +eachWorker((worker) => { + worker.send('big announcement to all workers'); +}); +``` + +Should you wish to reference a worker over a communication channel, using +the worker's unique id is the easiest way to find the worker. + +```js +socket.on('data', (id) => { + var worker = cluster.workers[id]; +}); +``` + +[`child_process.fork()`]: child_process.html#child_process_child_process_fork_modulepath_args_options +[`ChildProcess.send()`]: child_process.html#child_process_child_send_message_sendhandle_options_callback +[`disconnect`]: child_process.html#child_process_child_disconnect +[`kill`]: process.html#process_process_kill_pid_signal +[`server.close()`]: net.html#net_event_close +[Child Process module]: child_process.html#child_process_child_process_fork_modulepath_args_options +[child_process event: 'exit']: child_process.html#child_process_event_exit +[child_process event: 'message']: child_process.html#child_process_event_message diff --git a/doc/api/console.markdown b/doc/api/console.markdown deleted file mode 100644 index 6cf5051af2591e..00000000000000 --- a/doc/api/console.markdown +++ /dev/null @@ -1,226 +0,0 @@ -# Console - - Stability: 2 - Stable - -The `console` module provides a simple debugging console that is similar to the -JavaScript console mechanism provided by web browsers. - -The module exports two specific components: - -* A `Console` class with methods such as `console.log()`, `console.error()` and - `console.warn()` that can be used to write to any Node.js stream. -* A global `console` instance configured to write to `stdout` and `stderr`. - Because this object is global, it can be used without calling - `require('console')`. - -Example using the global `console`: - -```js -console.log('hello world'); - // Prints: hello world, to stdout -console.log('hello %s', 'world'); - // Prints: hello world, to stdout -console.error(new Error('Whoops, something bad happened')); - // Prints: [Error: Whoops, something bad happened], to stderr - -const name = 'Will Robinson'; -console.warn(`Danger ${name}! Danger!`); - // Prints: Danger Will Robinson! Danger!, to stderr -``` - -Example using the `Console` class: - -```js -const out = getStreamSomehow(); -const err = getStreamSomehow(); -const myConsole = new console.Console(out, err); - -myConsole.log('hello world'); - // Prints: hello world, to out -myConsole.log('hello %s', 'world'); - // Prints: hello world, to out -myConsole.error(new Error('Whoops, something bad happened')); - // Prints: [Error: Whoops, something bad happened], to err - -const name = 'Will Robinson'; -myConsole.warn(`Danger ${name}! Danger!`); - // Prints: Danger Will Robinson! Danger!, to err -``` - -While the API for the `Console` class is designed fundamentally around the -browser `console` object, the `Console` in Node.js is *not* intended to -duplicate the browser's functionality exactly. - -## Asynchronous vs Synchronous Consoles - -The console functions are asynchronous unless the destination is a file. -Disks are fast and operating systems normally employ write-back caching; -it should be a very rare occurrence indeed that a write blocks, but it -is possible. - -## Class: Console - - - -The `Console` class can be used to create a simple logger with configurable -output streams and can be accessed using either `require('console').Console` -or `console.Console`: - -```js -const Console = require('console').Console; -const Console = console.Console; -``` - -### new Console(stdout[, stderr]) - -Creates a new `Console` by passing one or two writable stream instances. -`stdout` is a writable stream to print log or info output. `stderr` -is used for warning or error output. If `stderr` isn't passed, warning and error -output will be sent to `stdout`. - -```js -const output = fs.createWriteStream('./stdout.log'); -const errorOutput = fs.createWriteStream('./stderr.log'); -// custom simple logger -const logger = new Console(output, errorOutput); -// use it like console -var count = 5; -logger.log('count: %d', count); -// in stdout.log: count 5 -``` - -The global `console` is a special `Console` whose output is sent to -[`process.stdout`][] and [`process.stderr`][]. It is equivalent to calling: - -```js -new Console(process.stdout, process.stderr); -``` - -### console.assert(value[, message][, ...]) - -A simple assertion test that verifies whether `value` is truthy. If it is not, -an `AssertionError` is thrown. If provided, the error `message` is formatted -using [`util.format()`][] and used as the error message. - -```js -console.assert(true, 'does nothing'); - // OK -console.assert(false, 'Whoops %s', 'didn\'t work'); - // AssertionError: Whoops didn't work -``` - -### console.dir(obj[, options]) - -Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`. -This function bypasses any custom `inspect()` function defined on `obj`. An -optional `options` object may be passed to alter certain aspects of the -formatted string: - -- `showHidden` - if `true` then the object's non-enumerable and symbol -properties will be shown too. Defaults to `false`. - -- `depth` - tells [`util.inspect()`][] how many times to recurse while -formatting the object. This is useful for inspecting large complicated objects. -Defaults to `2`. To make it recurse indefinitely, pass `null`. - -- `colors` - if `true`, then the output will be styled with ANSI color codes. -Defaults to `false`. Colors are customizable; see -[customizing `util.inspect()` colors][]. - -### console.error([data][, ...]) - -Prints to `stderr` with newline. Multiple arguments can be passed, with the -first used as the primary message and all additional used as substitution -values similar to `printf(3)` (the arguments are all passed to -[`util.format()`][]). - -```js -const code = 5; -console.error('error #%d', code); - // Prints: error #5, to stderr -console.error('error', code); - // Prints: error 5, to stderr -``` - -If formatting elements (e.g. `%d`) are not found in the first string then -[`util.inspect()`][] is called on each argument and the resulting string -values are concatenated. See [`util.format()`][] for more information. - -### console.info([data][, ...]) - -The `console.info()` function is an alias for [`console.log()`][]. - -### console.log([data][, ...]) - -Prints to `stdout` with newline. Multiple arguments can be passed, with the -first used as the primary message and all additional used as substitution -values similar to `printf(3)` (the arguments are all passed to -[`util.format()`][]). - -```js -var count = 5; -console.log('count: %d', count); - // Prints: count: 5, to stdout -console.log('count: ', count); - // Prints: count: 5, to stdout -``` - -If formatting elements (e.g. `%d`) are not found in the first string then -[`util.inspect()`][] is called on each argument and the resulting string -values are concatenated. See [`util.format()`][] for more information. - -### console.time(label) - -Starts a timer that can be used to compute the duration of an operation. Timers -are identified by a unique `label`. Use the same `label` when you call -[`console.timeEnd()`][] to stop the timer and output the elapsed time in -milliseconds to stdout. Timer durations are accurate to the sub-millisecond. - -### console.timeEnd(label) - -Stops a timer that was previously started by calling [`console.time()`][] and -prints the result to stdout: - -```js -console.time('100-elements'); -for (var i = 0; i < 100; i++) { - ; -} -console.timeEnd('100-elements'); -// prints 100-elements: 225.438ms -``` - -### console.trace(message[, ...]) - -Prints to `stderr` the string `'Trace :'`, followed by the [`util.format()`][] -formatted message and stack trace to the current position in the code. - -```js -console.trace('Show me'); - // Prints: (stack trace will vary based on where trace is called) - // Trace: Show me - // at repl:2:9 - // at REPLServer.defaultEval (repl.js:248:27) - // at bound (domain.js:287:14) - // at REPLServer.runBound [as eval] (domain.js:300:12) - // at REPLServer. (repl.js:412:12) - // at emitOne (events.js:82:20) - // at REPLServer.emit (events.js:169:7) - // at REPLServer.Interface._onLine (readline.js:210:10) - // at REPLServer.Interface._line (readline.js:549:8) - // at REPLServer.Interface._ttyWrite (readline.js:826:14) -``` - -### console.warn([data][, ...]) - -The `console.warn()` function is an alias for [`console.error()`][]. - -[`console.error()`]: #console_console_error_data -[`console.log()`]: #console_console_log_data -[`console.time()`]: #console_console_time_label -[`console.timeEnd()`]: #console_console_timeend_label -[`process.stderr`]: process.html#process_process_stderr -[`process.stdout`]: process.html#process_process_stdout -[`util.format()`]: util.html#util_util_format_format -[`util.inspect()`]: util.html#util_util_inspect_object_options -[customizing `util.inspect()` colors]: util.html#util_customizing_util_inspect_colors diff --git a/doc/api/console.md b/doc/api/console.md new file mode 100644 index 00000000000000..655e64c5ac9f01 --- /dev/null +++ b/doc/api/console.md @@ -0,0 +1,267 @@ +# Console + + Stability: 2 - Stable + +The `console` module provides a simple debugging console that is similar to the +JavaScript console mechanism provided by web browsers. + +The module exports two specific components: + +* A `Console` class with methods such as `console.log()`, `console.error()` and + `console.warn()` that can be used to write to any Node.js stream. +* A global `console` instance configured to write to `stdout` and `stderr`. + Because this object is global, it can be used without calling + `require('console')`. + +Example using the global `console`: + +```js +console.log('hello world'); + // Prints: hello world, to stdout +console.log('hello %s', 'world'); + // Prints: hello world, to stdout +console.error(new Error('Whoops, something bad happened')); + // Prints: [Error: Whoops, something bad happened], to stderr + +const name = 'Will Robinson'; +console.warn(`Danger ${name}! Danger!`); + // Prints: Danger Will Robinson! Danger!, to stderr +``` + +Example using the `Console` class: + +```js +const out = getStreamSomehow(); +const err = getStreamSomehow(); +const myConsole = new console.Console(out, err); + +myConsole.log('hello world'); + // Prints: hello world, to out +myConsole.log('hello %s', 'world'); + // Prints: hello world, to out +myConsole.error(new Error('Whoops, something bad happened')); + // Prints: [Error: Whoops, something bad happened], to err + +const name = 'Will Robinson'; +myConsole.warn(`Danger ${name}! Danger!`); + // Prints: Danger Will Robinson! Danger!, to err +``` + +While the API for the `Console` class is designed fundamentally around the +browser `console` object, the `Console` in Node.js is *not* intended to +duplicate the browser's functionality exactly. + +## Asynchronous vs Synchronous Consoles + +The console functions are asynchronous unless the destination is a file. +Disks are fast and operating systems normally employ write-back caching; +it should be a very rare occurrence indeed that a write blocks, but it +is possible. + +## Class: Console + + + +The `Console` class can be used to create a simple logger with configurable +output streams and can be accessed using either `require('console').Console` +or `console.Console`: + +```js +const Console = require('console').Console; +const Console = console.Console; +``` + +### new Console(stdout[, stderr]) + +Creates a new `Console` by passing one or two writable stream instances. +`stdout` is a writable stream to print log or info output. `stderr` +is used for warning or error output. If `stderr` isn't passed, warning and error +output will be sent to `stdout`. + +```js +const output = fs.createWriteStream('./stdout.log'); +const errorOutput = fs.createWriteStream('./stderr.log'); +// custom simple logger +const logger = new Console(output, errorOutput); +// use it like console +var count = 5; +logger.log('count: %d', count); +// in stdout.log: count 5 +``` + +The global `console` is a special `Console` whose output is sent to +[`process.stdout`][] and [`process.stderr`][]. It is equivalent to calling: + +```js +new Console(process.stdout, process.stderr); +``` + +### console.assert(value[, message][, ...]) + +A simple assertion test that verifies whether `value` is truthy. If it is not, +an `AssertionError` is thrown. If provided, the error `message` is formatted +using [`util.format()`][] and used as the error message. + +```js +console.assert(true, 'does nothing'); + // OK +console.assert(false, 'Whoops %s', 'didn\'t work'); + // AssertionError: Whoops didn't work +``` + +*Note: the `console.assert()` method is implemented differently in Node.js +than the `console.assert()` method [available in browsers][web-api-assert].* + +Specifically, in browsers, calling `console.assert()` with a falsy +assertion will cause the `message` to be printed to the console without +interrupting execution of subsequent code. In Node.js, however, a falsy +assertion will cause an `AssertionError` to be thrown. + +Functionality approximating that implemented by browsers can be implemented +by extending Node.js' `console` and overriding the `console.assert()` method. + +In the following example, a simple module is created that extends and overrides +the default behavior of `console` in Node.js. + +```js +'use strict'; + +// Creates a simple extension of console with a +// new impl for assert without monkey-patching. +const myConsole = Object.setPrototypeOf({ + assert(assertion, message, ...args) { + try { + console.assert(assertion, message, ...args); + } catch (err) { + console.error(err.stack); + } + } +}, console); + +module.exports = myConsole; +``` + +This can then be used as a direct replacement for the built in console: + +```js +const console = require('./myConsole'); +console.assert(false, 'this message will print, but no error thrown'); +console.log('this will also print'); +``` + +### console.dir(obj[, options]) + +Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`. +This function bypasses any custom `inspect()` function defined on `obj`. An +optional `options` object may be passed to alter certain aspects of the +formatted string: + +- `showHidden` - if `true` then the object's non-enumerable and symbol +properties will be shown too. Defaults to `false`. + +- `depth` - tells [`util.inspect()`][] how many times to recurse while +formatting the object. This is useful for inspecting large complicated objects. +Defaults to `2`. To make it recurse indefinitely, pass `null`. + +- `colors` - if `true`, then the output will be styled with ANSI color codes. +Defaults to `false`. Colors are customizable; see +[customizing `util.inspect()` colors][]. + +### console.error([data][, ...]) + +Prints to `stderr` with newline. Multiple arguments can be passed, with the +first used as the primary message and all additional used as substitution +values similar to `printf(3)` (the arguments are all passed to +[`util.format()`][]). + +```js +const code = 5; +console.error('error #%d', code); + // Prints: error #5, to stderr +console.error('error', code); + // Prints: error 5, to stderr +``` + +If formatting elements (e.g. `%d`) are not found in the first string then +[`util.inspect()`][] is called on each argument and the resulting string +values are concatenated. See [`util.format()`][] for more information. + +### console.info([data][, ...]) + +The `console.info()` function is an alias for [`console.log()`][]. + +### console.log([data][, ...]) + +Prints to `stdout` with newline. Multiple arguments can be passed, with the +first used as the primary message and all additional used as substitution +values similar to `printf(3)` (the arguments are all passed to +[`util.format()`][]). + +```js +var count = 5; +console.log('count: %d', count); + // Prints: count: 5, to stdout +console.log('count: ', count); + // Prints: count: 5, to stdout +``` + +If formatting elements (e.g. `%d`) are not found in the first string then +[`util.inspect()`][] is called on each argument and the resulting string +values are concatenated. See [`util.format()`][] for more information. + +### console.time(label) + +Starts a timer that can be used to compute the duration of an operation. Timers +are identified by a unique `label`. Use the same `label` when you call +[`console.timeEnd()`][] to stop the timer and output the elapsed time in +milliseconds to stdout. Timer durations are accurate to the sub-millisecond. + +### console.timeEnd(label) + +Stops a timer that was previously started by calling [`console.time()`][] and +prints the result to stdout: + +```js +console.time('100-elements'); +for (var i = 0; i < 100; i++) { + ; +} +console.timeEnd('100-elements'); +// prints 100-elements: 225.438ms +``` + +### console.trace(message[, ...]) + +Prints to `stderr` the string `'Trace :'`, followed by the [`util.format()`][] +formatted message and stack trace to the current position in the code. + +```js +console.trace('Show me'); + // Prints: (stack trace will vary based on where trace is called) + // Trace: Show me + // at repl:2:9 + // at REPLServer.defaultEval (repl.js:248:27) + // at bound (domain.js:287:14) + // at REPLServer.runBound [as eval] (domain.js:300:12) + // at REPLServer. (repl.js:412:12) + // at emitOne (events.js:82:20) + // at REPLServer.emit (events.js:169:7) + // at REPLServer.Interface._onLine (readline.js:210:10) + // at REPLServer.Interface._line (readline.js:549:8) + // at REPLServer.Interface._ttyWrite (readline.js:826:14) +``` + +### console.warn([data][, ...]) + +The `console.warn()` function is an alias for [`console.error()`][]. + +[`console.error()`]: #console_console_error_data +[`console.log()`]: #console_console_log_data +[`console.time()`]: #console_console_time_label +[`console.timeEnd()`]: #console_console_timeend_label +[`process.stderr`]: process.html#process_process_stderr +[`process.stdout`]: process.html#process_process_stdout +[`util.format()`]: util.html#util_util_format_format +[`util.inspect()`]: util.html#util_util_inspect_object_options +[customizing `util.inspect()` colors]: util.html#util_customizing_util_inspect_colors +[web-api-assert]: https://developer.mozilla.org/en-US/docs/Web/API/console/assert diff --git a/doc/api/crypto.markdown b/doc/api/crypto.markdown deleted file mode 100644 index fa37570ed96081..00000000000000 --- a/doc/api/crypto.markdown +++ /dev/null @@ -1,1385 +0,0 @@ -# Crypto - - Stability: 2 - Stable - -The `crypto` module provides cryptographic functionality that includes a set of -wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. - -Use `require('crypto')` to access this module. - -```js -const crypto = require('crypto'); - -const secret = 'abcdefg'; -const hash = crypto.createHmac('sha256', secret) - .update('I love cupcakes') - .digest('hex'); -console.log(hash); - // Prints: - // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e -``` - -## Class: Certificate - -SPKAC is a Certificate Signing Request mechanism originally implemented by -Netscape and now specified formally as part of [HTML5's `keygen` element][]. - -The `crypto` module provides the `Certificate` class for working with SPKAC -data. The most common usage is handling output generated by the HTML5 -`` element. Node.js uses [OpenSSL's SPKAC implementation][] internally. - -### new crypto.Certificate() - -Instances of the `Certificate` class can be created using the `new` keyword -or by calling `crypto.Certificate()` as a function: - -```js -const crypto = require('crypto'); - -const cert1 = new crypto.Certificate(); -const cert2 = crypto.Certificate(); -``` - -### certificate.exportChallenge(spkac) - -The `spkac` data structure includes a public key and a challenge. The -`certificate.exportChallenge()` returns the challenge component in the -form of a Node.js [`Buffer`][]. The `spkac` argument can be either a string -or a [`Buffer`][]. - -```js -const cert = require('crypto').Certificate(); -const spkac = getSpkacSomehow(); -const challenge = cert.exportChallenge(spkac); -console.log(challenge.toString('utf8')); - // Prints the challenge as a UTF8 string -``` - -### certificate.exportPublicKey(spkac) - -The `spkac` data structure includes a public key and a challenge. The -`certificate.exportPublicKey()` returns the public key component in the -form of a Node.js [`Buffer`][]. The `spkac` argument can be either a string -or a [`Buffer`][]. - -```js -const cert = require('crypto').Certificate(); -const spkac = getSpkacSomehow(); -const publicKey = cert.exportPublicKey(spkac); -console.log(publicKey); - // Prints the public key as -``` - -### certificate.verifySpkac(spkac) - -Returns `true` if the given `spkac` data structure is valid, `false` otherwise. -The `spkac` argument must be a Node.js [`Buffer`][]. - -```js -const cert = require('crypto').Certificate(); -const spkac = getSpkacSomehow(); -console.log(cert.verifySpkac(new Buffer(spkac))); - // Prints true or false -``` - -## Class: Cipher - -Instances of the `Cipher` class are used to encrypt data. The class can be -used in one of two ways: - -- As a [stream][] that is both readable and writable, where plain unencrypted - data is written to produce encrypted data on the readable side, or -- Using the [`cipher.update()`][] and [`cipher.final()`][] methods to produce - the encrypted data. - -The [`crypto.createCipher()`][] or [`crypto.createCipheriv()`][] methods are -used to create `Cipher` instances. `Cipher` objects are not to be created -directly using the `new` keyword. - -Example: Using `Cipher` objects as streams: - -```js -const crypto = require('crypto'); -const cipher = crypto.createCipher('aes192', 'a password'); - -var encrypted = ''; -cipher.on('readable', () => { - var data = cipher.read(); - if (data) - encrypted += data.toString('hex'); -}); -cipher.on('end', () => { - console.log(encrypted); - // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 -}); - -cipher.write('some clear text data'); -cipher.end(); -``` - -Example: Using `Cipher` and piped streams: - -```js -const crypto = require('crypto'); -const fs = require('fs'); -const cipher = crypto.createCipher('aes192', 'a password'); - -const input = fs.createReadStream('test.js'); -const output = fs.createWriteStream('test.enc'); - -input.pipe(cipher).pipe(output); -``` - -Example: Using the [`cipher.update()`][] and [`cipher.final()`][] methods: - -```js -const crypto = require('crypto'); -const cipher = crypto.createCipher('aes192', 'a password'); - -var encrypted = cipher.update('some clear text data', 'utf8', 'hex'); -encrypted += cipher.final('hex'); -console.log(encrypted); - // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 -``` - -### cipher.final([output_encoding]) - -Returns any remaining enciphered contents. If `output_encoding` -parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. -If an `output_encoding` is not provided, a [`Buffer`][] is returned. - -Once the `cipher.final()` method has been called, the `Cipher` object can no -longer be used to encrypt data. Attempts to call `cipher.final()` more than -once will result in an error being thrown. - -### cipher.setAAD(buffer) - -When using an authenticated encryption mode (only `GCM` is currently -supported), the `cipher.setAAD()` method sets the value used for the -_additional authenticated data_ (AAD) input parameter. - -### cipher.getAuthTag() - -When using an authenticated encryption mode (only `GCM` is currently -supported), the `cipher.getAuthTag()` method returns a [`Buffer`][] containing -the _authentication tag_ that has been computed from the given data. - -The `cipher.getAuthTag()` method should only be called after encryption has -been completed using the [`cipher.final()`][] method. - -### cipher.setAutoPadding(auto_padding=true) - -When using block encryption algorithms, the `Cipher` class will automatically -add padding to the input data to the appropriate block size. To disable the -default padding call `cipher.setAutoPadding(false)`. - -When `auto_padding` is `false`, the length of the entire input data must be a -multiple of the cipher's block size or [`cipher.final()`][] will throw an Error. -Disabling automatic padding is useful for non-standard padding, for instance -using `0x0` instead of PKCS padding. - -The `cipher.setAutoPadding()` method must be called before [`cipher.final()`][]. - -### cipher.update(data[, input_encoding][, output_encoding]) - -Updates the cipher with `data`. If the `input_encoding` argument is given, -it's value must be one of `'utf8'`, `'ascii'`, or `'binary'` and the `data` -argument is a string using the specified encoding. If the `input_encoding` -argument is not given, `data` must be a [`Buffer`][]. If `data` is a -[`Buffer`][] then `input_encoding` is ignored. - -The `output_encoding` specifies the output format of the enciphered -data, and can be `'binary'`, `'base64'` or `'hex'`. If the `output_encoding` -is specified, a string using the specified encoding is returned. If no -`output_encoding` is provided, a [`Buffer`][] is returned. - -The `cipher.update()` method can be called multiple times with new data until -[`cipher.final()`][] is called. Calling `cipher.update()` after -[`cipher.final()`][] will result in an error being thrown. - -## Class: Decipher - -Instances of the `Decipher` class are used to decrypt data. The class can be -used in one of two ways: - -- As a [stream][] that is both readable and writable, where plain encrypted - data is written to produce unencrypted data on the readable side, or -- Using the [`decipher.update()`][] and [`decipher.final()`][] methods to - produce the unencrypted data. - -The [`crypto.createDecipher()`][] or [`crypto.createDecipheriv()`][] methods are -used to create `Decipher` instances. `Decipher` objects are not to be created -directly using the `new` keyword. - -Example: Using `Decipher` objects as streams: - -```js -const crypto = require('crypto'); -const decipher = crypto.createDecipher('aes192', 'a password'); - -var decrypted = ''; -decipher.on('readable', () => { - var data = decipher.read(); - if (data) - decrypted += data.toString('utf8'); -}); -decipher.on('end', () => { - console.log(decrypted); - // Prints: some clear text data -}); - -var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; -decipher.write(encrypted, 'hex'); -decipher.end(); -``` - -Example: Using `Decipher` and piped streams: - -```js -const crypto = require('crypto'); -const fs = require('fs'); -const decipher = crypto.createDecipher('aes192', 'a password'); - -const input = fs.createReadStream('test.enc'); -const output = fs.createWriteStream('test.js'); - -input.pipe(decipher).pipe(output); -``` - -Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods: - -```js -const crypto = require('crypto'); -const decipher = crypto.createDecipher('aes192', 'a password'); - -var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; -var decrypted = decipher.update(encrypted, 'hex', 'utf8'); -decrypted += decipher.final('utf8'); -console.log(decrypted); - // Prints: some clear text data -``` - -### decipher.final([output_encoding]) - -Returns any remaining deciphered contents. If `output_encoding` -parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. -If an `output_encoding` is not provided, a [`Buffer`][] is returned. - -Once the `decipher.final()` method has been called, the `Decipher` object can -no longer be used to decrypt data. Attempts to call `decipher.final()` more -than once will result in an error being thrown. - -### decipher.setAAD(buffer) - -When using an authenticated encryption mode (only `GCM` is currently -supported), the `cipher.setAAD()` method sets the value used for the -_additional authenticated data_ (AAD) input parameter. - -### decipher.setAuthTag(buffer) - -When using an authenticated encryption mode (only `GCM` is currently -supported), the `decipher.setAuthTag()` method is used to pass in the -received _authentication tag_. If no tag is provided, or if the cipher text -has been tampered with, [`decipher.final()`][] with throw, indicating that the -cipher text should be discarded due to failed authentication. - -### decipher.setAutoPadding(auto_padding=true) - -When data has been encrypted without standard block padding, calling -`decipher.setAuthPadding(false)` will disable automatic padding to prevent -[`decipher.final()`][] from checking for and removing padding. - -Turning auto padding off will only work if the input data's length is a -multiple of the ciphers block size. - -The `decipher.setAutoPadding()` method must be called before -[`decipher.update()`][]. - -### decipher.update(data[, input_encoding][, output_encoding]) - -Updates the decipher with `data`. If the `input_encoding` argument is given, -it's value must be one of `'binary'`, `'base64'`, or `'hex'` and the `data` -argument is a string using the specified encoding. If the `input_encoding` -argument is not given, `data` must be a [`Buffer`][]. If `data` is a -[`Buffer`][] then `input_encoding` is ignored. - -The `output_encoding` specifies the output format of the enciphered -data, and can be `'binary'`, `'ascii'` or `'utf8'`. If the `output_encoding` -is specified, a string using the specified encoding is returned. If no -`output_encoding` is provided, a [`Buffer`][] is returned. - -The `decipher.update()` method can be called multiple times with new data until -[`decipher.final()`][] is called. Calling `decipher.update()` after -[`decipher.final()`][] will result in an error being thrown. - -## Class: DiffieHellman - -The `DiffieHellman` class is a utility for creating Diffie-Hellman key -exchanges. - -Instances of the `DiffieHellman` class can be created using the -[`crypto.createDiffieHellman()`][] function. - -```js -const crypto = require('crypto'); -const assert = require('assert'); - -// Generate Alice's keys... -const alice = crypto.createDiffieHellman(2048); -const alice_key = alice.generateKeys(); - -// Generate Bob's keys... -const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); -const bob_key = bob.generateKeys(); - -// Exchange and generate the secret... -const alice_secret = alice.computeSecret(bob_key); -const bob_secret = bob.computeSecret(alice_key); - -// OK -assert.equal(alice_secret.toString('hex'), bob_secret.toString('hex')); -``` - -### diffieHellman.computeSecret(other_public_key[, input_encoding][, output_encoding]) - -Computes the shared secret using `other_public_key` as the other -party's public key and returns the computed shared secret. The supplied -key is interpreted using the specified `input_encoding`, and secret is -encoded using specified `output_encoding`. Encodings can be -`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not -provided, `other_public_key` is expected to be a [`Buffer`][]. - -If `output_encoding` is given a string is returned; otherwise, a -[`Buffer`][] is returned. - -### diffieHellman.generateKeys([encoding]) - -Generates private and public Diffie-Hellman key values, and returns -the public key in the specified `encoding`. This key should be -transferred to the other party. Encoding can be `'binary'`, `'hex'`, -or `'base64'`. If `encoding` is provided a string is returned; otherwise a -[`Buffer`][] is returned. - -### diffieHellman.getGenerator([encoding]) - -Returns the Diffie-Hellman generator in the specified `encoding`, which can -be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is -returned; otherwise a [`Buffer`][] is returned. - -### diffieHellman.getPrime([encoding]) - -Returns the Diffie-Hellman prime in the specified `encoding`, which can -be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is -returned; otherwise a [`Buffer`][] is returned. - -### diffieHellman.getPrivateKey([encoding]) - -Returns the Diffie-Hellman private key in the specified `encoding`, -which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a -string is returned; otherwise a [`Buffer`][] is returned. - -### diffieHellman.getPublicKey([encoding]) - -Returns the Diffie-Hellman public key in the specified `encoding`, which -can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a -string is returned; otherwise a [`Buffer`][] is returned. - -### diffieHellman.setPrivateKey(private_key[, encoding]) - -Sets the Diffie-Hellman private key. If the `encoding` argument is provided -and is either `'binary'`, `'hex'`, or `'base64'`, `private_key` is expected -to be a string. If no `encoding` is provided, `private_key` is expected -to be a [`Buffer`][]. - -### diffieHellman.setPublicKey(public_key[, encoding]) - -Sets the Diffie-Hellman public key. If the `encoding` argument is provided -and is either `'binary'`, `'hex'` or `'base64'`, `public_key` is expected -to be a string. If no `encoding` is provided, `public_key` is expected -to be a [`Buffer`][]. - -### diffieHellman.verifyError - -A bit field containing any warnings and/or errors resulting from a check -performed during initialization of the `DiffieHellman` object. - -The following values are valid for this property (as defined in `constants` -module): - -* `DH_CHECK_P_NOT_SAFE_PRIME` -* `DH_CHECK_P_NOT_PRIME` -* `DH_UNABLE_TO_CHECK_GENERATOR` -* `DH_NOT_SUITABLE_GENERATOR` - -## Class: ECDH - -The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) -key exchanges. - -Instances of the `ECDH` class can be created using the -[`crypto.createECDH()`][] function. - -```js -const crypto = require('crypto'); -const assert = require('assert'); - -// Generate Alice's keys... -const alice = crypto.createECDH('secp521r1'); -const alice_key = alice.generateKeys(); - -// Generate Bob's keys... -const bob = crypto.createECDH('secp521r1'); -const bob_key = bob.generateKeys(); - -// Exchange and generate the secret... -const alice_secret = alice.computeSecret(bob_key); -const bob_secret = bob.computeSecret(alice_key); - -assert(alice_secret, bob_secret); - // OK -``` - -### ecdh.computeSecret(other_public_key[, input_encoding][, output_encoding]) - -Computes the shared secret using `other_public_key` as the other -party's public key and returns the computed shared secret. The supplied -key is interpreted using specified `input_encoding`, and the returned secret -is encoded using the specified `output_encoding`. Encodings can be -`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not -provided, `other_public_key` is expected to be a [`Buffer`][]. - -If `output_encoding` is given a string will be returned; otherwise a -[`Buffer`][] is returned. - -### ecdh.generateKeys([encoding[, format]]) - -Generates private and public EC Diffie-Hellman key values, and returns -the public key in the specified `format` and `encoding`. This key should be -transferred to the other party. - -The `format` arguments specifies point encoding and can be `'compressed'`, -`'uncompressed'`, or `'hybrid'`. If `format` is not specified, the point will -be returned in `'uncompressed'` format. - -The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If -`encoding` is provided a string is returned; otherwise a [`Buffer`][] -is returned. - -### ecdh.getPrivateKey([encoding]) - -Returns the EC Diffie-Hellman private key in the specified `encoding`, -which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided -a string is returned; otherwise a [`Buffer`][] is returned. - -### ecdh.getPublicKey([encoding[, format]]) - -Returns the EC Diffie-Hellman public key in the specified `encoding` and -`format`. - -The `format` argument specifies point encoding and can be `'compressed'`, -`'uncompressed'`, or `'hybrid'`. If `format` is not specified the point will be -returned in `'uncompressed'` format. - -The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If -`encoding` is specified, a string is returned; otherwise a [`Buffer`][] is -returned. - -### ecdh.setPrivateKey(private_key[, encoding]) - -Sets the EC Diffie-Hellman private key. The `encoding` can be `'binary'`, -`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected -to be a string; otherwise `private_key` is expected to be a [`Buffer`][]. If -`private_key` is not valid for the curve specified when the `ECDH` object was -created, an error is thrown. Upon setting the private key, the associated -public point (key) is also generated and set in the ECDH object. - -### ecdh.setPublicKey(public_key[, encoding]) - - Stability: 0 - Deprecated - -Sets the EC Diffie-Hellman public key. Key encoding can be `'binary'`, -`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to -be a string; otherwise a [`Buffer`][] is expected. - -Note that there is not normally a reason to call this method because `ECDH` -only requires a private key and the other party's public key to compute the -shared secret. Typically either [`ecdh.generateKeys()`][] or -[`ecdh.setPrivateKey()`][] will be called. The [`ecdh.setPrivateKey()`][] method -attempts to generate the public point/key associated with the private key being -set. - -Example (obtaining a shared secret): - -```js -const crypto = require('crypto'); -const alice = crypto.createECDH('secp256k1'); -const bob = crypto.createECDH('secp256k1'); - -// Note: This is a shortcut way to specify one of Alice's previous private -// keys. It would be unwise to use such a predictable private key in a real -// application. -alice.setPrivateKey( - crypto.createHash('sha256').update('alice', 'utf8').digest() -); - -// Bob uses a newly generated cryptographically strong -// pseudorandom key pair bob.generateKeys(); - -const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); -const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); - -// alice_secret and bob_secret should be the same shared secret value -console.log(alice_secret === bob_secret); -``` - -## Class: Hash - -The `Hash` class is a utility for creating hash digests of data. It can be -used in one of two ways: - -- As a [stream][] that is both readable and writable, where data is written - to produce a computed hash digest on the readable side, or -- Using the [`hash.update()`][] and [`hash.digest()`][] methods to produce the - computed hash. - -The [`crypto.createHash()`][] method is used to create `Hash` instances. `Hash` -objects are not to be created directly using the `new` keyword. - -Example: Using `Hash` objects as streams: - -```js -const crypto = require('crypto'); -const hash = crypto.createHash('sha256'); - -hash.on('readable', () => { - var data = hash.read(); - if (data) - console.log(data.toString('hex')); - // Prints: - // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 -}); - -hash.write('some data to hash'); -hash.end(); -``` - -Example: Using `Hash` and piped streams: - -```js -const crypto = require('crypto'); -const fs = require('fs'); -const hash = crypto.createHash('sha256'); - -const input = fs.createReadStream('test.js'); -input.pipe(hash).pipe(process.stdout); -``` - -Example: Using the [`hash.update()`][] and [`hash.digest()`][] methods: - -```js -const crypto = require('crypto'); -const hash = crypto.createHash('sha256'); - -hash.update('some data to hash'); -console.log(hash.digest('hex')); - // Prints: - // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 -``` - -### hash.digest([encoding]) - -Calculates the digest of all of the data passed to be hashed (using the -[`hash.update()`][] method). The `encoding` can be `'hex'`, `'binary'` or -`'base64'`. If `encoding` is provided a string will be returned; otherwise -a [`Buffer`][] is returned. - -The `Hash` object can not be used again after `hash.digest()` method has been -called. Multiple calls will cause an error to be thrown. - -### hash.update(data[, input_encoding]) - -Updates the hash content with the given `data`, the encoding of which -is given in `input_encoding` and can be `'utf8'`, `'ascii'` or -`'binary'`. If `encoding` is not provided, and the `data` is a string, an -encoding of `'binary'` is enforced. If `data` is a [`Buffer`][] then -`input_encoding` is ignored. - -This can be called many times with new data as it is streamed. - -## Class: Hmac - -The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can -be used in one of two ways: - -- As a [stream][] that is both readable and writable, where data is written - to produce a computed HMAC digest on the readable side, or -- Using the [`hmac.update()`][] and [`hmac.digest()`][] methods to produce the - computed HMAC digest. - -The [`crypto.createHmac()`][] method is used to create `Hmac` instances. `Hmac` -objects are not to be created directly using the `new` keyword. - -Example: Using `Hmac` objects as streams: - -```js -const crypto = require('crypto'); -const hmac = crypto.createHmac('sha256', 'a secret'); - -hmac.on('readable', () => { - var data = hmac.read(); - if (data) - console.log(data.toString('hex')); - // Prints: - // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e -}); - -hmac.write('some data to hash'); -hmac.end(); -``` - -Example: Using `Hmac` and piped streams: - -```js -const crypto = require('crypto'); -const fs = require('fs'); -const hmac = crypto.createHmac('sha256', 'a secret'); - -const input = fs.createReadStream('test.js'); -input.pipe(hmac).pipe(process.stdout); -``` - -Example: Using the [`hmac.update()`][] and [`hmac.digest()`][] methods: - -```js -const crypto = require('crypto'); -const hmac = crypto.createHmac('sha256', 'a secret'); - -hmac.update('some data to hash'); -console.log(hmac.digest('hex')); - // Prints: - // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e -``` - -### hmac.digest([encoding]) - -Calculates the HMAC digest of all of the data passed using [`hmac.update()`][]. -The `encoding` can be `'hex'`, `'binary'` or `'base64'`. If `encoding` is -provided a string is returned; otherwise a [`Buffer`][] is returned; - -The `Hmac` object can not be used again after `hmac.digest()` has been -called. Multiple calls to `hmac.digest()` will result in an error being thrown. - -### hmac.update(data[, input_encoding]) - -Updates the `Hmac` content with the given `data`, the encoding of which -is given in `input_encoding` and can be `'utf8'`, `'ascii'` or -`'binary'`. If `encoding` is not provided, and the `data` is a string, an -encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then -`input_encoding` is ignored. - -This can be called many times with new data as it is streamed. - -## Class: Sign - -The `Sign` Class is a utility for generating signatures. It can be used in one -of two ways: - -- As a writable [stream][], where data to be signed is written and the - [`sign.sign()`][] method is used to generate and return the signature, or -- Using the [`sign.update()`][] and [`sign.sign()`][] methods to produce the - signature. - -The [`crypto.createSign()`][] method is used to create `Sign` instances. `Sign` -objects are not to be created directly using the `new` keyword. - -Example: Using `Sign` objects as streams: - -```js -const crypto = require('crypto'); -const sign = crypto.createSign('RSA-SHA256'); - -sign.write('some data to sign'); -sign.end(); - -const private_key = getPrivateKeySomehow(); -console.log(sign.sign(private_key, 'hex')); - // Prints the calculated signature -``` - -Example: Using the [`sign.update()`][] and [`sign.sign()`][] methods: - -```js -const crypto = require('crypto'); -const sign = crypto.createSign('RSA-SHA256'); - -sign.update('some data to sign'); - -const private_key = getPrivateKeySomehow(); -console.log(sign.sign(private_key, 'hex')); - // Prints the calculated signature -``` - -### sign.sign(private_key[, output_format]) - -Calculates the signature on all the data passed through using either -[`sign.update()`][] or [`sign.write()`][stream-writable-write]. - -The `private_key` argument can be an object or a string. If `private_key` is a -string, it is treated as a raw key with no passphrase. If `private_key` is an -object, it is interpreted as a hash containing two properties: - -* `key` : {String} - PEM encoded private key -* `passphrase` : {String} - passphrase for the private key - -The `output_format` can specify one of `'binary'`, `'hex'` or `'base64'`. If -`output_format` is provided a string is returned; otherwise a [`Buffer`][] is -returned. - -The `Sign` object can not be again used after `sign.sign()` method has been -called. Multiple calls to `sign.sign()` will result in an error being thrown. - -### sign.update(data[, input_encoding]) - -Updates the `Sign` content with the given `data`, the encoding of which -is given in `input_encoding` and can be `'utf8'`, `'ascii'` or -`'binary'`. If `encoding` is not provided, and the `data` is a string, an -encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then -`input_encoding` is ignored. - -This can be called many times with new data as it is streamed. - -## Class: Verify - -The `Verify` class is a utility for verifying signatures. It can be used in one -of two ways: - -- As a writable [stream][] where written data is used to validate against the - supplied signature, or -- Using the [`verify.update()`][] and [`verify.verify()`][] methods to verify - the signature. - - The [`crypto.createSign()`][] method is used to create `Sign` instances. - `Sign` objects are not to be created directly using the `new` keyword. - -Example: Using `Verify` objects as streams: - -```js -const crypto = require('crypto'); -const verify = crypto.createVerify('RSA-SHA256'); - -verify.write('some data to sign'); -verify.end(); - -const public_key = getPublicKeySomehow(); -const signature = getSignatureToVerify(); -console.log(sign.verify(public_key, signature)); - // Prints true or false -``` - -Example: Using the [`verify.update()`][] and [`verify.verify()`][] methods: - -```js -const crypto = require('crypto'); -const verify = crypto.createVerify('RSA-SHA256'); - -verify.update('some data to sign'); - -const public_key = getPublicKeySomehow(); -const signature = getSignatureToVerify(); -console.log(verify.verify(public_key, signature)); - // Prints true or false -``` - -### verifier.update(data[, input_encoding]) - -Updates the `Verify` content with the given `data`, the encoding of which -is given in `input_encoding` and can be `'utf8'`, `'ascii'` or -`'binary'`. If `encoding` is not provided, and the `data` is a string, an -encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then -`input_encoding` is ignored. - -This can be called many times with new data as it is streamed. - -### verifier.verify(object, signature[, signature_format]) - -Verifies the provided data using the given `object` and `signature`. -The `object` argument is a string containing a PEM encoded object, which can be -one an RSA public key, a DSA public key, or an X.509 certificate. -The `signature` argument is the previously calculated signature for the data, in -the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`. -If a `signature_format` is specified, the `signature` is expected to be a -string; otherwise `signature` is expected to be a [`Buffer`][]. - -Returns `true` or `false` depending on the validity of the signature for -the data and public key. - -The `verifier` object can not be used again after `verify.verify()` has been -called. Multiple calls to `verify.verify()` will result in an error being -thrown. - -## `crypto` module methods and properties - -### crypto.DEFAULT_ENCODING - -The default encoding to use for functions that can take either strings -or [buffers][`Buffer`]. The default value is `'buffer'`, which makes methods -default to [`Buffer`][] objects. - -The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility -with legacy programs that expect `'binary'` to be the default encoding. - -New applications should expect the default to be `'buffer'`. This property may -become deprecated in a future Node.js release. - -### crypto.createCipher(algorithm, password) - -Creates and returns a `Cipher` object that uses the given `algorithm` and -`password`. - -The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On -recent OpenSSL releases, `openssl list-cipher-algorithms` will display the -available cipher algorithms. - -The `password` is used to derive the cipher key and initialization vector (IV). -The value must be either a `'binary'` encoded string or a [`Buffer`][]. - -The implementation of `crypto.createCipher()` derives keys using the OpenSSL -function [`EVP_BytesToKey`][] with the digest algorithm set to MD5, one -iteration, and no salt. The lack of salt allows dictionary attacks as the same -password always creates the same key. The low iteration count and -non-cryptographically secure hash algorithm allow passwords to be tested very -rapidly. - -In line with OpenSSL's recommendation to use pbkdf2 instead of -[`EVP_BytesToKey`][] it is recommended that developers derive a key and IV on -their own using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] -to create the `Cipher` object. - -### crypto.createCipheriv(algorithm, key, iv) - -Creates and returns a `Cipher` object, with the given `algorithm`, `key` and -initialization vector (`iv`). - -The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On -recent OpenSSL releases, `openssl list-cipher-algorithms` will display the -available cipher algorithms. - -The `key` is the raw key used by the `algorithm` and `iv` is an -[initialization vector][]. Both arguments must be `'binary'` encoded strings or -[buffers][`Buffer`]. - -### crypto.createCredentials(details) - - Stability: 0 - Deprecated: Use [`tls.createSecureContext()`][] instead. - -The `crypto.createCredentials()` method is a deprecated alias for creating -and returning a `tls.SecureContext` object. The `crypto.createCredentials()` -method should not be used. - -The optional `details` argument is a hash object with keys: - -* `pfx` : {String|Buffer} - PFX or PKCS12 encoded private - key, certificate and CA certificates -* `key` : {String} - PEM encoded private key -* `passphrase` : {String} - passphrase for the private key or PFX -* `cert` : {String} - PEM encoded certificate -* `ca` : {String|Array} - Either a string or array of strings of PEM encoded CA - certificates to trust. -* `crl` : {String|Array} - Either a string or array of strings of PEM encoded CRLs - (Certificate Revocation List) -* `ciphers`: {String} using the [OpenSSL cipher list format][] describing the - cipher algorithms to use or exclude. - -If no 'ca' details are given, Node.js will use Mozilla's default -[publicly trusted list of CAs][]. - -### crypto.createDecipher(algorithm, password) - -Creates and returns a `Decipher` object that uses the given `algorithm` and -`password` (key). - -The implementation of `crypto.createDecipher()` derives keys using the OpenSSL -function [`EVP_BytesToKey`][] with the digest algorithm set to MD5, one -iteration, and no salt. The lack of salt allows dictionary attacks as the same -password always creates the same key. The low iteration count and -non-cryptographically secure hash algorithm allow passwords to be tested very -rapidly. - -In line with OpenSSL's recommendation to use pbkdf2 instead of -[`EVP_BytesToKey`][] it is recommended that developers derive a key and IV on -their own using [`crypto.pbkdf2()`][] and to use [`crypto.createDecipheriv()`][] -to create the `Decipher` object. - -### crypto.createDecipheriv(algorithm, key, iv) - -Creates and returns a `Decipher` object that uses the given `algorithm`, `key` -and initialization vector (`iv`). - -The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On -recent OpenSSL releases, `openssl list-cipher-algorithms` will display the -available cipher algorithms. - -The `key` is the raw key used by the `algorithm` and `iv` is an -[initialization vector][]. Both arguments must be `'binary'` encoded strings or -[buffers][`Buffer`]. - -### crypto.createDiffieHellman(prime[, prime_encoding][, generator][, generator_encoding]) - -Creates a `DiffieHellman` key exchange object using the supplied `prime` and an -optional specific `generator`. - -The `generator` argument can be a number, string, or [`Buffer`][]. If -`generator` is not specified, the value `2` is used. - -The `prime_encoding` and `generator_encoding` arguments can be `'binary'`, -`'hex'`, or `'base64'`. - -If `prime_encoding` is specified, `prime` is expected to be a string; otherwise -a [`Buffer`][] is expected. - -If `generator_encoding` is specified, `generator` is expected to be a string; -otherwise either a number or [`Buffer`][] is expected. - -### crypto.createDiffieHellman(prime_length[, generator]) - -Creates a `DiffieHellman` key exchange object and generates a prime of -`prime_length` bits using an optional specific numeric `generator`. -If `generator` is not specified, the value `2` is used. - -### crypto.createECDH(curve_name) - -Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a -predefined curve specified by the `curve_name` string. Use -[`crypto.getCurves()`][] to obtain a list of available curve names. On recent -OpenSSL releases, `openssl ecparam -list_curves` will also display the name -and description of each available elliptic curve. - -### crypto.createHash(algorithm) - -Creates and returns a `Hash` object that can be used to generate hash digests -using the given `algorithm`. - -The `algorithm` is dependent on the available algorithms supported by the -version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. -On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will -display the available digest algorithms. - -Example: generating the sha256 sum of a file - -```js -const filename = process.argv[2]; -const crypto = require('crypto'); -const fs = require('fs'); - -const hash = crypto.createHash('sha256'); - -const input = fs.createReadStream(filename); -input.on('readable', () => { - var data = input.read(); - if (data) - hash.update(data); - else { - console.log(`${hash.digest('hex')} ${filename}`); - } -}); -``` - -### crypto.createHmac(algorithm, key) - -Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. - -The `algorithm` is dependent on the available algorithms supported by the -version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. -On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will -display the available digest algorithms. - -The `key` is the HMAC key used to generate the cryptographic HMAC hash. - -Example: generating the sha256 HMAC of a file - -```js -const filename = process.argv[2]; -const crypto = require('crypto'); -const fs = require('fs'); - -const hmac = crypto.createHmac('sha256', 'a secret'); - -const input = fs.createReadStream(filename); -input.on('readable', () => { - var data = input.read(); - if (data) - hmac.update(data); - else { - console.log(`${hmac.digest('hex')} ${filename}`); - } -}); -``` - -### crypto.createSign(algorithm) - -Creates and returns a `Sign` object that uses the given `algorithm`. On -recent OpenSSL releases, `openssl list-public-key-algorithms` will -display the available signing algorithms. One example is `'RSA-SHA256'`. - -### crypto.createVerify(algorithm) - -Creates and returns a `Verify` object that uses the given algorithm. On -recent OpenSSL releases, `openssl list-public-key-algorithms` will -display the available signing algorithms. One example is `'RSA-SHA256'`. - -### crypto.getCiphers() - -Returns an array with the names of the supported cipher algorithms. - -Example: - -```js -const ciphers = crypto.getCiphers(); -console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] -``` - -### crypto.getCurves() - -Returns an array with the names of the supported elliptic curves. - -Example: - -```js -const curves = crypto.getCurves(); -console.log(curves); // ['secp256k1', 'secp384r1', ...] -``` - -### crypto.getDiffieHellman(group_name) - -Creates a predefined `DiffieHellman` key exchange object. The -supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in -[RFC 2412][], but see [Caveats][]) and `'modp14'`, `'modp15'`, -`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526][]). The -returned object mimics the interface of objects created by -[`crypto.createDiffieHellman()`][], but will not allow changing -the keys (with [`diffieHellman.setPublicKey()`][] for example). The -advantage of using this method is that the parties do not have to -generate nor exchange a group modulus beforehand, saving both processor -and communication time. - -Example (obtaining a shared secret): - -```js -const crypto = require('crypto'); -const alice = crypto.getDiffieHellman('modp14'); -const bob = crypto.getDiffieHellman('modp14'); - -alice.generateKeys(); -bob.generateKeys(); - -const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); -const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); - -/* alice_secret and bob_secret should be the same */ -console.log(alice_secret == bob_secret); -``` - -### crypto.getHashes() - -Returns an array with the names of the supported hash algorithms. - -Example: - -```js -const hashes = crypto.getHashes(); -console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...] -``` - -### crypto.pbkdf2(password, salt, iterations, keylen[, digest], callback) - -Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) -implementation. A selected HMAC digest algorithm specified by `digest` is -applied to derive a key of the requested byte length (`keylen`) from the -`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, -a default of `'sha1'` is used. - -The supplied `callback` function is called with two arguments: `err` and -`derivedKey`. If an error occurs, `err` will be set; otherwise `err` will be -null. The successfully generated `derivedKey` will be passed as a [`Buffer`][]. - -The `iterations` argument must be a number set as high as possible. The -higher the number of iterations, the more secure the derived key will be, -but will take a longer amount of time to complete. - -The `salt` should also be as unique as possible. It is recommended that the -salts are random and their lengths are greater than 16 bytes. See -[NIST SP 800-132][] for details. - -Example: - -```js -const crypto = require('crypto'); -crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, key) => { - if (err) throw err; - console.log(key.toString('hex')); // 'c5e478d...1469e50' -}); -``` - -An array of supported digest functions can be retrieved using -[`crypto.getHashes()`][]. - -### crypto.pbkdf2Sync(password, salt, iterations, keylen[, digest]) - -Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) -implementation. A selected HMAC digest algorithm specified by `digest` is -applied to derive a key of the requested byte length (`keylen`) from the -`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, -a default of `'sha1'` is used. - -If an error occurs an Error will be thrown, otherwise the derived key will be -returned as a [`Buffer`][]. - -The `iterations` argument must be a number set as high as possible. The -higher the number of iterations, the more secure the derived key will be, -but will take a longer amount of time to complete. - -The `salt` should also be as unique as possible. It is recommended that the -salts are random and their lengths are greater than 16 bytes. See -[NIST SP 800-132][] for details. - -Example: - -```js -const crypto = require('crypto'); -const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); -console.log(key.toString('hex')); // 'c5e478d...1469e50' -``` - -An array of supported digest functions can be retrieved using -[`crypto.getHashes()`][]. - -### crypto.privateDecrypt(private_key, buffer) - -Decrypts `buffer` with `private_key`. - -`private_key` can be an object or a string. If `private_key` is a string, it is -treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. -If `private_key` is an object, it is interpreted as a hash object with the -keys: - -* `key` : {String} - PEM encoded private key -* `passphrase` : {String} - Optional passphrase for the private key -* `padding` : An optional padding value, one of the following: - * `constants.RSA_NO_PADDING` - * `constants.RSA_PKCS1_PADDING` - * `constants.RSA_PKCS1_OAEP_PADDING` - -All paddings are defined in the `constants` module. - -### crypto.privateEncrypt(private_key, buffer) - -Encrypts `buffer` with `private_key`. - -`private_key` can be an object or a string. If `private_key` is a string, it is -treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. -If `private_key` is an object, it is interpreted as a hash object with the -keys: - -* `key` : {String} - PEM encoded private key -* `passphrase` : {String} - Optional passphrase for the private key -* `padding` : An optional padding value, one of the following: - * `constants.RSA_NO_PADDING` - * `constants.RSA_PKCS1_PADDING` - * `constants.RSA_PKCS1_OAEP_PADDING` - -All paddings are defined in the `constants` module. - -### crypto.publicDecrypt(public_key, buffer) - -Decrypts `buffer` with `public_key`. - -`public_key` can be an object or a string. If `public_key` is a string, it is -treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. -If `public_key` is an object, it is interpreted as a hash object with the -keys: - -* `key` : {String} - PEM encoded public key -* `passphrase` : {String} - Optional passphrase for the private key -* `padding` : An optional padding value, one of the following: - * `constants.RSA_NO_PADDING` - * `constants.RSA_PKCS1_PADDING` - * `constants.RSA_PKCS1_OAEP_PADDING` - -Because RSA public keys can be derived from private keys, a private key may -be passed instead of a public key. - -All paddings are defined in the `constants` module. - -### crypto.publicEncrypt(public_key, buffer) - -Encrypts `buffer` with `public_key`. - -`public_key` can be an object or a string. If `public_key` is a string, it is -treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. -If `public_key` is an object, it is interpreted as a hash object with the -keys: - -* `key` : {String} - PEM encoded public key -* `passphrase` : {String} - Optional passphrase for the private key -* `padding` : An optional padding value, one of the following: - * `constants.RSA_NO_PADDING` - * `constants.RSA_PKCS1_PADDING` - * `constants.RSA_PKCS1_OAEP_PADDING` - -Because RSA public keys can be derived from private keys, a private key may -be passed instead of a public key. - -All paddings are defined in the `constants` module. - -### crypto.randomBytes(size[, callback]) - -Generates cryptographically strong pseudo-random data. The `size` argument -is a number indicating the number of bytes to generate. - -If a `callback` function is provided, the bytes are generated asynchronously -and the `callback` function is invoked with two arguments: `err` and `buf`. -If an error occurs, `err` will be an Error object; otherwise it is null. The -`buf` argument is a [`Buffer`][] containing the generated bytes. - -```js -// Asynchronous -const crypto = require('crypto'); -crypto.randomBytes(256, (err, buf) => { - if (err) throw err; - console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); -}); -``` - -If the `callback` function is not provided, the random bytes are generated -synchronously and returned as a [`Buffer`][]. An error will be thrown if -there is a problem generating the bytes. - -```js -// Synchronous -const buf = crypto.randomBytes(256); -console.log( - `${buf.length} bytes of random data: ${buf.toString('hex')}`); -``` - -The `crypto.randomBytes()` method will block until there is sufficient entropy. -This should normally never take longer than a few milliseconds. The only time -when generating the random bytes may conceivably block for a longer period of -time is right after boot, when the whole system is still low on entropy. - -### crypto.setEngine(engine[, flags]) - -Load and set the `engine` for some or all OpenSSL functions (selected by flags). - -`engine` could be either an id or a path to the engine's shared library. - -The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` -is a bit field taking one of or a mix of the following flags (defined in the -`constants` module): - -* `ENGINE_METHOD_RSA` -* `ENGINE_METHOD_DSA` -* `ENGINE_METHOD_DH` -* `ENGINE_METHOD_RAND` -* `ENGINE_METHOD_ECDH` -* `ENGINE_METHOD_ECDSA` -* `ENGINE_METHOD_CIPHERS` -* `ENGINE_METHOD_DIGESTS` -* `ENGINE_METHOD_STORE` -* `ENGINE_METHOD_PKEY_METHS` -* `ENGINE_METHOD_PKEY_ASN1_METHS` -* `ENGINE_METHOD_ALL` -* `ENGINE_METHOD_NONE` - -## Notes - -### Legacy Streams API (pre Node.js v0.10) - -The Crypto module was added to Node.js before there was the concept of a -unified Stream API, and before there were [`Buffer`][] objects for handling -binary data. As such, the many of the `crypto` defined classes have methods not -typically found on other Node.js classes that implement the [streams][stream] -API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted -and returned `'binary'` encoded strings by default rather than Buffers. This -default was changed after Node.js v0.8 to use [`Buffer`][] objects by default -instead. - -### Recent ECDH Changes - -Usage of `ECDH` with non-dynamically generated key pairs has been simplified. -Now, [`ecdh.setPrivateKey()`][] can be called with a preselected private key -and the associated public point (key) will be computed and stored in the object. -This allows code to only store and provide the private part of the EC key pair. -[`ecdh.setPrivateKey()`][] now also validates that the private key is valid for -the selected curve. - -The [`ecdh.setPublicKey()`][] method is now deprecated as its inclusion in the -API is not useful. Either a previously stored private key should be set, which -automatically generates the associated public key, or [`ecdh.generateKeys()`][] -should be called. The main drawback of using [`ecdh.setPublicKey()`][] is that -it can be used to put the ECDH key pair into an inconsistent state. - -### Support for weak or compromised algorithms - -The `crypto` module still supports some algorithms which are already -compromised and are not currently recommended for use. The API also allows -the use of ciphers and hashes with a small key size that are considered to be -too weak for safe use. - -Users should take full responsibility for selecting the crypto -algorithm and key size according to their security requirements. - -Based on the recommendations of [NIST SP 800-131A][]: - -- MD5 and SHA-1 are no longer acceptable where collision resistance is - required such as digital signatures. -- The key used with RSA, DSA and DH algorithms is recommended to have - at least 2048 bits and that of the curve of ECDSA and ECDH at least - 224 bits, to be safe to use for several years. -- The DH groups of `modp1`, `modp2` and `modp5` have a key size - smaller than 2048 bits and are not recommended. - -See the reference for other recommendations and details. - -[`Buffer`]: buffer.html -[`cipher.final()`]: #crypto_cipher_final_output_encoding -[`cipher.update()`]: #crypto_cipher_update_data_input_encoding_output_encoding -[`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password -[`crypto.createCipheriv()`]: #crypto_crypto_createcipheriv_algorithm_key_iv -[`crypto.createDecipher()`]: #crypto_crypto_createdecipher_algorithm_password -[`crypto.createDecipheriv()`]: #crypto_crypto_createdecipheriv_algorithm_key_iv -[`crypto.createDiffieHellman()`]: #crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding -[`crypto.createECDH()`]: #crypto_crypto_createecdh_curve_name -[`crypto.createHash()`]: #crypto_crypto_createhash_algorithm -[`crypto.createHmac()`]: #crypto_crypto_createhmac_algorithm_key -[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm -[`crypto.getCurves()`]: #crypto_crypto_getcurves -[`crypto.getHashes()`]: #crypto_crypto_gethashes -[`crypto.pbkdf2()`]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback -[`decipher.final()`]: #crypto_decipher_final_output_encoding -[`decipher.update()`]: #crypto_decipher_update_data_input_encoding_output_encoding -[`diffieHellman.setPublicKey()`]: #crypto_diffiehellman_setpublickey_public_key_encoding -[`ecdh.generateKeys()`]: #crypto_ecdh_generatekeys_encoding_format -[`ecdh.setPrivateKey()`]: #crypto_ecdh_setprivatekey_private_key_encoding -[`ecdh.setPublicKey()`]: #crypto_ecdh_setpublickey_public_key_encoding -[`EVP_BytesToKey`]: https://www.openssl.org/docs/crypto/EVP_BytesToKey.html -[`hash.digest()`]: #crypto_hash_digest_encoding -[`hash.update()`]: #crypto_hash_update_data_input_encoding -[`hmac.digest()`]: #crypto_hmac_digest_encoding -[`hmac.update()`]: #crypto_hmac_update_data -[`sign.sign()`]: #crypto_sign_sign_private_key_output_format -[`sign.update()`]: #crypto_sign_update_data -[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_details -[`verify.update()`]: #crypto_verifier_update_data -[`verify.verify()`]: #crypto_verifier_verify_object_signature_signature_format -[Caveats]: #crypto_support_for_weak_or_compromised_algorithms -[HTML5's `keygen` element]: http://www.w3.org/TR/html5/forms.html#the-keygen-element -[initialization vector]: https://en.wikipedia.org/wiki/Initialization_vector -[NIST SP 800-131A]: http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf -[NIST SP 800-132]: http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf -[OpenSSL cipher list format]: https://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT -[OpenSSL's SPKAC implementation]: https://www.openssl.org/docs/apps/spkac.html -[publicly trusted list of CAs]: https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt -[RFC 2412]: https://www.rfc-editor.org/rfc/rfc2412.txt -[RFC 3526]: https://www.rfc-editor.org/rfc/rfc3526.txt -[stream]: stream.html -[stream-writable-write]: stream.html#stream_writable_write_chunk_encoding_callback diff --git a/doc/api/crypto.md b/doc/api/crypto.md new file mode 100644 index 00000000000000..2a7510986f11ee --- /dev/null +++ b/doc/api/crypto.md @@ -0,0 +1,1407 @@ +# Crypto + + Stability: 2 - Stable + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. + +Use `require('crypto')` to access this module. + +```js +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); + // Prints: + // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Class: Certificate + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and now specified formally as part of [HTML5's `keygen` element][]. + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation][] internally. + +### new crypto.Certificate() + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```js +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +### certificate.exportChallenge(spkac) + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportChallenge()` returns the challenge component in the +form of a Node.js [`Buffer`][]. The `spkac` argument can be either a string +or a [`Buffer`][]. + +```js +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); + // Prints the challenge as a UTF8 string +``` + +### certificate.exportPublicKey(spkac) + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportPublicKey()` returns the public key component in the +form of a Node.js [`Buffer`][]. The `spkac` argument can be either a string +or a [`Buffer`][]. + +```js +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); + // Prints the public key as +``` + +### certificate.verifySpkac(spkac) + +Returns `true` if the given `spkac` data structure is valid, `false` otherwise. +The `spkac` argument must be a Node.js [`Buffer`][]. + +```js +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(new Buffer(spkac))); + // Prints true or false +``` + +## Class: Cipher + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +- As a [stream][] that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +- Using the [`cipher.update()`][] and [`cipher.final()`][] methods to produce + the encrypted data. + +The [`crypto.createCipher()`][] or [`crypto.createCipheriv()`][] methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```js +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +var encrypted = ''; +cipher.on('readable', () => { + var data = cipher.read(); + if (data) + encrypted += data.toString('hex'); +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```js +const crypto = require('crypto'); +const fs = require('fs'); +const cipher = crypto.createCipher('aes192', 'a password'); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`][] and [`cipher.final()`][] methods: + +```js +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +var encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +``` + +### cipher.final([output_encoding]) + +Returns any remaining enciphered contents. If `output_encoding` +parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`][] is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer) + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +_additional authenticated data_ (AAD) input parameter. + +### cipher.getAuthTag() + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.getAuthTag()` method returns a [`Buffer`][] containing +the _authentication tag_ that has been computed from the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`][] method. + +### cipher.setAutoPadding(auto_padding=true) + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `auto_padding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`][] will throw an Error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before [`cipher.final()`][]. + +### cipher.update(data[, input_encoding][, output_encoding]) + +Updates the cipher with `data`. If the `input_encoding` argument is given, +it's value must be one of `'utf8'`, `'ascii'`, or `'binary'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`][]. If `data` is a +[`Buffer`][] then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'base64'` or `'hex'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`][] is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`][] is called. Calling `cipher.update()` after +[`cipher.final()`][] will result in an error being thrown. + +## Class: Decipher + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +- As a [stream][] that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +- Using the [`decipher.update()`][] and [`decipher.final()`][] methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`][] or [`crypto.createDecipheriv()`][] methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```js +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +var decrypted = ''; +decipher.on('readable', () => { + var data = decipher.read(); + if (data) + decrypted += data.toString('utf8'); +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```js +const crypto = require('crypto'); +const fs = require('fs'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods: + +```js +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +var decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); + // Prints: some clear text data +``` + +### decipher.final([output_encoding]) + +Returns any remaining deciphered contents. If `output_encoding` +parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`][] is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer) + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +_additional authenticated data_ (AAD) input parameter. + +### decipher.setAuthTag(buffer) + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAuthTag()` method is used to pass in the +received _authentication tag_. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`][] with throw, indicating that the +cipher text should be discarded due to failed authentication. + +### decipher.setAutoPadding(auto_padding=true) + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`][] from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.update()`][]. + +### decipher.update(data[, input_encoding][, output_encoding]) + +Updates the decipher with `data`. If the `input_encoding` argument is given, +it's value must be one of `'binary'`, `'base64'`, or `'hex'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`][]. If `data` is a +[`Buffer`][] then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'ascii'` or `'utf8'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`][] is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`][] is called. Calling `decipher.update()` after +[`decipher.final()`][] will result in an error being thrown. + +## Class: DiffieHellman + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`][] function. + +```js +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const alice_key = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bob_key = bob.generateKeys(); + +// Exchange and generate the secret... +const alice_secret = alice.computeSecret(bob_key); +const bob_secret = bob.computeSecret(alice_key); + +// OK +assert.equal(alice_secret.toString('hex'), bob_secret.toString('hex')); +``` + +### diffieHellman.computeSecret(other_public_key[, input_encoding][, output_encoding]) + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`][]. + +If `output_encoding` is given a string is returned; otherwise, a +[`Buffer`][] is returned. + +### diffieHellman.generateKeys([encoding]) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. Encoding can be `'binary'`, `'hex'`, +or `'base64'`. If `encoding` is provided a string is returned; otherwise a +[`Buffer`][] is returned. + +### diffieHellman.getGenerator([encoding]) + +Returns the Diffie-Hellman generator in the specified `encoding`, which can +be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`][] is returned. + +### diffieHellman.getPrime([encoding]) + +Returns the Diffie-Hellman prime in the specified `encoding`, which can +be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`][] is returned. + +### diffieHellman.getPrivateKey([encoding]) + +Returns the Diffie-Hellman private key in the specified `encoding`, +which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`][] is returned. + +### diffieHellman.getPublicKey([encoding]) + +Returns the Diffie-Hellman public key in the specified `encoding`, which +can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`][] is returned. + +### diffieHellman.setPrivateKey(private_key[, encoding]) + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided +and is either `'binary'`, `'hex'`, or `'base64'`, `private_key` is expected +to be a string. If no `encoding` is provided, `private_key` is expected +to be a [`Buffer`][]. + +### diffieHellman.setPublicKey(public_key[, encoding]) + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided +and is either `'binary'`, `'hex'` or `'base64'`, `public_key` is expected +to be a string. If no `encoding` is provided, `public_key` is expected +to be a [`Buffer`][]. + +### diffieHellman.verifyError + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`][] function. + +```js +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const alice_key = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bob_key = bob.generateKeys(); + +// Exchange and generate the secret... +const alice_secret = alice.computeSecret(bob_key); +const bob_secret = bob.computeSecret(alice_key); + +assert(alice_secret, bob_secret); + // OK +``` + +### ecdh.computeSecret(other_public_key[, input_encoding][, output_encoding]) + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `input_encoding`, and the returned secret +is encoded using the specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`][]. + +If `output_encoding` is given a string will be returned; otherwise a +[`Buffer`][] is returned. + +### ecdh.generateKeys([encoding[, format]]) + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` arguments specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified, the point will +be returned in `'uncompressed'` format. + +The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If +`encoding` is provided a string is returned; otherwise a [`Buffer`][] +is returned. + +### ecdh.getPrivateKey([encoding]) + +Returns the EC Diffie-Hellman private key in the specified `encoding`, +which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided +a string is returned; otherwise a [`Buffer`][] is returned. + +### ecdh.getPublicKey([encoding[, format]]) + +Returns the EC Diffie-Hellman public key in the specified `encoding` and +`format`. + +The `format` argument specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified the point will be +returned in `'uncompressed'` format. + +The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If +`encoding` is specified, a string is returned; otherwise a [`Buffer`][] is +returned. + +### ecdh.setPrivateKey(private_key[, encoding]) + +Sets the EC Diffie-Hellman private key. The `encoding` can be `'binary'`, +`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected +to be a string; otherwise `private_key` is expected to be a [`Buffer`][]. If +`private_key` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the ECDH object. + +### ecdh.setPublicKey(public_key[, encoding]) + + Stability: 0 - Deprecated + +Sets the EC Diffie-Hellman public key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to +be a string; otherwise a [`Buffer`][] is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`][] or +[`ecdh.setPrivateKey()`][] will be called. The [`ecdh.setPrivateKey()`][] method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```js +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// Note: This is a shortcut way to specify one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair bob.generateKeys(); + +const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// alice_secret and bob_secret should be the same shared secret value +console.log(alice_secret === bob_secret); +``` + +## Class: Hash + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +- As a [stream][] that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +- Using the [`hash.update()`][] and [`hash.digest()`][] methods to produce the + computed hash. + +The [`crypto.createHash()`][] method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```js +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + var data = hash.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```js +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`][] and [`hash.digest()`][] methods: + +```js +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding]) + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`][] method). The `encoding` can be `'hex'`, `'binary'` or +`'base64'`. If `encoding` is provided a string will be returned; otherwise +a [`Buffer`][] is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, input_encoding]) + +Updates the hash content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'binary'` is enforced. If `data` is a [`Buffer`][] then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +- As a [stream][] that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +- Using the [`hmac.update()`][] and [`hmac.digest()`][] methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`][] method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```js +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + var data = hmac.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```js +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`][] and [`hmac.digest()`][] methods: + +```js +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding]) + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`][]. +The `encoding` can be `'hex'`, `'binary'` or `'base64'`. If `encoding` is +provided a string is returned; otherwise a [`Buffer`][] is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, input_encoding]) + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +- As a writable [stream][], where data to be signed is written and the + [`sign.sign()`][] method is used to generate and return the signature, or +- Using the [`sign.update()`][] and [`sign.sign()`][] methods to produce the + signature. + +The [`crypto.createSign()`][] method is used to create `Sign` instances. `Sign` +objects are not to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```js +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const private_key = getPrivateKeySomehow(); +console.log(sign.sign(private_key, 'hex')); + // Prints the calculated signature +``` + +Example: Using the [`sign.update()`][] and [`sign.sign()`][] methods: + +```js +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const private_key = getPrivateKeySomehow(); +console.log(sign.sign(private_key, 'hex')); + // Prints the calculated signature +``` + +A [`sign`][] instance can also be created by just passing in the digest +algorithm name, in which case OpenSSL will infer the full signature algorithm +from the type of the PEM-formatted private key, including algorithms that +do not have directly exposed name constants, e.g. 'ecdsa-with-SHA256'. + +Example: signing using ECDSA with SHA256 + +```js +const crypto = require('crypto'); +const sign = crypto.createSign('sha256'); + +sign.update('some data to sign'); + +const private_key = '-----BEGIN EC PRIVATE KEY-----\n' + + 'MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49\n' + + 'AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2\n' + + 'pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng==\n' + + '-----END EC PRIVATE KEY-----\n'; + +console.log(sign.sign(private_key).toString('hex')); +``` + +### sign.sign(private_key[, output_format]) + +Calculates the signature on all the data passed through using either +[`sign.update()`][] or [`sign.write()`][stream-writable-write]. + +The `private_key` argument can be an object or a string. If `private_key` is a +string, it is treated as a raw key with no passphrase. If `private_key` is an +object, it is interpreted as a hash containing two properties: + +* `key` : {String} - PEM encoded private key +* `passphrase` : {String} - passphrase for the private key + +The `output_format` can specify one of `'binary'`, `'hex'` or `'base64'`. If +`output_format` is provided a string is returned; otherwise a [`Buffer`][] is +returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, input_encoding]) + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +- As a writable [stream][] where written data is used to validate against the + supplied signature, or +- Using the [`verify.update()`][] and [`verify.verify()`][] methods to verify + the signature. + + The [`crypto.createSign()`][] method is used to create `Sign` instances. + `Sign` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```js +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const public_key = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(sign.verify(public_key, signature)); + // Prints true or false +``` + +Example: Using the [`verify.update()`][] and [`verify.verify()`][] methods: + +```js +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.update('some data to sign'); + +const public_key = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(public_key, signature)); + // Prints true or false +``` + +### verifier.update(data[, input_encoding]) + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verifier.verify(object, signature[, signature_format]) + +Verifies the provided data using the given `object` and `signature`. +The `object` argument is a string containing a PEM encoded object, which can be +one an RSA public key, a DSA public key, or an X.509 certificate. +The `signature` argument is the previously calculated signature for the data, in +the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`. +If a `signature_format` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`][]. + +Returns `true` or `false` depending on the validity of the signature for +the data and public key. + +The `verifier` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties + +### crypto.DEFAULT_ENCODING + +The default encoding to use for functions that can take either strings +or [buffers][`Buffer`]. The default value is `'buffer'`, which makes methods +default to [`Buffer`][] objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'binary'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. This property may +become deprecated in a future Node.js release. + +### crypto.createCipher(algorithm, password) + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'binary'` encoded string or a [`Buffer`][]. + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`][] with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`][] it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][] +to create the `Cipher` object. + +### crypto.createCipheriv(algorithm, key, iv) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector][]. Both arguments must be `'binary'` encoded strings or +[buffers][`Buffer`]. + +### crypto.createCredentials(details) + + Stability: 0 - Deprecated: Use [`tls.createSecureContext()`][] instead. + +The `crypto.createCredentials()` method is a deprecated alias for creating +and returning a `tls.SecureContext` object. The `crypto.createCredentials()` +method should not be used. + +The optional `details` argument is a hash object with keys: + +* `pfx` : {String|Buffer} - PFX or PKCS12 encoded private + key, certificate and CA certificates +* `key` : {String} - PEM encoded private key +* `passphrase` : {String} - passphrase for the private key or PFX +* `cert` : {String} - PEM encoded certificate +* `ca` : {String|Array} - Either a string or array of strings of PEM encoded CA + certificates to trust. +* `crl` : {String|Array} - Either a string or array of strings of PEM encoded CRLs + (Certificate Revocation List) +* `ciphers`: {String} using the [OpenSSL cipher list format][] describing the + cipher algorithms to use or exclude. + +If no 'ca' details are given, Node.js will use Mozilla's default +[publicly trusted list of CAs][]. + +### crypto.createDecipher(algorithm, password) + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`][] with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`][] it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`][] and to use [`crypto.createDecipheriv()`][] +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv) + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector][]. Both arguments must be `'binary'` encoded strings or +[buffers][`Buffer`]. + +### crypto.createDiffieHellman(prime[, prime_encoding][, generator][, generator_encoding]) + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`][]. If +`generator` is not specified, the value `2` is used. + +The `prime_encoding` and `generator_encoding` arguments can be `'binary'`, +`'hex'`, or `'base64'`. + +If `prime_encoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`][] is expected. + +If `generator_encoding` is specified, `generator` is expected to be a string; +otherwise either a number or [`Buffer`][] is expected. + +### crypto.createDiffieHellman(prime_length[, generator]) + +Creates a `DiffieHellman` key exchange object and generates a prime of +`prime_length` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curve_name) + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curve_name` string. Use +[`crypto.getCurves()`][] to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm) + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```js +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + var data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key) + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```js +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + var data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm) + +Creates and returns a `Sign` object that uses the given `algorithm`. On +recent OpenSSL releases, `openssl list-public-key-algorithms` will +display the available signing algorithms. One example is `'RSA-SHA256'`. + +### crypto.createVerify(algorithm) + +Creates and returns a `Verify` object that uses the given algorithm. On +recent OpenSSL releases, `openssl list-public-key-algorithms` will +display the available signing algorithms. One example is `'RSA-SHA256'`. + +### crypto.getCiphers() + +Returns an array with the names of the supported cipher algorithms. + +Example: + +```js +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves() + +Returns an array with the names of the supported elliptic curves. + +Example: + +```js +const curves = crypto.getCurves(); +console.log(curves); // ['secp256k1', 'secp384r1', ...] +``` + +### crypto.getDiffieHellman(group_name) + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412][], but see [Caveats][]) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526][]). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`][], but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`][] for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```js +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* alice_secret and bob_secret should be the same */ +console.log(alice_secret == bob_secret); +``` + +### crypto.getHashes() + +Returns an array with the names of the supported hash algorithms. + +Example: + +```js +const hashes = crypto.getHashes(); +console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen[, digest], callback) + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, +a default of `'sha1'` is used. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs, `err` will be set; otherwise `err` will be +null. The successfully generated `derivedKey` will be passed as a [`Buffer`][]. + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132][] for details. + +Example: + +```js +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, key) => { + if (err) throw err; + console.log(key.toString('hex')); // 'c5e478d...1469e50' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`][]. + +### crypto.pbkdf2Sync(password, salt, iterations, keylen[, digest]) + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, +a default of `'sha1'` is used. + +If an error occurs an Error will be thrown, otherwise the derived key will be +returned as a [`Buffer`][]. + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132][] for details. + +Example: + +```js +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key.toString('hex')); // 'c5e478d...1469e50' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`][]. + +### crypto.privateDecrypt(private_key, buffer) + +Decrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : {String} - PEM encoded private key +* `passphrase` : {String} - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + * `constants.RSA_NO_PADDING` + * `constants.RSA_PKCS1_PADDING` + * `constants.RSA_PKCS1_OAEP_PADDING` + +All paddings are defined in the `constants` module. + +### crypto.privateEncrypt(private_key, buffer) + +Encrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : {String} - PEM encoded private key +* `passphrase` : {String} - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + * `constants.RSA_NO_PADDING` + * `constants.RSA_PKCS1_PADDING` + * `constants.RSA_PKCS1_OAEP_PADDING` + +All paddings are defined in the `constants` module. + +### crypto.publicDecrypt(public_key, buffer) + +Decrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : {String} - PEM encoded public key +* `passphrase` : {String} - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + * `constants.RSA_NO_PADDING` + * `constants.RSA_PKCS1_PADDING` + * `constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in the `constants` module. + +### crypto.publicEncrypt(public_key, buffer) + +Encrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : {String} - PEM encoded public key +* `passphrase` : {String} - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + * `constants.RSA_NO_PADDING` + * `constants.RSA_PKCS1_PADDING` + * `constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in the `constants` module. + +### crypto.randomBytes(size[, callback]) + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an Error object; otherwise it is null. The +`buf` argument is a [`Buffer`][] containing the generated bytes. + +```js +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`][]. An error will be thrown if +there is a problem generating the bytes. + +```js +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will block until there is sufficient entropy. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +### crypto.setEngine(engine[, flags]) + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in the +`constants` module): + +* `ENGINE_METHOD_RSA` +* `ENGINE_METHOD_DSA` +* `ENGINE_METHOD_DH` +* `ENGINE_METHOD_RAND` +* `ENGINE_METHOD_ECDH` +* `ENGINE_METHOD_ECDSA` +* `ENGINE_METHOD_CIPHERS` +* `ENGINE_METHOD_DIGESTS` +* `ENGINE_METHOD_STORE` +* `ENGINE_METHOD_PKEY_METHS` +* `ENGINE_METHOD_PKEY_ASN1_METHS` +* `ENGINE_METHOD_ALL` +* `ENGINE_METHOD_NONE` + +## Notes + +### Legacy Streams API (pre Node.js v0.10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`][] objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams][stream] +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'binary'` encoded strings by default rather than Buffers. This +default was changed after Node.js v0.8 to use [`Buffer`][] objects by default +instead. + +### Recent ECDH Changes + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`][] can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`][] now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`][] method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`][] +should be called. The main drawback of using [`ecdh.setPublicKey()`][] is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A][]: + +- MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +- The key used with RSA, DSA and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +- The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. + +[`Buffer`]: buffer.html +[`cipher.final()`]: #crypto_cipher_final_output_encoding +[`cipher.update()`]: #crypto_cipher_update_data_input_encoding_output_encoding +[`crypto.createCipher()`]: #crypto_crypto_createcipher_algorithm_password +[`crypto.createCipheriv()`]: #crypto_crypto_createcipheriv_algorithm_key_iv +[`crypto.createDecipher()`]: #crypto_crypto_createdecipher_algorithm_password +[`crypto.createDecipheriv()`]: #crypto_crypto_createdecipheriv_algorithm_key_iv +[`crypto.createDiffieHellman()`]: #crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding +[`crypto.createECDH()`]: #crypto_crypto_createecdh_curve_name +[`crypto.createHash()`]: #crypto_crypto_createhash_algorithm +[`crypto.createHmac()`]: #crypto_crypto_createhmac_algorithm_key +[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm +[`crypto.getCurves()`]: #crypto_crypto_getcurves +[`crypto.getHashes()`]: #crypto_crypto_gethashes +[`crypto.pbkdf2()`]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback +[`decipher.final()`]: #crypto_decipher_final_output_encoding +[`decipher.update()`]: #crypto_decipher_update_data_input_encoding_output_encoding +[`diffieHellman.setPublicKey()`]: #crypto_diffiehellman_setpublickey_public_key_encoding +[`ecdh.generateKeys()`]: #crypto_ecdh_generatekeys_encoding_format +[`ecdh.setPrivateKey()`]: #crypto_ecdh_setprivatekey_private_key_encoding +[`ecdh.setPublicKey()`]: #crypto_ecdh_setpublickey_public_key_encoding +[`EVP_BytesToKey`]: https://www.openssl.org/docs/crypto/EVP_BytesToKey.html +[`hash.digest()`]: #crypto_hash_digest_encoding +[`hash.update()`]: #crypto_hash_update_data_input_encoding +[`hmac.digest()`]: #crypto_hmac_digest_encoding +[`hmac.update()`]: #crypto_hmac_update_data_input_encoding +[`sign.sign()`]: #crypto_sign_sign_private_key_output_format +[`sign.update()`]: #crypto_sign_update_data_input_encoding +[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_details +[`verify.update()`]: #crypto_verifier_update_data_input_encoding +[`verify.verify()`]: #crypto_verifier_verify_object_signature_signature_format +[Caveats]: #crypto_support_for_weak_or_compromised_algorithms +[HTML5's `keygen` element]: http://www.w3.org/TR/html5/forms.html#the-keygen-element +[initialization vector]: https://en.wikipedia.org/wiki/Initialization_vector +[NIST SP 800-131A]: http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf +[NIST SP 800-132]: http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf +[OpenSSL cipher list format]: https://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT +[OpenSSL's SPKAC implementation]: https://www.openssl.org/docs/apps/spkac.html +[publicly trusted list of CAs]: https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt +[RFC 2412]: https://www.rfc-editor.org/rfc/rfc2412.txt +[RFC 3526]: https://www.rfc-editor.org/rfc/rfc3526.txt +[stream]: stream.html +[stream-writable-write]: stream.html#stream_writable_write_chunk_encoding_callback diff --git a/doc/api/debugger.markdown b/doc/api/debugger.markdown deleted file mode 100644 index 2bbaf9049eb5fb..00000000000000 --- a/doc/api/debugger.markdown +++ /dev/null @@ -1,182 +0,0 @@ -# Debugger - - Stability: 2 - Stable - - - -Node.js includes a full-featured out-of-process debugging utility accessible -via a simple [TCP-based protocol][] and built-in debugging client. To use it, -start Node.js with the `debug` argument followed by the path to the script to -debug; a prompt will be displayed indicating successful launch of the debugger: - -``` -$ node debug myscript.js -< debugger listening on port 5858 -connecting... ok -break in /home/indutny/Code/git/indutny/myscript.js:1 - 1 x = 5; - 2 setTimeout(() => { - 3 debugger; -debug> -``` - -Node.js's debugger client does not yet support the full range of commands, but -simple step and inspection are possible. - -Inserting the statement `debugger;` into the source code of a script will -enable a breakpoint at that position in the code. - -For example, suppose `myscript.js` is written as: - -```js -// myscript.js -x = 5; -setTimeout(() => { - debugger; - console.log('world'); -}, 1000); -console.log('hello'); -``` - -Once the debugger is run, a breakpoint will occur at line 4: - -``` -$ node debug myscript.js -< debugger listening on port 5858 -connecting... ok -break in /home/indutny/Code/git/indutny/myscript.js:1 - 1 x = 5; - 2 setTimeout(() => { - 3 debugger; -debug> cont -< hello -break in /home/indutny/Code/git/indutny/myscript.js:3 - 1 x = 5; - 2 setTimeout(() => { - 3 debugger; - 4 console.log('world'); - 5 }, 1000); -debug> next -break in /home/indutny/Code/git/indutny/myscript.js:4 - 2 setTimeout(() => { - 3 debugger; - 4 console.log('world'); - 5 }, 1000); - 6 console.log('hello'); -debug> repl -Press Ctrl + C to leave debug repl -> x -5 -> 2+2 -4 -debug> next -< world -break in /home/indutny/Code/git/indutny/myscript.js:5 - 3 debugger; - 4 console.log('world'); - 5 }, 1000); - 6 console.log('hello'); - 7 -debug> quit -``` - -The `repl` command allows code to be evaluated remotely. The `next` command -steps over to the next line. Type `help` to see what other commands are -available. - -## Watchers - -It is possible to watch expression and variable values while debugging. On -every breakpoint, each expression from the watchers list will be evaluated -in the current context and displayed immediately before the breakpoint's -source code listing. - -To begin watching an expression, type `watch('my_expression')`. The command -`watchers` will print the active watchers. To remove a watcher, type -`unwatch('my_expression')`. - -## Commands reference - -### Stepping - -* `cont`, `c` - Continue execution -* `next`, `n` - Step next -* `step`, `s` - Step in -* `out`, `o` - Step out -* `pause` - Pause running code (like pause button in Developer Tools) - -### Breakpoints - -* `setBreakpoint()`, `sb()` - Set breakpoint on current line -* `setBreakpoint(line)`, `sb(line)` - Set breakpoint on specific line -* `setBreakpoint('fn()')`, `sb(...)` - Set breakpoint on a first statement in -functions body -* `setBreakpoint('script.js', 1)`, `sb(...)` - Set breakpoint on first line of -script.js -* `clearBreakpoint('script.js', 1)`, `cb(...)` - Clear breakpoint in script.js -on line 1 - -It is also possible to set a breakpoint in a file (module) that -isn't loaded yet: - -``` -$ ./node debug test/fixtures/break-in-module/main.js -< debugger listening on port 5858 -connecting to port 5858... ok -break in test/fixtures/break-in-module/main.js:1 - 1 var mod = require('./mod.js'); - 2 mod.hello(); - 3 mod.hello(); -debug> setBreakpoint('mod.js', 23) -Warning: script 'mod.js' was not loaded yet. - 1 var mod = require('./mod.js'); - 2 mod.hello(); - 3 mod.hello(); -debug> c -break in test/fixtures/break-in-module/mod.js:23 - 21 - 22 exports.hello = () => { - 23 return 'hello from module'; - 24 }; - 25 -debug> -``` - -### Info - -* `backtrace`, `bt` - Print backtrace of current execution frame -* `list(5)` - List scripts source code with 5 line context (5 lines before and -after) -* `watch(expr)` - Add expression to watch list -* `unwatch(expr)` - Remove expression from watch list -* `watchers` - List all watchers and their values (automatically listed on each -breakpoint) -* `repl` - Open debugger's repl for evaluation in debugging script's context -* `exec expr` - Execute an expression in debugging script's context - -### Execution control - -* `run` - Run script (automatically runs on debugger's start) -* `restart` - Restart script -* `kill` - Kill script - -### Various - -* `scripts` - List all loaded scripts -* `version` - Display V8's version - -## Advanced Usage - -An alternative way of enabling and accessing the debugger is to start -Node.js with the `--debug` command-line flag or by signaling an existing -Node.js process with `SIGUSR1`. - -Once a process has been set in debug mode this way, it can be connected to -using the Node.js debugger by either connecting to the `pid` of the running -process or via URI reference to the listening debugger: - -* `node debug -p ` - Connects to the process via the `pid` -* `node debug ` - Connects to the process via the URI such as -localhost:5858 - -[TCP-based protocol]: https://github.com/v8/v8/wiki/Debugging-Protocol diff --git a/doc/api/debugger.md b/doc/api/debugger.md new file mode 100644 index 00000000000000..400192ee00c2da --- /dev/null +++ b/doc/api/debugger.md @@ -0,0 +1,185 @@ +# Debugger + + Stability: 2 - Stable + + + +Node.js includes a full-featured out-of-process debugging utility accessible +via a simple [TCP-based protocol][] and built-in debugging client. To use it, +start Node.js with the `debug` argument followed by the path to the script to +debug; a prompt will be displayed indicating successful launch of the debugger: + +``` +$ node debug myscript.js +< debugger listening on port 5858 +connecting... ok +break in /home/indutny/Code/git/indutny/myscript.js:1 + 1 x = 5; + 2 setTimeout(() => { + 3 debugger; +debug> +``` + +Node.js's debugger client does not yet support the full range of commands, but +simple step and inspection are possible. + +Inserting the statement `debugger;` into the source code of a script will +enable a breakpoint at that position in the code. + +For example, suppose `myscript.js` is written as: + +```js +// myscript.js +x = 5; +setTimeout(() => { + debugger; + console.log('world'); +}, 1000); +console.log('hello'); +``` + +Once the debugger is run, a breakpoint will occur at line 4: + +``` +$ node debug myscript.js +< debugger listening on port 5858 +connecting... ok +break in /home/indutny/Code/git/indutny/myscript.js:1 + 1 x = 5; + 2 setTimeout(() => { + 3 debugger; +debug> cont +< hello +break in /home/indutny/Code/git/indutny/myscript.js:3 + 1 x = 5; + 2 setTimeout(() => { + 3 debugger; + 4 console.log('world'); + 5 }, 1000); +debug> next +break in /home/indutny/Code/git/indutny/myscript.js:4 + 2 setTimeout(() => { + 3 debugger; + 4 console.log('world'); + 5 }, 1000); + 6 console.log('hello'); +debug> repl +Press Ctrl + C to leave debug repl +> x +5 +> 2+2 +4 +debug> next +< world +break in /home/indutny/Code/git/indutny/myscript.js:5 + 3 debugger; + 4 console.log('world'); + 5 }, 1000); + 6 console.log('hello'); + 7 +debug> quit +``` + +The `repl` command allows code to be evaluated remotely. The `next` command +steps over to the next line. Type `help` to see what other commands are +available. + +Pressing `enter` without typing a command will repeat the previous debugger +command. + +## Watchers + +It is possible to watch expression and variable values while debugging. On +every breakpoint, each expression from the watchers list will be evaluated +in the current context and displayed immediately before the breakpoint's +source code listing. + +To begin watching an expression, type `watch('my_expression')`. The command +`watchers` will print the active watchers. To remove a watcher, type +`unwatch('my_expression')`. + +## Commands reference + +### Stepping + +* `cont`, `c` - Continue execution +* `next`, `n` - Step next +* `step`, `s` - Step in +* `out`, `o` - Step out +* `pause` - Pause running code (like pause button in Developer Tools) + +### Breakpoints + +* `setBreakpoint()`, `sb()` - Set breakpoint on current line +* `setBreakpoint(line)`, `sb(line)` - Set breakpoint on specific line +* `setBreakpoint('fn()')`, `sb(...)` - Set breakpoint on a first statement in +functions body +* `setBreakpoint('script.js', 1)`, `sb(...)` - Set breakpoint on first line of +script.js +* `clearBreakpoint('script.js', 1)`, `cb(...)` - Clear breakpoint in script.js +on line 1 + +It is also possible to set a breakpoint in a file (module) that +isn't loaded yet: + +``` +$ ./node debug test/fixtures/break-in-module/main.js +< debugger listening on port 5858 +connecting to port 5858... ok +break in test/fixtures/break-in-module/main.js:1 + 1 var mod = require('./mod.js'); + 2 mod.hello(); + 3 mod.hello(); +debug> setBreakpoint('mod.js', 23) +Warning: script 'mod.js' was not loaded yet. + 1 var mod = require('./mod.js'); + 2 mod.hello(); + 3 mod.hello(); +debug> c +break in test/fixtures/break-in-module/mod.js:23 + 21 + 22 exports.hello = () => { + 23 return 'hello from module'; + 24 }; + 25 +debug> +``` + +### Info + +* `backtrace`, `bt` - Print backtrace of current execution frame +* `list(5)` - List scripts source code with 5 line context (5 lines before and +after) +* `watch(expr)` - Add expression to watch list +* `unwatch(expr)` - Remove expression from watch list +* `watchers` - List all watchers and their values (automatically listed on each +breakpoint) +* `repl` - Open debugger's repl for evaluation in debugging script's context +* `exec expr` - Execute an expression in debugging script's context + +### Execution control + +* `run` - Run script (automatically runs on debugger's start) +* `restart` - Restart script +* `kill` - Kill script + +### Various + +* `scripts` - List all loaded scripts +* `version` - Display V8's version + +## Advanced Usage + +An alternative way of enabling and accessing the debugger is to start +Node.js with the `--debug` command-line flag or by signaling an existing +Node.js process with `SIGUSR1`. + +Once a process has been set in debug mode this way, it can be connected to +using the Node.js debugger by either connecting to the `pid` of the running +process or via URI reference to the listening debugger: + +* `node debug -p ` - Connects to the process via the `pid` +* `node debug ` - Connects to the process via the URI such as +localhost:5858 + +[TCP-based protocol]: https://github.com/v8/v8/wiki/Debugging-Protocol diff --git a/doc/api/dgram.markdown b/doc/api/dgram.md similarity index 100% rename from doc/api/dgram.markdown rename to doc/api/dgram.md diff --git a/doc/api/dns.markdown b/doc/api/dns.md similarity index 100% rename from doc/api/dns.markdown rename to doc/api/dns.md diff --git a/doc/api/documentation.markdown b/doc/api/documentation.markdown deleted file mode 100644 index 4d357e39efab37..00000000000000 --- a/doc/api/documentation.markdown +++ /dev/null @@ -1,91 +0,0 @@ -# About this Documentation - - - -The goal of this documentation is to comprehensively explain the Node.js -API, both from a reference as well as a conceptual point of view. Each -section describes a built-in module or high-level concept. - -Where appropriate, property types, method arguments, and the arguments -provided to event handlers are detailed in a list underneath the topic -heading. - -Every `.html` document has a corresponding `.json` document presenting -the same information in a structured manner. This feature is -experimental, and added for the benefit of IDEs and other utilities that -wish to do programmatic things with the documentation. - -Every `.html` and `.json` file is generated based on the corresponding -`.markdown` file in the `doc/api/` folder in Node.js's source tree. The -documentation is generated using the `tools/doc/generate.js` program. -The HTML template is located at `doc/template.html`. - - -If you find a error in this documentation, please [submit an issue][] -or see [the contributing guide][] for directions on how to submit a patch. - -## Stability Index - - - -Throughout the documentation, you will see indications of a section's -stability. The Node.js API is still somewhat changing, and as it -matures, certain parts are more reliable than others. Some are so -proven, and so relied upon, that they are unlikely to ever change at -all. Others are brand new and experimental, or known to be hazardous -and in the process of being redesigned. - -The stability indices are as follows: - -``` -Stability: 0 - Deprecated -This feature is known to be problematic, and changes are -planned. Do not rely on it. Use of the feature may cause warnings. Backwards -compatibility should not be expected. -``` - -``` -Stability: 1 - Experimental -This feature is subject to change, and is gated by a command line flag. -It may change or be removed in future versions. -``` - -``` -Stability: 2 - Stable -The API has proven satisfactory. Compatibility with the npm ecosystem -is a high priority, and will not be broken unless absolutely necessary. -``` - -``` -Stability: 3 - Locked -Only fixes related to security, performance, or bug fixes will be accepted. -Please do not suggest API changes in this area; they will be refused. -``` - -## JSON Output - - Stability: 1 - Experimental - -Every HTML file in the markdown has a corresponding JSON file with the -same data. - -This feature was added in Node.js v0.6.12. It is experimental. - -## Syscalls and man pages - -System calls like open(2) and read(2) define the interface between user programs -and the underlying operating system. Node functions which simply wrap a syscall, -like `fs.open()`, will document that. The docs link to the corresponding man -pages (short for manual pages) which describe how the syscalls work. - -**Caveat:** some syscalls, like lchown(2), are BSD-specific. That means, for -example, that `fs.lchown()` only works on Mac OS X and other BSD-derived systems, -and is not available on Linux. - -Most Unix syscalls have Windows equivalents, but behavior may differ on Windows -relative to Linux and OS X. For an example of the subtle ways in which it's -sometimes impossible to replace Unix syscall semantics on Windows, see [Node -issue 4760](https://github.com/nodejs/node/issues/4760). - -[submit an issue]: https://github.com/nodejs/node/issues/new -[the contributing guide]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md diff --git a/doc/api/documentation.md b/doc/api/documentation.md new file mode 100644 index 00000000000000..e39dc8f001696a --- /dev/null +++ b/doc/api/documentation.md @@ -0,0 +1,91 @@ +# About this Documentation + + + +The goal of this documentation is to comprehensively explain the Node.js +API, both from a reference as well as a conceptual point of view. Each +section describes a built-in module or high-level concept. + +Where appropriate, property types, method arguments, and the arguments +provided to event handlers are detailed in a list underneath the topic +heading. + +Every `.html` document has a corresponding `.json` document presenting +the same information in a structured manner. This feature is +experimental, and added for the benefit of IDEs and other utilities that +wish to do programmatic things with the documentation. + +Every `.html` and `.json` file is generated based on the corresponding +`.md` file in the `doc/api/` folder in Node.js's source tree. The +documentation is generated using the `tools/doc/generate.js` program. +The HTML template is located at `doc/template.html`. + + +If you find a error in this documentation, please [submit an issue][] +or see [the contributing guide][] for directions on how to submit a patch. + +## Stability Index + + + +Throughout the documentation, you will see indications of a section's +stability. The Node.js API is still somewhat changing, and as it +matures, certain parts are more reliable than others. Some are so +proven, and so relied upon, that they are unlikely to ever change at +all. Others are brand new and experimental, or known to be hazardous +and in the process of being redesigned. + +The stability indices are as follows: + +``` +Stability: 0 - Deprecated +This feature is known to be problematic, and changes are +planned. Do not rely on it. Use of the feature may cause warnings. Backwards +compatibility should not be expected. +``` + +``` +Stability: 1 - Experimental +This feature is subject to change, and is gated by a command line flag. +It may change or be removed in future versions. +``` + +``` +Stability: 2 - Stable +The API has proven satisfactory. Compatibility with the npm ecosystem +is a high priority, and will not be broken unless absolutely necessary. +``` + +``` +Stability: 3 - Locked +Only fixes related to security, performance, or bug fixes will be accepted. +Please do not suggest API changes in this area; they will be refused. +``` + +## JSON Output + + Stability: 1 - Experimental + +Every HTML file in the markdown has a corresponding JSON file with the +same data. + +This feature was added in Node.js v0.6.12. It is experimental. + +## Syscalls and man pages + +System calls like open(2) and read(2) define the interface between user programs +and the underlying operating system. Node functions which simply wrap a syscall, +like `fs.open()`, will document that. The docs link to the corresponding man +pages (short for manual pages) which describe how the syscalls work. + +**Caveat:** some syscalls, like lchown(2), are BSD-specific. That means, for +example, that `fs.lchown()` only works on Mac OS X and other BSD-derived systems, +and is not available on Linux. + +Most Unix syscalls have Windows equivalents, but behavior may differ on Windows +relative to Linux and OS X. For an example of the subtle ways in which it's +sometimes impossible to replace Unix syscall semantics on Windows, see [Node +issue 4760](https://github.com/nodejs/node/issues/4760). + +[submit an issue]: https://github.com/nodejs/node/issues/new +[the contributing guide]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md diff --git a/doc/api/domain.markdown b/doc/api/domain.markdown deleted file mode 100644 index 41d27c5625f896..00000000000000 --- a/doc/api/domain.markdown +++ /dev/null @@ -1,454 +0,0 @@ -# Domain - - Stability: 0 - Deprecated - -**This module is pending deprecation**. Once a replacement API has been -finalized, this module will be fully deprecated. Most end users should -**not** have cause to use this module. Users who absolutely must have -the functionality that domains provide may rely on it for the time being -but should expect to have to migrate to a different solution -in the future. - -Domains provide a way to handle multiple different IO operations as a -single group. If any of the event emitters or callbacks registered to a -domain emit an `'error'` event, or throw an error, then the domain object -will be notified, rather than losing the context of the error in the -`process.on('uncaughtException')` handler, or causing the program to -exit immediately with an error code. - -## Warning: Don't Ignore Errors! - - - -Domain error handlers are not a substitute for closing down your -process when an error occurs. - -By the very nature of how [`throw`][] works in JavaScript, there is almost -never any way to safely "pick up where you left off", without leaking -references, or creating some other sort of undefined brittle state. - -The safest way to respond to a thrown error is to shut down the -process. Of course, in a normal web server, you might have many -connections open, and it is not reasonable to abruptly shut those down -because an error was triggered by someone else. - -The better approach is to send an error response to the request that -triggered the error, while letting the others finish in their normal -time, and stop listening for new requests in that worker. - -In this way, `domain` usage goes hand-in-hand with the cluster module, -since the master process can fork a new worker when a worker -encounters an error. For Node.js programs that scale to multiple -machines, the terminating proxy or service registry can take note of -the failure, and react accordingly. - -For example, this is not a good idea: - -```js -// XXX WARNING! BAD IDEA! - -var d = require('domain').create(); -d.on('error', (er) => { - // The error won't crash the process, but what it does is worse! - // Though we've prevented abrupt process restarting, we are leaking - // resources like crazy if this ever happens. - // This is no better than process.on('uncaughtException')! - console.log('error, but oh well', er.message); -}); -d.run(() => { - require('http').createServer((req, res) => { - handleRequest(req, res); - }).listen(PORT); -}); -``` - -By using the context of a domain, and the resilience of separating our -program into multiple worker processes, we can react more -appropriately, and handle errors with much greater safety. - -```js -// Much better! - -const cluster = require('cluster'); -const PORT = +process.env.PORT || 1337; - -if (cluster.isMaster) { - // In real life, you'd probably use more than just 2 workers, - // and perhaps not put the master and worker in the same file. - // - // You can also of course get a bit fancier about logging, and - // implement whatever custom logic you need to prevent DoS - // attacks and other bad behavior. - // - // See the options in the cluster documentation. - // - // The important thing is that the master does very little, - // increasing our resilience to unexpected errors. - - cluster.fork(); - cluster.fork(); - - cluster.on('disconnect', (worker) => { - console.error('disconnect!'); - cluster.fork(); - }); - -} else { - // the worker - // - // This is where we put our bugs! - - const domain = require('domain'); - - // See the cluster documentation for more details about using - // worker processes to serve requests. How it works, caveats, etc. - - const server = require('http').createServer((req, res) => { - var d = domain.create(); - d.on('error', (er) => { - console.error('error', er.stack); - - // Note: we're in dangerous territory! - // By definition, something unexpected occurred, - // which we probably didn't want. - // Anything can happen now! Be very careful! - - try { - // make sure we close down within 30 seconds - var killtimer = setTimeout(() => { - process.exit(1); - }, 30000); - // But don't keep the process open just for that! - killtimer.unref(); - - // stop taking new requests. - server.close(); - - // Let the master know we're dead. This will trigger a - // 'disconnect' in the cluster master, and then it will fork - // a new worker. - cluster.worker.disconnect(); - - // try to send an error to the request that triggered the problem - res.statusCode = 500; - res.setHeader('content-type', 'text/plain'); - res.end('Oops, there was a problem!\n'); - } catch (er2) { - // oh well, not much we can do at this point. - console.error('Error sending 500!', er2.stack); - } - }); - - // Because req and res were created before this domain existed, - // we need to explicitly add them. - // See the explanation of implicit vs explicit binding below. - d.add(req); - d.add(res); - - // Now run the handler function in the domain. - d.run(() => { - handleRequest(req, res); - }); - }); - server.listen(PORT); -} - -// This part isn't important. Just an example routing thing. -// You'd put your fancy application logic here. -function handleRequest(req, res) { - switch(req.url) { - case '/error': - // We do some async stuff, and then... - setTimeout(() => { - // Whoops! - flerb.bark(); - }); - break; - default: - res.end('ok'); - } -} -``` - -## Additions to Error objects - - - -Any time an `Error` object is routed through a domain, a few extra fields -are added to it. - -* `error.domain` The domain that first handled the error. -* `error.domainEmitter` The event emitter that emitted an `'error'` event - with the error object. -* `error.domainBound` The callback function which was bound to the - domain, and passed an error as its first argument. -* `error.domainThrown` A boolean indicating whether the error was - thrown, emitted, or passed to a bound callback function. - -## Implicit Binding - - - -If domains are in use, then all **new** EventEmitter objects (including -Stream objects, requests, responses, etc.) will be implicitly bound to -the active domain at the time of their creation. - -Additionally, callbacks passed to lowlevel event loop requests (such as -to fs.open, or other callback-taking methods) will automatically be -bound to the active domain. If they throw, then the domain will catch -the error. - -In order to prevent excessive memory usage, Domain objects themselves -are not implicitly added as children of the active domain. If they -were, then it would be too easy to prevent request and response objects -from being properly garbage collected. - -If you *want* to nest Domain objects as children of a parent Domain, -then you must explicitly add them. - -Implicit binding routes thrown errors and `'error'` events to the -Domain's `'error'` event, but does not register the EventEmitter on the -Domain, so [`domain.dispose()`][] will not shut down the EventEmitter. -Implicit binding only takes care of thrown errors and `'error'` events. - -## Explicit Binding - - - -Sometimes, the domain in use is not the one that ought to be used for a -specific event emitter. Or, the event emitter could have been created -in the context of one domain, but ought to instead be bound to some -other domain. - -For example, there could be one domain in use for an HTTP server, but -perhaps we would like to have a separate domain to use for each request. - -That is possible via explicit binding. - -For example: - -```js -// create a top-level domain for the server -const domain = require('domain'); -const http = require('http'); -const serverDomain = domain.create(); - -serverDomain.run(() => { - // server is created in the scope of serverDomain - http.createServer((req, res) => { - // req and res are also created in the scope of serverDomain - // however, we'd prefer to have a separate domain for each request. - // create it first thing, and add req and res to it. - var reqd = domain.create(); - reqd.add(req); - reqd.add(res); - reqd.on('error', (er) => { - console.error('Error', er, req.url); - try { - res.writeHead(500); - res.end('Error occurred, sorry.'); - } catch (er) { - console.error('Error sending 500', er, req.url); - } - }); - }).listen(1337); -}); -``` - -## domain.create() - -* return: {Domain} - -Returns a new Domain object. - -## Class: Domain - -The Domain class encapsulates the functionality of routing errors and -uncaught exceptions to the active Domain object. - -Domain is a child class of [`EventEmitter`][]. To handle the errors that it -catches, listen to its `'error'` event. - -### domain.run(fn[, arg][, ...]) - -* `fn` {Function} - -Run the supplied function in the context of the domain, implicitly -binding all event emitters, timers, and lowlevel requests that are -created in that context. Optionally, arguments can be passed to -the function. - -This is the most basic way to use a domain. - -Example: - -```js -const domain = require('domain'); -const fs = require('fs'); -const d = domain.create(); -d.on('error', (er) => { - console.error('Caught error!', er); -}); -d.run(() => { - process.nextTick(() => { - setTimeout(() => { // simulating some various async stuff - fs.open('non-existent file', 'r', (er, fd) => { - if (er) throw er; - // proceed... - }); - }, 100); - }); -}); -``` - -In this example, the `d.on('error')` handler will be triggered, rather -than crashing the program. - -### domain.members - -* {Array} - -An array of timers and event emitters that have been explicitly added -to the domain. - -### domain.add(emitter) - -* `emitter` {EventEmitter|Timer} emitter or timer to be added to the domain - -Explicitly adds an emitter to the domain. If any event handlers called by -the emitter throw an error, or if the emitter emits an `'error'` event, it -will be routed to the domain's `'error'` event, just like with implicit -binding. - -This also works with timers that are returned from [`setInterval()`][] and -[`setTimeout()`][]. If their callback function throws, it will be caught by -the domain 'error' handler. - -If the Timer or EventEmitter was already bound to a domain, it is removed -from that one, and bound to this one instead. - -### domain.remove(emitter) - -* `emitter` {EventEmitter|Timer} emitter or timer to be removed from the domain - -The opposite of [`domain.add(emitter)`][]. Removes domain handling from the -specified emitter. - -### domain.bind(callback) - -* `callback` {Function} The callback function -* return: {Function} The bound function - -The returned function will be a wrapper around the supplied callback -function. When the returned function is called, any errors that are -thrown will be routed to the domain's `'error'` event. - -#### Example - -```js -const d = domain.create(); - -function readSomeFile(filename, cb) { - fs.readFile(filename, 'utf8', d.bind((er, data) => { - // if this throws, it will also be passed to the domain - return cb(er, data ? JSON.parse(data) : null); - })); -} - -d.on('error', (er) => { - // an error occurred somewhere. - // if we throw it now, it will crash the program - // with the normal line number and stack message. -}); -``` - -### domain.intercept(callback) - -* `callback` {Function} The callback function -* return: {Function} The intercepted function - -This method is almost identical to [`domain.bind(callback)`][]. However, in -addition to catching thrown errors, it will also intercept [`Error`][] -objects sent as the first argument to the function. - -In this way, the common `if (err) return callback(err);` pattern can be replaced -with a single error handler in a single place. - -#### Example - -```js -const d = domain.create(); - -function readSomeFile(filename, cb) { - fs.readFile(filename, 'utf8', d.intercept((data) => { - // note, the first argument is never passed to the - // callback since it is assumed to be the 'Error' argument - // and thus intercepted by the domain. - - // if this throws, it will also be passed to the domain - // so the error-handling logic can be moved to the 'error' - // event on the domain instead of being repeated throughout - // the program. - return cb(null, JSON.parse(data)); - })); -} - -d.on('error', (er) => { - // an error occurred somewhere. - // if we throw it now, it will crash the program - // with the normal line number and stack message. -}); -``` - -### domain.enter() - -The `enter` method is plumbing used by the `run`, `bind`, and `intercept` -methods to set the active domain. It sets `domain.active` and `process.domain` -to the domain, and implicitly pushes the domain onto the domain stack managed -by the domain module (see [`domain.exit()`][] for details on the domain stack). The -call to `enter` delimits the beginning of a chain of asynchronous calls and I/O -operations bound to a domain. - -Calling `enter` changes only the active domain, and does not alter the domain -itself. `enter` and `exit` can be called an arbitrary number of times on a -single domain. - -If the domain on which `enter` is called has been disposed, `enter` will return -without setting the domain. - -### domain.exit() - -The `exit` method exits the current domain, popping it off the domain stack. -Any time execution is going to switch to the context of a different chain of -asynchronous calls, it's important to ensure that the current domain is exited. -The call to `exit` delimits either the end of or an interruption to the chain -of asynchronous calls and I/O operations bound to a domain. - -If there are multiple, nested domains bound to the current execution context, -`exit` will exit any domains nested within this domain. - -Calling `exit` changes only the active domain, and does not alter the domain -itself. `enter` and `exit` can be called an arbitrary number of times on a -single domain. - -If the domain on which `exit` is called has been disposed, `exit` will return -without exiting the domain. - -### domain.dispose() - - Stability: 0 - Deprecated. Please recover from failed IO actions - explicitly via error event handlers set on the domain. - -Once `dispose` has been called, the domain will no longer be used by callbacks -bound into the domain via `run`, `bind`, or `intercept`, and a `'dispose'` event -is emitted. - -[`domain.add(emitter)`]: #domain_domain_add_emitter -[`domain.bind(callback)`]: #domain_domain_bind_callback -[`domain.dispose()`]: #domain_domain_dispose -[`domain.exit()`]: #domain_domain_exit -[`Error`]: errors.html#errors_class_error -[`EventEmitter`]: events.html#events_class_events_eventemitter -[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg -[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg -[`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw diff --git a/doc/api/domain.md b/doc/api/domain.md new file mode 100644 index 00000000000000..c556e2533c0be3 --- /dev/null +++ b/doc/api/domain.md @@ -0,0 +1,454 @@ +# Domain + + Stability: 0 - Deprecated + +**This module is pending deprecation**. Once a replacement API has been +finalized, this module will be fully deprecated. Most end users should +**not** have cause to use this module. Users who absolutely must have +the functionality that domains provide may rely on it for the time being +but should expect to have to migrate to a different solution +in the future. + +Domains provide a way to handle multiple different IO operations as a +single group. If any of the event emitters or callbacks registered to a +domain emit an `'error'` event, or throw an error, then the domain object +will be notified, rather than losing the context of the error in the +`process.on('uncaughtException')` handler, or causing the program to +exit immediately with an error code. + +## Warning: Don't Ignore Errors! + + + +Domain error handlers are not a substitute for closing down your +process when an error occurs. + +By the very nature of how [`throw`][] works in JavaScript, there is almost +never any way to safely "pick up where you left off", without leaking +references, or creating some other sort of undefined brittle state. + +The safest way to respond to a thrown error is to shut down the +process. Of course, in a normal web server, you might have many +connections open, and it is not reasonable to abruptly shut those down +because an error was triggered by someone else. + +The better approach is to send an error response to the request that +triggered the error, while letting the others finish in their normal +time, and stop listening for new requests in that worker. + +In this way, `domain` usage goes hand-in-hand with the cluster module, +since the master process can fork a new worker when a worker +encounters an error. For Node.js programs that scale to multiple +machines, the terminating proxy or service registry can take note of +the failure, and react accordingly. + +For example, this is not a good idea: + +```js +// XXX WARNING! BAD IDEA! + +var d = require('domain').create(); +d.on('error', (er) => { + // The error won't crash the process, but what it does is worse! + // Though we've prevented abrupt process restarting, we are leaking + // resources like crazy if this ever happens. + // This is no better than process.on('uncaughtException')! + console.log('error, but oh well', er.message); +}); +d.run(() => { + require('http').createServer((req, res) => { + handleRequest(req, res); + }).listen(PORT); +}); +``` + +By using the context of a domain, and the resilience of separating our +program into multiple worker processes, we can react more +appropriately, and handle errors with much greater safety. + +```js +// Much better! + +const cluster = require('cluster'); +const PORT = +process.env.PORT || 1337; + +if (cluster.isMaster) { + // In real life, you'd probably use more than just 2 workers, + // and perhaps not put the master and worker in the same file. + // + // You can also of course get a bit fancier about logging, and + // implement whatever custom logic you need to prevent DoS + // attacks and other bad behavior. + // + // See the options in the cluster documentation. + // + // The important thing is that the master does very little, + // increasing our resilience to unexpected errors. + + cluster.fork(); + cluster.fork(); + + cluster.on('disconnect', (worker) => { + console.error('disconnect!'); + cluster.fork(); + }); + +} else { + // the worker + // + // This is where we put our bugs! + + const domain = require('domain'); + + // See the cluster documentation for more details about using + // worker processes to serve requests. How it works, caveats, etc. + + const server = require('http').createServer((req, res) => { + var d = domain.create(); + d.on('error', (er) => { + console.error('error', er.stack); + + // Note: we're in dangerous territory! + // By definition, something unexpected occurred, + // which we probably didn't want. + // Anything can happen now! Be very careful! + + try { + // make sure we close down within 30 seconds + var killtimer = setTimeout(() => { + process.exit(1); + }, 30000); + // But don't keep the process open just for that! + killtimer.unref(); + + // stop taking new requests. + server.close(); + + // Let the master know we're dead. This will trigger a + // 'disconnect' in the cluster master, and then it will fork + // a new worker. + cluster.worker.disconnect(); + + // try to send an error to the request that triggered the problem + res.statusCode = 500; + res.setHeader('content-type', 'text/plain'); + res.end('Oops, there was a problem!\n'); + } catch (er2) { + // oh well, not much we can do at this point. + console.error('Error sending 500!', er2.stack); + } + }); + + // Because req and res were created before this domain existed, + // we need to explicitly add them. + // See the explanation of implicit vs explicit binding below. + d.add(req); + d.add(res); + + // Now run the handler function in the domain. + d.run(() => { + handleRequest(req, res); + }); + }); + server.listen(PORT); +} + +// This part isn't important. Just an example routing thing. +// You'd put your fancy application logic here. +function handleRequest(req, res) { + switch(req.url) { + case '/error': + // We do some async stuff, and then... + setTimeout(() => { + // Whoops! + flerb.bark(); + }); + break; + default: + res.end('ok'); + } +} +``` + +## Additions to Error objects + + + +Any time an `Error` object is routed through a domain, a few extra fields +are added to it. + +* `error.domain` The domain that first handled the error. +* `error.domainEmitter` The event emitter that emitted an `'error'` event + with the error object. +* `error.domainBound` The callback function which was bound to the + domain, and passed an error as its first argument. +* `error.domainThrown` A boolean indicating whether the error was + thrown, emitted, or passed to a bound callback function. + +## Implicit Binding + + + +If domains are in use, then all **new** EventEmitter objects (including +Stream objects, requests, responses, etc.) will be implicitly bound to +the active domain at the time of their creation. + +Additionally, callbacks passed to lowlevel event loop requests (such as +to fs.open, or other callback-taking methods) will automatically be +bound to the active domain. If they throw, then the domain will catch +the error. + +In order to prevent excessive memory usage, Domain objects themselves +are not implicitly added as children of the active domain. If they +were, then it would be too easy to prevent request and response objects +from being properly garbage collected. + +If you *want* to nest Domain objects as children of a parent Domain, +then you must explicitly add them. + +Implicit binding routes thrown errors and `'error'` events to the +Domain's `'error'` event, but does not register the EventEmitter on the +Domain, so [`domain.dispose()`][] will not shut down the EventEmitter. +Implicit binding only takes care of thrown errors and `'error'` events. + +## Explicit Binding + + + +Sometimes, the domain in use is not the one that ought to be used for a +specific event emitter. Or, the event emitter could have been created +in the context of one domain, but ought to instead be bound to some +other domain. + +For example, there could be one domain in use for an HTTP server, but +perhaps we would like to have a separate domain to use for each request. + +That is possible via explicit binding. + +For example: + +```js +// create a top-level domain for the server +const domain = require('domain'); +const http = require('http'); +const serverDomain = domain.create(); + +serverDomain.run(() => { + // server is created in the scope of serverDomain + http.createServer((req, res) => { + // req and res are also created in the scope of serverDomain + // however, we'd prefer to have a separate domain for each request. + // create it first thing, and add req and res to it. + var reqd = domain.create(); + reqd.add(req); + reqd.add(res); + reqd.on('error', (er) => { + console.error('Error', er, req.url); + try { + res.writeHead(500); + res.end('Error occurred, sorry.'); + } catch (er) { + console.error('Error sending 500', er, req.url); + } + }); + }).listen(1337); +}); +``` + +## domain.create() + +* return: {Domain} + +Returns a new Domain object. + +## Class: Domain + +The Domain class encapsulates the functionality of routing errors and +uncaught exceptions to the active Domain object. + +Domain is a child class of [`EventEmitter`][]. To handle the errors that it +catches, listen to its `'error'` event. + +### domain.run(fn[, arg][, ...]) + +* `fn` {Function} + +Run the supplied function in the context of the domain, implicitly +binding all event emitters, timers, and lowlevel requests that are +created in that context. Optionally, arguments can be passed to +the function. + +This is the most basic way to use a domain. + +Example: + +```js +const domain = require('domain'); +const fs = require('fs'); +const d = domain.create(); +d.on('error', (er) => { + console.error('Caught error!', er); +}); +d.run(() => { + process.nextTick(() => { + setTimeout(() => { // simulating some various async stuff + fs.open('non-existent file', 'r', (er, fd) => { + if (er) throw er; + // proceed... + }); + }, 100); + }); +}); +``` + +In this example, the `d.on('error')` handler will be triggered, rather +than crashing the program. + +### domain.members + +* {Array} + +An array of timers and event emitters that have been explicitly added +to the domain. + +### domain.add(emitter) + +* `emitter` {EventEmitter|Timer} emitter or timer to be added to the domain + +Explicitly adds an emitter to the domain. If any event handlers called by +the emitter throw an error, or if the emitter emits an `'error'` event, it +will be routed to the domain's `'error'` event, just like with implicit +binding. + +This also works with timers that are returned from [`setInterval()`][] and +[`setTimeout()`][]. If their callback function throws, it will be caught by +the domain 'error' handler. + +If the Timer or EventEmitter was already bound to a domain, it is removed +from that one, and bound to this one instead. + +### domain.remove(emitter) + +* `emitter` {EventEmitter|Timer} emitter or timer to be removed from the domain + +The opposite of [`domain.add(emitter)`][]. Removes domain handling from the +specified emitter. + +### domain.bind(callback) + +* `callback` {Function} The callback function +* return: {Function} The bound function + +The returned function will be a wrapper around the supplied callback +function. When the returned function is called, any errors that are +thrown will be routed to the domain's `'error'` event. + +#### Example + +```js +const d = domain.create(); + +function readSomeFile(filename, cb) { + fs.readFile(filename, 'utf8', d.bind((er, data) => { + // if this throws, it will also be passed to the domain + return cb(er, data ? JSON.parse(data) : null); + })); +} + +d.on('error', (er) => { + // an error occurred somewhere. + // if we throw it now, it will crash the program + // with the normal line number and stack message. +}); +``` + +### domain.intercept(callback) + +* `callback` {Function} The callback function +* return: {Function} The intercepted function + +This method is almost identical to [`domain.bind(callback)`][]. However, in +addition to catching thrown errors, it will also intercept [`Error`][] +objects sent as the first argument to the function. + +In this way, the common `if (err) return callback(err);` pattern can be replaced +with a single error handler in a single place. + +#### Example + +```js +const d = domain.create(); + +function readSomeFile(filename, cb) { + fs.readFile(filename, 'utf8', d.intercept((data) => { + // note, the first argument is never passed to the + // callback since it is assumed to be the 'Error' argument + // and thus intercepted by the domain. + + // if this throws, it will also be passed to the domain + // so the error-handling logic can be moved to the 'error' + // event on the domain instead of being repeated throughout + // the program. + return cb(null, JSON.parse(data)); + })); +} + +d.on('error', (er) => { + // an error occurred somewhere. + // if we throw it now, it will crash the program + // with the normal line number and stack message. +}); +``` + +### domain.enter() + +The `enter` method is plumbing used by the `run`, `bind`, and `intercept` +methods to set the active domain. It sets `domain.active` and `process.domain` +to the domain, and implicitly pushes the domain onto the domain stack managed +by the domain module (see [`domain.exit()`][] for details on the domain stack). The +call to `enter` delimits the beginning of a chain of asynchronous calls and I/O +operations bound to a domain. + +Calling `enter` changes only the active domain, and does not alter the domain +itself. `enter` and `exit` can be called an arbitrary number of times on a +single domain. + +If the domain on which `enter` is called has been disposed, `enter` will return +without setting the domain. + +### domain.exit() + +The `exit` method exits the current domain, popping it off the domain stack. +Any time execution is going to switch to the context of a different chain of +asynchronous calls, it's important to ensure that the current domain is exited. +The call to `exit` delimits either the end of or an interruption to the chain +of asynchronous calls and I/O operations bound to a domain. + +If there are multiple, nested domains bound to the current execution context, +`exit` will exit any domains nested within this domain. + +Calling `exit` changes only the active domain, and does not alter the domain +itself. `enter` and `exit` can be called an arbitrary number of times on a +single domain. + +If the domain on which `exit` is called has been disposed, `exit` will return +without exiting the domain. + +### domain.dispose() + + Stability: 0 - Deprecated. Please recover from failed IO actions + explicitly via error event handlers set on the domain. + +Once `dispose` has been called, the domain will no longer be used by callbacks +bound into the domain via `run`, `bind`, or `intercept`, and a `'dispose'` event +is emitted. + +[`domain.add(emitter)`]: #domain_domain_add_emitter +[`domain.bind(callback)`]: #domain_domain_bind_callback +[`domain.dispose()`]: #domain_domain_dispose +[`domain.exit()`]: #domain_domain_exit +[`Error`]: errors.html#errors_class_error +[`EventEmitter`]: events.html#events_class_eventemitter +[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg +[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg +[`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw diff --git a/doc/api/errors.markdown b/doc/api/errors.markdown deleted file mode 100644 index 810a8b7e3678ab..00000000000000 --- a/doc/api/errors.markdown +++ /dev/null @@ -1,548 +0,0 @@ -# Errors - - - -Applications running in Node.js will generally experience four categories of -errors: - -- Standard JavaScript errors such as: - - [`EvalError`][]: thrown when a call to `eval()` fails. - - [`SyntaxError`][]: thrown in response to improper JavaScript language - syntax. - - [`RangeError`][]: thrown when a value is not within an expected range - - [`ReferenceError`][]: thrown when using undefined variables - - [`TypeError`][]: thrown when passing arguments of the wrong type - - [`URIError`][]: thrown when a global URI handling function is misused. -- System errors triggered by underlying operating system constraints such - as attempting to open a file that does not exist, attempting to send data - over a closed socket, etc; -- And User-specified errors triggered by application code. -- Assertion Errors are a special class of error that can be triggered whenever - Node.js detects an exceptional logic violation that should never occur. These - are raised typically by the `assert` module. - -All JavaScript and System errors raised by Node.js inherit from, or are -instances of, the standard JavaScript [`Error`][] class and are guaranteed -to provide *at least* the properties available on that class. - -## Error Propagation and Interception - - - -Node.js supports several mechanisms for propagating and handling errors that -occur while an application is running. How these errors are reported and -handled depends entirely on the type of Error and the style of the API that is -called. - -All JavaScript errors are handled as exceptions that *immediately* generate -and throw an error using the standard JavaScript `throw` mechanism. These -are handled using the [`try / catch` construct][] provided by the JavaScript -language. - -```js -// Throws with a ReferenceError because z is undefined -try { - const m = 1; - const n = m + z; -} catch (err) { - // Handle the error here. -} -``` - -Any use of the JavaScript `throw` mechanism will raise an exception that -*must* be handled using `try / catch` or the Node.js process will exit -immediately. - -With few exceptions, _Synchronous_ APIs (any blocking method that does not -accept a `callback` function, such as [`fs.readFileSync`][]), will use `throw` -to report errors. - -Errors that occur within _Asynchronous APIs_ may be reported in multiple ways: - -- Most asynchronous methods that accept a `callback` function will accept an - `Error` object passed as the first argument to that function. If that first - argument is not `null` and is an instance of `Error`, then an error occurred - that should be handled. - - ```js - const fs = require('fs'); - fs.readFile('a file that does not exist', (err, data) => { - if (err) { - console.error('There was an error reading the file!', err); - return; - } - // Otherwise handle the data - }); - ``` -- When an asynchronous method is called on an object that is an `EventEmitter`, - errors can be routed to that object's `'error'` event. - - ```js - const net = require('net'); - const connection = net.connect('localhost'); - - // Adding an 'error' event handler to a stream: - connection.on('error', (err) => { - // If the connection is reset by the server, or if it can't - // connect at all, or on any sort of error encountered by - // the connection, the error will be sent here. - console.error(err); - }); - - connection.pipe(process.stdout); - ``` - -- A handful of typically asynchronous methods in the Node.js API may still - use the `throw` mechanism to raise exceptions that must be handled using - `try / catch`. There is no comprehensive list of such methods; please - refer to the documentation of each method to determine the appropriate - error handling mechanism required. - -The use of the `'error'` event mechanism is most common for [stream-based][] -and [event emitter-based][] APIs, which themselves represent a series of -asynchronous operations over time (as opposed to a single operation that may -pass or fail). - -For *all* `EventEmitter` objects, if an `'error'` event handler is not -provided, the error will be thrown, causing the Node.js process to report an -unhandled exception and crash unless either: The [`domain`][] module is used -appropriately or a handler has been registered for the -[`process.on('uncaughtException')`][] event. - -```js -const EventEmitter = require('events'); -const ee = new EventEmitter(); - -setImmediate(() => { - // This will crash the process because no 'error' event - // handler has been added. - ee.emit('error', new Error('This will crash')); -}); -``` - -Errors generated in this way *cannot* be intercepted using `try / catch` as -they are thrown *after* the calling code has already exited. - -Developers must refer to the documentation for each method to determine -exactly how errors raised by those methods are propagated. - -### Node.js style callbacks - - - -Most asynchronous methods exposed by the Node.js core API follow an idiomatic -pattern referred to as a "Node.js style callback". With this pattern, a -callback function is passed to the method as an argument. When the operation -either completes or an error is raised, the callback function is called with -the Error object (if any) passed as the first argument. If no error was raised, -the first argument will be passed as `null`. - -```js -const fs = require('fs'); - -function nodeStyleCallback(err, data) { - if (err) { - console.error('There was an error', err); - return; - } - console.log(data); -} - -fs.readFile('/some/file/that/does-not-exist', nodeStyleCallback); -fs.readFile('/some/file/that/does-exist', nodeStyleCallback) -``` - -The JavaScript `try / catch` mechanism **cannot** be used to intercept errors -generated by asynchronous APIs. A common mistake for beginners is to try to -use `throw` inside a Node.js style callback: - -```js -// THIS WILL NOT WORK: -const fs = require('fs'); - -try { - fs.readFile('/some/file/that/does-not-exist', (err, data) => { - // mistaken assumption: throwing here... - if (err) { - throw err; - } - }); -} catch(err) { - // This will not catch the throw! - console.log(err); -} -``` - -This will not work because the callback function passed to `fs.readFile()` is -called asynchronously. By the time the callback has been called, the -surrounding code (including the `try { } catch(err) { }` block will have -already exited. Throwing an error inside the callback **can crash the Node.js -process** in most cases. If [domains][] are enabled, or a handler has been -registered with `process.on('uncaughtException')`, such errors can be -intercepted. - -## Class: Error - - - -A generic JavaScript `Error` object that does not denote any specific -circumstance of why the error occurred. `Error` objects capture a "stack trace" -detailing the point in the code at which the `Error` was instantiated, and may -provide a text description of the error. - -All errors generated by Node.js, including all System and JavaScript errors, -will either be instances of, or inherit from, the `Error` class. - -### new Error(message) - -Creates a new `Error` object and sets the `error.message` property to the -provided text message. If an object is passed as `message`, the text message -is generated by calling `message.toString()`. The `error.stack` property will -represent the point in the code at which `new Error()` was called. Stack traces -are dependent on [V8's stack trace API][]. Stack traces extend only to either -(a) the beginning of *synchronous code execution*, or (b) the number of frames -given by the property `Error.stackTraceLimit`, whichever is smaller. - -### Error.captureStackTrace(targetObject[, constructorOpt]) - -Creates a `.stack` property on `targetObject`, which when accessed returns -a string representing the location in the code at which -`Error.captureStackTrace()` was called. - -```js -const myObject = {}; -Error.captureStackTrace(myObject); -myObject.stack // similar to `new Error().stack` -``` - -The first line of the trace, instead of being prefixed with `ErrorType: -message`, will be the result of calling `targetObject.toString()`. - -The optional `constructorOpt` argument accepts a function. If given, all frames -above `constructorOpt`, including `constructorOpt`, will be omitted from the -generated stack trace. - -The `constructorOpt` argument is useful for hiding implementation -details of error generation from an end user. For instance: - -```js -function MyError() { - Error.captureStackTrace(this, MyError); -} - -// Without passing MyError to captureStackTrace, the MyError -// frame would should up in the .stack property. by passing -// the constructor, we omit that frame and all frames above it. -new MyError().stack -``` - -### Error.stackTraceLimit - -The `Error.stackTraceLimit` property specifies the number of stack frames -collected by a stack trace (whether generated by `new Error().stack` or -`Error.captureStackTrace(obj)`). - -The default value is `10` but may be set to any valid JavaScript number. Changes -will affect any stack trace captured *after* the value has been changed. - -If set to a non-number value, or set to a negative number, stack traces will -not capture any frames. - -#### error.message - -Returns the string description of error as set by calling `new Error(message)`. -The `message` passed to the constructor will also appear in the first line of -the stack trace of the `Error`, however changing this property after the -`Error` object is created *may not* change the first line of the stack trace. - -```js -const err = new Error('The message'); -console.log(err.message); - // Prints: The message -``` - -#### error.stack - -Returns a string describing the point in the code at which the `Error` was -instantiated. - -For example: - -``` -Error: Things keep happening! - at /home/gbusey/file.js:525:2 - at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21) - at Actor. (/home/gbusey/actors.js:400:8) - at increaseSynergy (/home/gbusey/actors.js:701:6) -``` - -The first line is formatted as `: `, and -is followed by a series of stack frames (each line beginning with "at "). -Each frame describes a call site within the code that lead to the error being -generated. V8 attempts to display a name for each function (by variable name, -function name, or object method name), but occasionally it will not be able to -find a suitable name. If V8 cannot determine a name for the function, only -location information will be displayed for that frame. Otherwise, the -determined function name will be displayed with location information appended -in parentheses. - -It is important to note that frames are **only** generated for JavaScript -functions. If, for example, execution synchronously passes through a C++ addon -function called `cheetahify`, which itself calls a JavaScript function, the -frame representing the `cheetahify` call will **not** be present in the stack -traces: - -```js -const cheetahify = require('./native-binding.node'); - -function makeFaster() { - // cheetahify *synchronously* calls speedy. - cheetahify(function speedy() { - throw new Error('oh no!'); - }); -} - -makeFaster(); // will throw: - // /home/gbusey/file.js:6 - // throw new Error('oh no!'); - // ^ - // Error: oh no! - // at speedy (/home/gbusey/file.js:6:11) - // at makeFaster (/home/gbusey/file.js:5:3) - // at Object. (/home/gbusey/file.js:10:1) - // at Module._compile (module.js:456:26) - // at Object.Module._extensions..js (module.js:474:10) - // at Module.load (module.js:356:32) - // at Function.Module._load (module.js:312:12) - // at Function.Module.runMain (module.js:497:10) - // at startup (node.js:119:16) - // at node.js:906:3 -``` - -The location information will be one of: - -* `native`, if the frame represents a call internal to V8 (as in `[].forEach`). -* `plain-filename.js:line:column`, if the frame represents a call internal - to Node.js. -* `/absolute/path/to/file.js:line:column`, if the frame represents a call in - a user program, or its dependencies. - -The string representing the stack trace is lazily generated when the -`error.stack` property is **accessed**. - -The number of frames captured by the stack trace is bounded by the smaller of -`Error.stackTraceLimit` or the number of available frames on the current event -loop tick. - -System-level errors are generated as augmented `Error` instances, which are -detailed [here](#errors_system_errors). - -## Class: RangeError - -A subclass of `Error` that indicates that a provided argument was not within the -set or range of acceptable values for a function; whether that is a numeric -range, or outside the set of options for a given function parameter. - -For example: - -```js -require('net').connect(-1); - // throws RangeError, port should be > 0 && < 65536 -``` - -Node.js will generate and throw `RangeError` instances *immediately* as a form -of argument validation. - -## Class: ReferenceError - -A subclass of `Error` that indicates that an attempt is being made to access a -variable that is not defined. Such errors commonly indicate typos in code, or -an otherwise broken program. - -While client code may generate and propagate these errors, in practice, only V8 -will do so. - -```js -doesNotExist; - // throws ReferenceError, doesNotExist is not a variable in this program. -``` - -`ReferenceError` instances will have an `error.arguments` property whose value -is an array containing a single element: a string representing the variable -that was not defined. - -```js -const assert = require('assert'); -try { - doesNotExist; -} catch(err) { - assert(err.arguments[0], 'doesNotExist'); -} -``` - -Unless an application is dynamically generating and running code, -`ReferenceError` instances should always be considered a bug in the code -or its dependencies. - -## Class: SyntaxError - -A subclass of `Error` that indicates that a program is not valid JavaScript. -These errors may only be generated and propagated as a result of code -evaluation. Code evaluation may happen as a result of `eval`, `Function`, -`require`, or [vm][]. These errors are almost always indicative of a broken -program. - -```js -try { - require('vm').runInThisContext('binary ! isNotOk'); -} catch(err) { - // err will be a SyntaxError -} -``` - -`SyntaxError` instances are unrecoverable in the context that created them – -they may only be caught by other contexts. - -## Class: TypeError - -A subclass of `Error` that indicates that a provided argument is not an -allowable type. For example, passing a function to a parameter which expects a -string would be considered a TypeError. - -```js -require('url').parse(function() { }); - // throws TypeError, since it expected a string -``` - -Node.js will generate and throw `TypeError` instances *immediately* as a form -of argument validation. - -## Exceptions vs. Errors - - - -A JavaScript exception is a value that is thrown as a result of an invalid -operation or as the target of a `throw` statement. While it is not required -that these values are instances of `Error` or classes which inherit from -`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be -instances of Error. - -Some exceptions are *unrecoverable* at the JavaScript layer. Such exceptions -will *always* cause the Node.js process to crash. Examples include `assert()` -checks or `abort()` calls in the C++ layer. - -## System Errors - -System errors are generated when exceptions occur within the program's -runtime environment. Typically, these are operational errors that occur -when an application violates an operating system constraint such as attempting -to read a file that does not exist or when the user does not have sufficient -permissions. - -System errors are typically generated at the syscall level: an exhaustive list -of error codes and their meanings is available by running `man 2 intro` or -`man 3 errno` on most Unices; or [online][]. - -In Node.js, system errors are represented as augmented `Error` objects with -added properties. - -### Class: System Error - -#### error.code -#### error.errno - -Returns a string representing the error code, which is always `E` followed by -a sequence of capital letters, and may be referenced in `man 2 intro`. - -The properties `error.code` and `error.errno` are aliases of one another and -return the same value. - -#### error.syscall - -Returns a string describing the [syscall][] that failed. - -### Common System Errors - -This list is **not exhaustive**, but enumerates many of the common system -errors encountered when writing a Node.js program. An exhaustive list may be -found [here][online]. - -- `EACCES` (Permission denied): An attempt was made to access a file in a way - forbidden by its file access permissions. - -- `EADDRINUSE` (Address already in use): An attempt to bind a server - ([`net`][], [`http`][], or [`https`][]) to a local address failed due to - another server on the local system already occupying that address. - -- `ECONNREFUSED` (Connection refused): No connection could be made because the - target machine actively refused it. This usually results from trying to - connect to a service that is inactive on the foreign host. - -- `ECONNRESET` (Connection reset by peer): A connection was forcibly closed by - a peer. This normally results from a loss of the connection on the remote - socket due to a timeout or reboot. Commonly encountered via the [`http`][] - and [`net`][] modules. - -- `EEXIST` (File exists): An existing file was the target of an operation that - required that the target not exist. - -- `EISDIR` (Is a directory): An operation expected a file, but the given - pathname was a directory. - -- `EMFILE` (Too many open files in system): Maximum number of - [file descriptors][] allowable on the system has been reached, and - requests for another descriptor cannot be fulfilled until at least one - has been closed. This is encountered when opening many files at once in - parallel, especially on systems (in particular, OS X) where there is a low - file descriptor limit for processes. To remedy a low limit, run - `ulimit -n 2048` in the same shell that will run the Node.js process. - -- `ENOENT` (No such file or directory): Commonly raised by [`fs`][] operations - to indicate that a component of the specified pathname does not exist -- no - entity (file or directory) could be found by the given path. - -- `ENOTDIR` (Not a directory): A component of the given pathname existed, but - was not a directory as expected. Commonly raised by [`fs.readdir`][]. - -- `ENOTEMPTY` (Directory not empty): A directory with entries was the target - of an operation that requires an empty directory -- usually [`fs.unlink`][]. - -- `EPERM` (Operation not permitted): An attempt was made to perform an - operation that requires elevated privileges. - -- `EPIPE` (Broken pipe): A write on a pipe, socket, or FIFO for which there is - no process to read the data. Commonly encountered at the [`net`][] and - [`http`][] layers, indicative that the remote side of the stream being - written to has been closed. - -- `ETIMEDOUT` (Operation timed out): A connect or send request failed because - the connected party did not properly respond after a period of time. Usually - encountered by [`http`][] or [`net`][] -- often a sign that a `socket.end()` - was not properly called. - -[`domain`]: domain.html -[`EvalError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError -[`Error`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error -[`fs.readdir`]: fs.html#fs_fs_readdir_path_callback -[`fs.readFileSync`]: fs.html#fs_fs_readfilesync_file_options -[`fs.unlink`]: fs.html#fs_fs_unlink_path_callback -[`fs`]: fs.html -[`http`]: http.html -[`https`]: https.html -[`net`]: net.html -[`process.on('uncaughtException')`]: process.html#process_event_uncaughtexception -[`try / catch` construct]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch -[`try { } catch(err) { }`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch -[domains]: domain.html -[event emitter-based]: events.html#events_class_events_eventemitter -[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor -[online]: http://man7.org/linux/man-pages/man3/errno.3.html -[stream-based]: stream.html -[syscall]: http://man7.org/linux/man-pages/man2/syscall.2.html -[V8's stack trace API]: https://github.com/v8/v8/wiki/Stack-Trace-API -[vm]: vm.html -[`SyntaxError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError -[`RangeError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError -[`ReferenceError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError -[`TypeError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError -[`URIError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError diff --git a/doc/api/errors.md b/doc/api/errors.md new file mode 100644 index 00000000000000..bb83ef1320a25d --- /dev/null +++ b/doc/api/errors.md @@ -0,0 +1,539 @@ +# Errors + + + +Applications running in Node.js will generally experience four categories of +errors: + +- Standard JavaScript errors such as: + - {EvalError} : thrown when a call to `eval()` fails. + - {SyntaxError} : thrown in response to improper JavaScript language + syntax. + - {RangeError} : thrown when a value is not within an expected range + - {ReferenceError} : thrown when using undefined variables + - {TypeError} : thrown when passing arguments of the wrong type + - {URIError} : thrown when a global URI handling function is misused. +- System errors triggered by underlying operating system constraints such + as attempting to open a file that does not exist, attempting to send data + over a closed socket, etc; +- And User-specified errors triggered by application code. +- Assertion Errors are a special class of error that can be triggered whenever + Node.js detects an exceptional logic violation that should never occur. These + are raised typically by the `assert` module. + +All JavaScript and System errors raised by Node.js inherit from, or are +instances of, the standard JavaScript {Error} class and are guaranteed +to provide *at least* the properties available on that class. + +## Error Propagation and Interception + + + +Node.js supports several mechanisms for propagating and handling errors that +occur while an application is running. How these errors are reported and +handled depends entirely on the type of Error and the style of the API that is +called. + +All JavaScript errors are handled as exceptions that *immediately* generate +and throw an error using the standard JavaScript `throw` mechanism. These +are handled using the [`try / catch` construct][try-catch] provided by the JavaScript +language. + +```js +// Throws with a ReferenceError because z is undefined +try { + const m = 1; + const n = m + z; +} catch (err) { + // Handle the error here. +} +``` + +Any use of the JavaScript `throw` mechanism will raise an exception that +*must* be handled using `try / catch` or the Node.js process will exit +immediately. + +With few exceptions, _Synchronous_ APIs (any blocking method that does not +accept a `callback` function, such as [`fs.readFileSync`][]), will use `throw` +to report errors. + +Errors that occur within _Asynchronous APIs_ may be reported in multiple ways: + +- Most asynchronous methods that accept a `callback` function will accept an + `Error` object passed as the first argument to that function. If that first + argument is not `null` and is an instance of `Error`, then an error occurred + that should be handled. + + ```js + const fs = require('fs'); + fs.readFile('a file that does not exist', (err, data) => { + if (err) { + console.error('There was an error reading the file!', err); + return; + } + // Otherwise handle the data + }); + ``` +- When an asynchronous method is called on an object that is an `EventEmitter`, + errors can be routed to that object's `'error'` event. + + ```js + const net = require('net'); + const connection = net.connect('localhost'); + + // Adding an 'error' event handler to a stream: + connection.on('error', (err) => { + // If the connection is reset by the server, or if it can't + // connect at all, or on any sort of error encountered by + // the connection, the error will be sent here. + console.error(err); + }); + + connection.pipe(process.stdout); + ``` + +- A handful of typically asynchronous methods in the Node.js API may still + use the `throw` mechanism to raise exceptions that must be handled using + `try / catch`. There is no comprehensive list of such methods; please + refer to the documentation of each method to determine the appropriate + error handling mechanism required. + +The use of the `'error'` event mechanism is most common for [stream-based][] +and [event emitter-based][] APIs, which themselves represent a series of +asynchronous operations over time (as opposed to a single operation that may +pass or fail). + +For *all* `EventEmitter` objects, if an `'error'` event handler is not +provided, the error will be thrown, causing the Node.js process to report an +unhandled exception and crash unless either: The [`domain`][domains] module is used +appropriately or a handler has been registered for the +[`process.on('uncaughtException')`][] event. + +```js +const EventEmitter = require('events'); +const ee = new EventEmitter(); + +setImmediate(() => { + // This will crash the process because no 'error' event + // handler has been added. + ee.emit('error', new Error('This will crash')); +}); +``` + +Errors generated in this way *cannot* be intercepted using `try / catch` as +they are thrown *after* the calling code has already exited. + +Developers must refer to the documentation for each method to determine +exactly how errors raised by those methods are propagated. + +### Node.js style callbacks + + + +Most asynchronous methods exposed by the Node.js core API follow an idiomatic +pattern referred to as a "Node.js style callback". With this pattern, a +callback function is passed to the method as an argument. When the operation +either completes or an error is raised, the callback function is called with +the Error object (if any) passed as the first argument. If no error was raised, +the first argument will be passed as `null`. + +```js +const fs = require('fs'); + +function nodeStyleCallback(err, data) { + if (err) { + console.error('There was an error', err); + return; + } + console.log(data); +} + +fs.readFile('/some/file/that/does-not-exist', nodeStyleCallback); +fs.readFile('/some/file/that/does-exist', nodeStyleCallback) +``` + +The JavaScript `try / catch` mechanism **cannot** be used to intercept errors +generated by asynchronous APIs. A common mistake for beginners is to try to +use `throw` inside a Node.js style callback: + +```js +// THIS WILL NOT WORK: +const fs = require('fs'); + +try { + fs.readFile('/some/file/that/does-not-exist', (err, data) => { + // mistaken assumption: throwing here... + if (err) { + throw err; + } + }); +} catch(err) { + // This will not catch the throw! + console.log(err); +} +``` + +This will not work because the callback function passed to `fs.readFile()` is +called asynchronously. By the time the callback has been called, the +surrounding code (including the `try { } catch(err) { }` block will have +already exited. Throwing an error inside the callback **can crash the Node.js +process** in most cases. If [domains][] are enabled, or a handler has been +registered with `process.on('uncaughtException')`, such errors can be +intercepted. + +## Class: Error + + + +A generic JavaScript `Error` object that does not denote any specific +circumstance of why the error occurred. `Error` objects capture a "stack trace" +detailing the point in the code at which the `Error` was instantiated, and may +provide a text description of the error. + +All errors generated by Node.js, including all System and JavaScript errors, +will either be instances of, or inherit from, the `Error` class. + +### new Error(message) + +Creates a new `Error` object and sets the `error.message` property to the +provided text message. If an object is passed as `message`, the text message +is generated by calling `message.toString()`. The `error.stack` property will +represent the point in the code at which `new Error()` was called. Stack traces +are dependent on [V8's stack trace API][]. Stack traces extend only to either +(a) the beginning of *synchronous code execution*, or (b) the number of frames +given by the property `Error.stackTraceLimit`, whichever is smaller. + +### Error.captureStackTrace(targetObject[, constructorOpt]) + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack // similar to `new Error().stack` +``` + +The first line of the trace, instead of being prefixed with `ErrorType: +message`, will be the result of calling `targetObject.toString()`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from an end user. For instance: + +```js +function MyError() { + Error.captureStackTrace(this, MyError); +} + +// Without passing MyError to captureStackTrace, the MyError +// frame would should up in the .stack property. by passing +// the constructor, we omit that frame and all frames above it. +new MyError().stack +``` + +### Error.stackTraceLimit + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured *after* the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### error.message + +Returns the string description of error as set by calling `new Error(message)`. +The `message` passed to the constructor will also appear in the first line of +the stack trace of the `Error`, however changing this property after the +`Error` object is created *may not* change the first line of the stack trace. + +```js +const err = new Error('The message'); +console.log(err.message); + // Prints: The message +``` + +#### error.stack + +Returns a string describing the point in the code at which the `Error` was +instantiated. + +For example: + +``` +Error: Things keep happening! + at /home/gbusey/file.js:525:2 + at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21) + at Actor. (/home/gbusey/actors.js:400:8) + at increaseSynergy (/home/gbusey/actors.js:701:6) +``` + +The first line is formatted as `: `, and +is followed by a series of stack frames (each line beginning with "at "). +Each frame describes a call site within the code that lead to the error being +generated. V8 attempts to display a name for each function (by variable name, +function name, or object method name), but occasionally it will not be able to +find a suitable name. If V8 cannot determine a name for the function, only +location information will be displayed for that frame. Otherwise, the +determined function name will be displayed with location information appended +in parentheses. + +It is important to note that frames are **only** generated for JavaScript +functions. If, for example, execution synchronously passes through a C++ addon +function called `cheetahify`, which itself calls a JavaScript function, the +frame representing the `cheetahify` call will **not** be present in the stack +traces: + +```js +const cheetahify = require('./native-binding.node'); + +function makeFaster() { + // cheetahify *synchronously* calls speedy. + cheetahify(function speedy() { + throw new Error('oh no!'); + }); +} + +makeFaster(); // will throw: + // /home/gbusey/file.js:6 + // throw new Error('oh no!'); + // ^ + // Error: oh no! + // at speedy (/home/gbusey/file.js:6:11) + // at makeFaster (/home/gbusey/file.js:5:3) + // at Object. (/home/gbusey/file.js:10:1) + // at Module._compile (module.js:456:26) + // at Object.Module._extensions..js (module.js:474:10) + // at Module.load (module.js:356:32) + // at Function.Module._load (module.js:312:12) + // at Function.Module.runMain (module.js:497:10) + // at startup (node.js:119:16) + // at node.js:906:3 +``` + +The location information will be one of: + +* `native`, if the frame represents a call internal to V8 (as in `[].forEach`). +* `plain-filename.js:line:column`, if the frame represents a call internal + to Node.js. +* `/absolute/path/to/file.js:line:column`, if the frame represents a call in + a user program, or its dependencies. + +The string representing the stack trace is lazily generated when the +`error.stack` property is **accessed**. + +The number of frames captured by the stack trace is bounded by the smaller of +`Error.stackTraceLimit` or the number of available frames on the current event +loop tick. + +System-level errors are generated as augmented `Error` instances, which are +detailed [here](#errors_system_errors). + +## Class: RangeError + +A subclass of `Error` that indicates that a provided argument was not within the +set or range of acceptable values for a function; whether that is a numeric +range, or outside the set of options for a given function parameter. + +For example: + +```js +require('net').connect(-1); + // throws RangeError, port should be > 0 && < 65536 +``` + +Node.js will generate and throw `RangeError` instances *immediately* as a form +of argument validation. + +## Class: ReferenceError + +A subclass of `Error` that indicates that an attempt is being made to access a +variable that is not defined. Such errors commonly indicate typos in code, or +an otherwise broken program. + +While client code may generate and propagate these errors, in practice, only V8 +will do so. + +```js +doesNotExist; + // throws ReferenceError, doesNotExist is not a variable in this program. +``` + +`ReferenceError` instances will have an `error.arguments` property whose value +is an array containing a single element: a string representing the variable +that was not defined. + +```js +const assert = require('assert'); +try { + doesNotExist; +} catch(err) { + assert(err.arguments[0], 'doesNotExist'); +} +``` + +Unless an application is dynamically generating and running code, +`ReferenceError` instances should always be considered a bug in the code +or its dependencies. + +## Class: SyntaxError + +A subclass of `Error` that indicates that a program is not valid JavaScript. +These errors may only be generated and propagated as a result of code +evaluation. Code evaluation may happen as a result of `eval`, `Function`, +`require`, or [vm][]. These errors are almost always indicative of a broken +program. + +```js +try { + require('vm').runInThisContext('binary ! isNotOk'); +} catch(err) { + // err will be a SyntaxError +} +``` + +`SyntaxError` instances are unrecoverable in the context that created them – +they may only be caught by other contexts. + +## Class: TypeError + +A subclass of `Error` that indicates that a provided argument is not an +allowable type. For example, passing a function to a parameter which expects a +string would be considered a TypeError. + +```js +require('url').parse(() => { }); + // throws TypeError, since it expected a string +``` + +Node.js will generate and throw `TypeError` instances *immediately* as a form +of argument validation. + +## Exceptions vs. Errors + + + +A JavaScript exception is a value that is thrown as a result of an invalid +operation or as the target of a `throw` statement. While it is not required +that these values are instances of `Error` or classes which inherit from +`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be +instances of Error. + +Some exceptions are *unrecoverable* at the JavaScript layer. Such exceptions +will *always* cause the Node.js process to crash. Examples include `assert()` +checks or `abort()` calls in the C++ layer. + +## System Errors + +System errors are generated when exceptions occur within the program's +runtime environment. Typically, these are operational errors that occur +when an application violates an operating system constraint such as attempting +to read a file that does not exist or when the user does not have sufficient +permissions. + +System errors are typically generated at the syscall level: an exhaustive list +of error codes and their meanings is available by running `man 2 intro` or +`man 3 errno` on most Unices; or [online][]. + +In Node.js, system errors are represented as augmented `Error` objects with +added properties. + +### Class: System Error + +#### error.code +#### error.errno + +Returns a string representing the error code, which is always `E` followed by +a sequence of capital letters, and may be referenced in `man 2 intro`. + +The properties `error.code` and `error.errno` are aliases of one another and +return the same value. + +#### error.syscall + +Returns a string describing the [syscall][] that failed. + +### Common System Errors + +This list is **not exhaustive**, but enumerates many of the common system +errors encountered when writing a Node.js program. An exhaustive list may be +found [here][online]. + +- `EACCES` (Permission denied): An attempt was made to access a file in a way + forbidden by its file access permissions. + +- `EADDRINUSE` (Address already in use): An attempt to bind a server + ([`net`][], [`http`][], or [`https`][]) to a local address failed due to + another server on the local system already occupying that address. + +- `ECONNREFUSED` (Connection refused): No connection could be made because the + target machine actively refused it. This usually results from trying to + connect to a service that is inactive on the foreign host. + +- `ECONNRESET` (Connection reset by peer): A connection was forcibly closed by + a peer. This normally results from a loss of the connection on the remote + socket due to a timeout or reboot. Commonly encountered via the [`http`][] + and [`net`][] modules. + +- `EEXIST` (File exists): An existing file was the target of an operation that + required that the target not exist. + +- `EISDIR` (Is a directory): An operation expected a file, but the given + pathname was a directory. + +- `EMFILE` (Too many open files in system): Maximum number of + [file descriptors][] allowable on the system has been reached, and + requests for another descriptor cannot be fulfilled until at least one + has been closed. This is encountered when opening many files at once in + parallel, especially on systems (in particular, OS X) where there is a low + file descriptor limit for processes. To remedy a low limit, run + `ulimit -n 2048` in the same shell that will run the Node.js process. + +- `ENOENT` (No such file or directory): Commonly raised by [`fs`][] operations + to indicate that a component of the specified pathname does not exist -- no + entity (file or directory) could be found by the given path. + +- `ENOTDIR` (Not a directory): A component of the given pathname existed, but + was not a directory as expected. Commonly raised by [`fs.readdir`][]. + +- `ENOTEMPTY` (Directory not empty): A directory with entries was the target + of an operation that requires an empty directory -- usually [`fs.unlink`][]. + +- `EPERM` (Operation not permitted): An attempt was made to perform an + operation that requires elevated privileges. + +- `EPIPE` (Broken pipe): A write on a pipe, socket, or FIFO for which there is + no process to read the data. Commonly encountered at the [`net`][] and + [`http`][] layers, indicative that the remote side of the stream being + written to has been closed. + +- `ETIMEDOUT` (Operation timed out): A connect or send request failed because + the connected party did not properly respond after a period of time. Usually + encountered by [`http`][] or [`net`][] -- often a sign that a `socket.end()` + was not properly called. + +[`fs.readdir`]: fs.html#fs_fs_readdir_path_options_callback +[`fs.readFileSync`]: fs.html#fs_fs_readfilesync_file_options +[`fs.unlink`]: fs.html#fs_fs_unlink_path_callback +[`fs`]: fs.html +[`http`]: http.html +[`https`]: https.html +[`net`]: net.html +[`process.on('uncaughtException')`]: process.html#process_event_uncaughtexception +[domains]: domain.html +[event emitter-based]: events.html#events_class_eventemitter +[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor +[online]: http://man7.org/linux/man-pages/man3/errno.3.html +[stream-based]: stream.html +[syscall]: http://man7.org/linux/man-pages/man2/syscall.2.html +[try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch +[V8's stack trace API]: https://github.com/v8/v8/wiki/Stack-Trace-API +[vm]: vm.html diff --git a/doc/api/events.markdown b/doc/api/events.md similarity index 100% rename from doc/api/events.markdown rename to doc/api/events.md diff --git a/doc/api/fs.markdown b/doc/api/fs.markdown deleted file mode 100644 index 61430cf6573b1c..00000000000000 --- a/doc/api/fs.markdown +++ /dev/null @@ -1,1055 +0,0 @@ -# File System - - Stability: 2 - Stable - - - -File I/O is provided by simple wrappers around standard POSIX functions. To -use this module do `require('fs')`. All the methods have asynchronous and -synchronous forms. - -The asynchronous form always takes a completion callback as its last argument. -The arguments passed to the completion callback depend on the method, but the -first argument is always reserved for an exception. If the operation was -completed successfully, then the first argument will be `null` or `undefined`. - -When using the synchronous form any exceptions are immediately thrown. -You can use try/catch to handle exceptions or allow them to bubble up. - -Here is an example of the asynchronous version: - -```js -const fs = require('fs'); - -fs.unlink('/tmp/hello', (err) => { - if (err) throw err; - console.log('successfully deleted /tmp/hello'); -}); -``` - -Here is the synchronous version: - -```js -const fs = require('fs'); - -fs.unlinkSync('/tmp/hello'); -console.log('successfully deleted /tmp/hello'); -``` - -With the asynchronous methods there is no guaranteed ordering. So the -following is prone to error: - -```js -fs.rename('/tmp/hello', '/tmp/world', (err) => { - if (err) throw err; - console.log('renamed complete'); -}); -fs.stat('/tmp/world', (err, stats) => { - if (err) throw err; - console.log(`stats: ${JSON.stringify(stats)}`); -}); -``` - -It could be that `fs.stat` is executed before `fs.rename`. -The correct way to do this is to chain the callbacks. - -```js -fs.rename('/tmp/hello', '/tmp/world', (err) => { - if (err) throw err; - fs.stat('/tmp/world', (err, stats) => { - if (err) throw err; - console.log(`stats: ${JSON.stringify(stats)}`); - }); -}); -``` - -In busy processes, the programmer is _strongly encouraged_ to use the -asynchronous versions of these calls. The synchronous versions will block -the entire process until they complete--halting all connections. - -The relative path to a filename can be used. Remember, however, that this path -will be relative to `process.cwd()`. - -Most fs functions let you omit the callback argument. If you do, a default -callback is used that rethrows errors. To get a trace to the original call -site, set the `NODE_DEBUG` environment variable: - -``` -$ cat script.js -function bad() { - require('fs').readFile('/'); -} -bad(); - -$ env NODE_DEBUG=fs node script.js -fs.js:66 - throw err; - ^ -Error: EISDIR, read - at rethrow (fs.js:61:21) - at maybeCallback (fs.js:79:42) - at Object.fs.readFile (fs.js:153:18) - at bad (/path/to/script.js:2:17) - at Object. (/path/to/script.js:5:1) - -``` - -## Class: fs.FSWatcher - -Objects returned from `fs.watch()` are of this type. - -### Event: 'change' - -* `event` {String} The type of fs change -* `filename` {String} The filename that changed (if relevant/available) - -Emitted when something changes in a watched directory or file. -See more details in [`fs.watch()`][]. - -### Event: 'error' - -* `error` {Error} - -Emitted when an error occurs. - -### watcher.close() - -Stop watching for changes on the given `fs.FSWatcher`. - -## Class: fs.ReadStream - -`ReadStream` is a [Readable Stream][]. - -### Event: 'open' - -* `fd` {Number} Integer file descriptor used by the ReadStream. - -Emitted when the ReadStream's file is opened. - -### readStream.path - -The path to the file the stream is reading from. - -## Class: fs.Stats - -Objects returned from [`fs.stat()`][], [`fs.lstat()`][] and [`fs.fstat()`][] and their -synchronous counterparts are of this type. - - - `stats.isFile()` - - `stats.isDirectory()` - - `stats.isBlockDevice()` - - `stats.isCharacterDevice()` - - `stats.isSymbolicLink()` (only valid with [`fs.lstat()`][]) - - `stats.isFIFO()` - - `stats.isSocket()` - -For a regular file [`util.inspect(stats)`][] would return a string very -similar to this: - -```js -{ - dev: 2114, - ino: 48064969, - mode: 33188, - nlink: 1, - uid: 85, - gid: 100, - rdev: 0, - size: 527, - blksize: 4096, - blocks: 8, - atime: Mon, 10 Oct 2011 23:24:11 GMT, - mtime: Mon, 10 Oct 2011 23:24:11 GMT, - ctime: Mon, 10 Oct 2011 23:24:11 GMT, - birthtime: Mon, 10 Oct 2011 23:24:11 GMT -} -``` - -Please note that `atime`, `mtime`, `birthtime`, and `ctime` are -instances of [`Date`][MDN-Date] object and to compare the values of -these objects you should use appropriate methods. For most general -uses [`getTime()`][MDN-Date-getTime] will return the number of -milliseconds elapsed since _1 January 1970 00:00:00 UTC_ and this -integer should be sufficient for any comparison, however there are -additional methods which can be used for displaying fuzzy information. -More details can be found in the [MDN JavaScript Reference][MDN-Date] -page. - -### Stat Time Values - -The times in the stat object have the following semantics: - -* `atime` "Access Time" - Time when file data last accessed. Changed - by the `mknod(2)`, `utimes(2)`, and `read(2)` system calls. -* `mtime` "Modified Time" - Time when file data last modified. - Changed by the `mknod(2)`, `utimes(2)`, and `write(2)` system calls. -* `ctime` "Change Time" - Time when file status was last changed - (inode data modification). Changed by the `chmod(2)`, `chown(2)`, - `link(2)`, `mknod(2)`, `rename(2)`, `unlink(2)`, `utimes(2)`, - `read(2)`, and `write(2)` system calls. -* `birthtime` "Birth Time" - Time of file creation. Set once when the - file is created. On filesystems where birthtime is not available, - this field may instead hold either the `ctime` or - `1970-01-01T00:00Z` (ie, unix epoch timestamp `0`). Note that this - value may be greater than `atime` or `mtime` in this case. On Darwin - and other FreeBSD variants, also set if the `atime` is explicitly - set to an earlier value than the current `birthtime` using the - `utimes(2)` system call. - -Prior to Node v0.12, the `ctime` held the `birthtime` on Windows -systems. Note that as of v0.12, `ctime` is not "creation time", and -on Unix systems, it never was. - -## Class: fs.WriteStream - -`WriteStream` is a [Writable Stream][]. - -### Event: 'open' - -* `fd` {Number} Integer file descriptor used by the WriteStream. - -Emitted when the WriteStream's file is opened. - -### writeStream.bytesWritten - -The number of bytes written so far. Does not include data that is still queued -for writing. - -### writeStream.path - -The path to the file the stream is writing to. - -## fs.access(path[, mode], callback) - -Tests a user's permissions for the file specified by `path`. `mode` is an -optional integer that specifies the accessibility checks to be performed. The -following constants define the possible values of `mode`. It is possible to -create a mask consisting of the bitwise OR of two or more values. - -- `fs.F_OK` - File is visible to the calling process. This is useful for -determining if a file exists, but says nothing about `rwx` permissions. -Default if no `mode` is specified. -- `fs.R_OK` - File can be read by the calling process. -- `fs.W_OK` - File can be written by the calling process. -- `fs.X_OK` - File can be executed by the calling process. This has no effect -on Windows (will behave like `fs.F_OK`). - -The final argument, `callback`, is a callback function that is invoked with -a possible error argument. If any of the accessibility checks fail, the error -argument will be populated. The following example checks if the file -`/etc/passwd` can be read and written by the current process. - -```js -fs.access('/etc/passwd', fs.R_OK | fs.W_OK, (err) => { - console.log(err ? 'no access!' : 'can read/write'); -}); -``` - -## fs.accessSync(path[, mode]) - -Synchronous version of [`fs.access()`][]. This throws if any accessibility checks -fail, and does nothing otherwise. - -## fs.appendFile(file, data[, options], callback) - -* `file` {String|Number} filename or file descriptor -* `data` {String|Buffer} -* `options` {Object|String} - * `encoding` {String|Null} default = `'utf8'` - * `mode` {Number} default = `0o666` - * `flag` {String} default = `'a'` -* `callback` {Function} - -Asynchronously append data to a file, creating the file if it does not yet exist. -`data` can be a string or a buffer. - -Example: - -```js -fs.appendFile('message.txt', 'data to append', (err) => { - if (err) throw err; - console.log('The "data to append" was appended to file!'); -}); -``` - -If `options` is a string, then it specifies the encoding. Example: - -```js -fs.appendFile('message.txt', 'data to append', 'utf8', callback); -``` - -Any specified file descriptor has to have been opened for appending. - -_Note: Specified file descriptors will not be closed automatically._ - -## fs.appendFileSync(file, data[, options]) - -The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. - -## fs.chmod(path, mode, callback) - -Asynchronous chmod(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.chmodSync(path, mode) - -Synchronous chmod(2). Returns `undefined`. - -## fs.chown(path, uid, gid, callback) - -Asynchronous chown(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.chownSync(path, uid, gid) - -Synchronous chown(2). Returns `undefined`. - -## fs.close(fd, callback) - -Asynchronous close(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.closeSync(fd) - -Synchronous close(2). Returns `undefined`. - -## fs.createReadStream(path[, options]) - -Returns a new [`ReadStream`][] object. (See [Readable Stream][]). - -Be aware that, unlike the default value set for `highWaterMark` on a -readable stream (16 kb), the stream returned by this method has a -default value of 64 kb for the same parameter. - -`options` is an object or string with the following defaults: - -```js -{ - flags: 'r', - encoding: null, - fd: null, - mode: 0o666, - autoClose: true -} -``` - -`options` can include `start` and `end` values to read a range of bytes from -the file instead of the entire file. Both `start` and `end` are inclusive and -start at 0. The `encoding` can be any one of those accepted by [`Buffer`][]. - -If `fd` is specified, `ReadStream` will ignore the `path` argument and will use -the specified file descriptor. This means that no `'open'` event will be emitted. -Note that `fd` should be blocking; non-blocking `fd`s should be passed to -[`net.Socket`][]. - -If `autoClose` is false, then the file descriptor won't be closed, even if -there's an error. It is your responsibility to close it and make sure -there's no file descriptor leak. If `autoClose` is set to true (default -behavior), on `error` or `end` the file descriptor will be closed -automatically. - -`mode` sets the file mode (permission and sticky bits), but only if the -file was created. - -An example to read the last 10 bytes of a file which is 100 bytes long: - -```js -fs.createReadStream('sample.txt', {start: 90, end: 99}); -``` - -If `options` is a string, then it specifies the encoding. - -## fs.createWriteStream(path[, options]) - -Returns a new [`WriteStream`][] object. (See [Writable Stream][]). - -`options` is an object or string with the following defaults: - -```js -{ - flags: 'w', - defaultEncoding: 'utf8', - fd: null, - mode: 0o666, - autoClose: true -} -``` - -`options` may also include a `start` option to allow writing data at -some position past the beginning of the file. Modifying a file rather -than replacing it may require a `flags` mode of `r+` rather than the -default mode `w`. The `defaultEncoding` can be any one of those accepted by [`Buffer`][]. - -If `autoClose` is set to true (default behavior) on `error` or `end` -the file descriptor will be closed automatically. If `autoClose` is false, -then the file descriptor won't be closed, even if there's an error. -It is your responsibility to close it and make sure -there's no file descriptor leak. - -Like [`ReadStream`][], if `fd` is specified, `WriteStream` will ignore the -`path` argument and will use the specified file descriptor. This means that no -`'open'` event will be emitted. Note that `fd` should be blocking; non-blocking -`fd`s should be passed to [`net.Socket`][]. - -If `options` is a string, then it specifies the encoding. - -## fs.exists(path, callback) - - Stability: 0 - Deprecated: Use [`fs.stat()`][] or [`fs.access()`][] instead. - -Test whether or not the given path exists by checking with the file system. -Then call the `callback` argument with either true or false. Example: - -```js -fs.exists('/etc/passwd', (exists) => { - console.log(exists ? 'it\'s there' : 'no passwd!'); -}); -``` - -`fs.exists()` should not be used to check if a file exists before calling -`fs.open()`. Doing so introduces a race condition since other processes may -change the file's state between the two calls. Instead, user code should -call `fs.open()` directly and handle the error raised if the file is -non-existent. - -## fs.existsSync(path) - - Stability: 0 - Deprecated: Use [`fs.statSync()`][] or [`fs.accessSync()`][] instead. - -Synchronous version of [`fs.exists()`][]. -Returns `true` if the file exists, `false` otherwise. - -## fs.fchmod(fd, mode, callback) - -Asynchronous fchmod(2). No arguments other than a possible exception -are given to the completion callback. - -## fs.fchmodSync(fd, mode) - -Synchronous fchmod(2). Returns `undefined`. - -## fs.fchown(fd, uid, gid, callback) - -Asynchronous fchown(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.fchownSync(fd, uid, gid) - -Synchronous fchown(2). Returns `undefined`. - -## fs.fdatasync(fd, callback) - -Asynchronous fdatasync(2). No arguments other than a possible exception are -given to the completion callback. - -## fs.fdatasyncSync(fd) - -Synchronous fdatasync(2). Returns `undefined`. - -## fs.fstat(fd, callback) - -Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where -`stats` is a `fs.Stats` object. `fstat()` is identical to [`stat()`][], except that -the file to be stat-ed is specified by the file descriptor `fd`. - -## fs.fstatSync(fd) - -Synchronous fstat(2). Returns an instance of `fs.Stats`. - -## fs.fsync(fd, callback) - -Asynchronous fsync(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.fsyncSync(fd) - -Synchronous fsync(2). Returns `undefined`. - -## fs.ftruncate(fd, len, callback) - -Asynchronous ftruncate(2). No arguments other than a possible exception are -given to the completion callback. - -## fs.ftruncateSync(fd, len) - -Synchronous ftruncate(2). Returns `undefined`. - -## fs.futimes(fd, atime, mtime, callback) - -Change the file timestamps of a file referenced by the supplied file -descriptor. - -## fs.futimesSync(fd, atime, mtime) - -Synchronous version of [`fs.futimes()`][]. Returns `undefined`. - -## fs.lchmod(path, mode, callback) - -Asynchronous lchmod(2). No arguments other than a possible exception -are given to the completion callback. - -Only available on Mac OS X. - -## fs.lchmodSync(path, mode) - -Synchronous lchmod(2). Returns `undefined`. - -## fs.lchown(path, uid, gid, callback) - -Asynchronous lchown(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.lchownSync(path, uid, gid) - -Synchronous lchown(2). Returns `undefined`. - -## fs.link(srcpath, dstpath, callback) - -Asynchronous link(2). No arguments other than a possible exception are given to -the completion callback. - -## fs.linkSync(srcpath, dstpath) - -Synchronous link(2). Returns `undefined`. - -## fs.lstat(path, callback) - -Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where -`stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if -`path` is a symbolic link, then the link itself is stat-ed, not the file that it -refers to. - -## fs.lstatSync(path) - -Synchronous lstat(2). Returns an instance of `fs.Stats`. - -## fs.mkdir(path[, mode], callback) - -Asynchronous mkdir(2). No arguments other than a possible exception are given -to the completion callback. `mode` defaults to `0o777`. - -## fs.mkdirSync(path[, mode]) - -Synchronous mkdir(2). Returns `undefined`. - -## fs.mkdtemp(prefix, callback) - -Creates a unique temporary directory. - -Generates six random characters to be appended behind a required -`prefix` to create a unique temporary directory. - -The created folder path is passed as a string to the callback's second -parameter. - -Example: - -```js -fs.mkdtemp('/tmp/foo-', (err, folder) => { - console.log(folder); - // Prints: /tmp/foo-itXde2 -}); -``` - -## fs.mkdtempSync(template) - -The synchronous version of [`fs.mkdtemp()`][]. Returns the created -folder path. - -## fs.open(path, flags[, mode], callback) - -Asynchronous file open. See open(2). `flags` can be: - -* `'r'` - Open file for reading. -An exception occurs if the file does not exist. - -* `'r+'` - Open file for reading and writing. -An exception occurs if the file does not exist. - -* `'rs'` - Open file for reading in synchronous mode. Instructs the operating - system to bypass the local file system cache. - - This is primarily useful for opening files on NFS mounts as it allows you to - skip the potentially stale local cache. It has a very real impact on I/O - performance so don't use this flag unless you need it. - - Note that this doesn't turn `fs.open()` into a synchronous blocking call. - If that's what you want then you should be using `fs.openSync()` - -* `'rs+'` - Open file for reading and writing, telling the OS to open it - synchronously. See notes for `'rs'` about using this with caution. - -* `'w'` - Open file for writing. -The file is created (if it does not exist) or truncated (if it exists). - -* `'wx'` - Like `'w'` but fails if `path` exists. - -* `'w+'` - Open file for reading and writing. -The file is created (if it does not exist) or truncated (if it exists). - -* `'wx+'` - Like `'w+'` but fails if `path` exists. - -* `'a'` - Open file for appending. -The file is created if it does not exist. - -* `'ax'` - Like `'a'` but fails if `path` exists. - -* `'a+'` - Open file for reading and appending. -The file is created if it does not exist. - -* `'ax+'` - Like `'a+'` but fails if `path` exists. - -`mode` sets the file mode (permission and sticky bits), but only if the file was -created. It defaults to `0666`, readable and writable. - -The callback gets two arguments `(err, fd)`. - -The exclusive flag `'x'` (`O_EXCL` flag in open(2)) ensures that `path` is newly -created. On POSIX systems, `path` is considered to exist even if it is a symlink -to a non-existent file. The exclusive flag may or may not work with network file -systems. - -`flags` can also be a number as documented by open(2); commonly used constants -are available from `require('constants')`. On Windows, flags are translated to -their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`, -or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW. - -On Linux, positional writes don't work when the file is opened in append mode. -The kernel ignores the position argument and always appends the data to -the end of the file. - -## fs.openSync(path, flags[, mode]) - -Synchronous version of [`fs.open()`][]. Returns an integer representing the file -descriptor. - -## fs.read(fd, buffer, offset, length, position, callback) - -Read data from the file specified by `fd`. - -`buffer` is the buffer that the data will be written to. - -`offset` is the offset in the buffer to start writing at. - -`length` is an integer specifying the number of bytes to read. - -`position` is an integer specifying where to begin reading from in the file. -If `position` is `null`, data will be read from the current file position. - -The callback is given the three arguments, `(err, bytesRead, buffer)`. - -## fs.readdir(path, callback) - -Asynchronous readdir(3). Reads the contents of a directory. -The callback gets two arguments `(err, files)` where `files` is an array of -the names of the files in the directory excluding `'.'` and `'..'`. - -## fs.readdirSync(path) - -Synchronous readdir(3). Returns an array of filenames excluding `'.'` and -`'..'`. - -## fs.readFile(file[, options], callback) - -* `file` {String | Integer} filename or file descriptor -* `options` {Object | String} - * `encoding` {String | Null} default = `null` - * `flag` {String} default = `'r'` -* `callback` {Function} - -Asynchronously reads the entire contents of a file. Example: - -```js -fs.readFile('/etc/passwd', (err, data) => { - if (err) throw err; - console.log(data); -}); -``` - -The callback is passed two arguments `(err, data)`, where `data` is the -contents of the file. - -If no encoding is specified, then the raw buffer is returned. - -If `options` is a string, then it specifies the encoding. Example: - -```js -fs.readFile('/etc/passwd', 'utf8', callback); -``` - -Any specified file descriptor has to support reading. - -_Note: Specified file descriptors will not be closed automatically._ - -## fs.readFileSync(file[, options]) - -Synchronous version of [`fs.readFile`][]. Returns the contents of the `file`. - -If the `encoding` option is specified then this function returns a -string. Otherwise it returns a buffer. - -## fs.readlink(path, callback) - -Asynchronous readlink(2). The callback gets two arguments `(err, -linkString)`. - -## fs.readlinkSync(path) - -Synchronous readlink(2). Returns the symbolic link's string value. - -## fs.realpath(path[, cache], callback) - -Asynchronous realpath(2). The `callback` gets two arguments `(err, -resolvedPath)`. May use `process.cwd` to resolve relative paths. `cache` is an -object literal of mapped paths that can be used to force a specific path -resolution or avoid additional `fs.stat` calls for known real paths. - -Example: - -```js -var cache = {'/etc':'/private/etc'}; -fs.realpath('/etc/passwd', cache, (err, resolvedPath) => { - if (err) throw err; - console.log(resolvedPath); -}); -``` - -## fs.readSync(fd, buffer, offset, length, position) - -Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. - -## fs.realpathSync(path[, cache]) - -Synchronous realpath(2). Returns the resolved path. `cache` is an -object literal of mapped paths that can be used to force a specific path -resolution or avoid additional `fs.stat` calls for known real paths. - -## fs.rename(oldPath, newPath, callback) - -Asynchronous rename(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.renameSync(oldPath, newPath) - -Synchronous rename(2). Returns `undefined`. - -## fs.rmdir(path, callback) - -Asynchronous rmdir(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.rmdirSync(path) - -Synchronous rmdir(2). Returns `undefined`. - -## fs.stat(path, callback) - -Asynchronous stat(2). The callback gets two arguments `(err, stats)` where -`stats` is a [`fs.Stats`][] object. See the [`fs.Stats`][] section for more -information. - -## fs.statSync(path) - -Synchronous stat(2). Returns an instance of [`fs.Stats`][]. - -## fs.symlink(target, path[, type], callback) - -Asynchronous symlink(2). No arguments other than a possible exception are given -to the completion callback. -The `type` argument can be set to `'dir'`, `'file'`, or `'junction'` (default -is `'file'`) and is only available on Windows (ignored on other platforms). -Note that Windows junction points require the destination path to be absolute. When using -`'junction'`, the `target` argument will automatically be normalized to absolute path. - -Here is an example below: - -```js -fs.symlink('./foo', './new-port'); -``` - -It creates a symbolic link named "new-port" that points to "foo". - -## fs.symlinkSync(target, path[, type]) - -Synchronous symlink(2). Returns `undefined`. - -## fs.truncate(path, len, callback) - -Asynchronous truncate(2). No arguments other than a possible exception are -given to the completion callback. A file descriptor can also be passed as the -first argument. In this case, `fs.ftruncate()` is called. - -## fs.truncateSync(path, len) - -Synchronous truncate(2). Returns `undefined`. - -## fs.unlink(path, callback) - -Asynchronous unlink(2). No arguments other than a possible exception are given -to the completion callback. - -## fs.unlinkSync(path) - -Synchronous unlink(2). Returns `undefined`. - -## fs.unwatchFile(filename[, listener]) - -Stop watching for changes on `filename`. If `listener` is specified, only that -particular listener is removed. Otherwise, *all* listeners are removed and you -have effectively stopped watching `filename`. - -Calling `fs.unwatchFile()` with a filename that is not being watched is a -no-op, not an error. - -_Note: [`fs.watch()`][] is more efficient than `fs.watchFile()` and `fs.unwatchFile()`. -`fs.watch()` should be used instead of `fs.watchFile()` and `fs.unwatchFile()` -when possible._ - -## fs.utimes(path, atime, mtime, callback) - -Change file timestamps of the file referenced by the supplied path. - -Note: the arguments `atime` and `mtime` of the following related functions does -follow the below rules: - -- If the value is a numberable string like `'123456789'`, the value would get - converted to corresponding number. -- If the value is `NaN` or `Infinity`, the value would get converted to - `Date.now()`. - -## fs.utimesSync(path, atime, mtime) - -Synchronous version of [`fs.utimes()`][]. Returns `undefined`. - -## fs.watch(filename[, options][, listener]) - -Watch for changes on `filename`, where `filename` is either a file or a -directory. The returned object is a [`fs.FSWatcher`][]. - -The second argument is optional. The `options` if provided should be an object. -The supported boolean members are `persistent` and `recursive`. `persistent` -indicates whether the process should continue to run as long as files are being -watched. `recursive` indicates whether all subdirectories should be watched, or -only the current directory. This applies when a directory is specified, and only -on supported platforms (See [Caveats][]). - -The default is `{ persistent: true, recursive: false }`. - -The listener callback gets two arguments `(event, filename)`. `event` is either -`'rename'` or `'change'`, and `filename` is the name of the file which triggered -the event. - -### Caveats - - - -The `fs.watch` API is not 100% consistent across platforms, and is -unavailable in some situations. - -The recursive option is only supported on OS X and Windows. - -#### Availability - - - -This feature depends on the underlying operating system providing a way -to be notified of filesystem changes. - -* On Linux systems, this uses `inotify`. -* On BSD systems, this uses `kqueue`. -* On OS X, this uses `kqueue` for files and 'FSEvents' for directories. -* On SunOS systems (including Solaris and SmartOS), this uses `event ports`. -* On Windows systems, this feature depends on `ReadDirectoryChangesW`. - -If the underlying functionality is not available for some reason, then -`fs.watch` will not be able to function. For example, watching files or -directories on network file systems (NFS, SMB, etc.) often doesn't work -reliably or at all. - -You can still use `fs.watchFile`, which uses stat polling, but it is slower and -less reliable. - -#### Filename Argument - - - -Providing `filename` argument in the callback is only supported on Linux and -Windows. Even on supported platforms, `filename` is not always guaranteed to -be provided. Therefore, don't assume that `filename` argument is always -provided in the callback, and have some fallback logic if it is null. - -```js -fs.watch('somedir', (event, filename) => { - console.log(`event is: ${event}`); - if (filename) { - console.log(`filename provided: ${filename}`); - } else { - console.log('filename not provided'); - } -}); -``` - -## fs.watchFile(filename[, options], listener) - -Watch for changes on `filename`. The callback `listener` will be called each -time the file is accessed. - -The `options` argument may be omitted. If provided, it should be an object. The -`options` object may contain a boolean named `persistent` that indicates -whether the process should continue to run as long as files are being watched. -The `options` object may specify an `interval` property indicating how often the -target should be polled in milliseconds. The default is -`{ persistent: true, interval: 5007 }`. - -The `listener` gets two arguments the current stat object and the previous -stat object: - -```js -fs.watchFile('message.text', (curr, prev) => { - console.log(`the current mtime is: ${curr.mtime}`); - console.log(`the previous mtime was: ${prev.mtime}`); -}); -``` - -These stat objects are instances of `fs.Stat`. - -If you want to be notified when the file was modified, not just accessed, -you need to compare `curr.mtime` and `prev.mtime`. - -_Note: when an `fs.watchFile` operation results in an `ENOENT` error, it will - invoke the listener once, with all the fields zeroed (or, for dates, the Unix - Epoch). In Windows, `blksize` and `blocks` fields will be `undefined`, instead - of zero. If the file is created later on, the listener will be called again, - with the latest stat objects. This is a change in functionality since v0.10._ - -_Note: [`fs.watch()`][] is more efficient than `fs.watchFile` and `fs.unwatchFile`. -`fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` -when possible._ - -## fs.write(fd, buffer, offset, length[, position], callback) - -Write `buffer` to the file specified by `fd`. - -`offset` and `length` determine the part of the buffer to be written. - -`position` refers to the offset from the beginning of the file where this data -should be written. If `typeof position !== 'number'`, the data will be written -at the current position. See pwrite(2). - -The callback will be given three arguments `(err, written, buffer)` where -`written` specifies how many _bytes_ were written from `buffer`. - -Note that it is unsafe to use `fs.write` multiple times on the same file -without waiting for the callback. For this scenario, -`fs.createWriteStream` is strongly recommended. - -On Linux, positional writes don't work when the file is opened in append mode. -The kernel ignores the position argument and always appends the data to -the end of the file. - -## fs.write(fd, data[, position[, encoding]], callback) - -Write `data` to the file specified by `fd`. If `data` is not a Buffer instance -then the value will be coerced to a string. - -`position` refers to the offset from the beginning of the file where this data -should be written. If `typeof position !== 'number'` the data will be written at -the current position. See pwrite(2). - -`encoding` is the expected string encoding. - -The callback will receive the arguments `(err, written, string)` where `written` -specifies how many _bytes_ the passed string required to be written. Note that -bytes written is not the same as string characters. See [`Buffer.byteLength`][]. - -Unlike when writing `buffer`, the entire string must be written. No substring -may be specified. This is because the byte offset of the resulting data may not -be the same as the string offset. - -Note that it is unsafe to use `fs.write` multiple times on the same file -without waiting for the callback. For this scenario, -`fs.createWriteStream` is strongly recommended. - -On Linux, positional writes don't work when the file is opened in append mode. -The kernel ignores the position argument and always appends the data to -the end of the file. - -## fs.writeFile(file, data[, options], callback) - -* `file` {String | Integer} filename or file descriptor -* `data` {String | Buffer} -* `options` {Object | String} - * `encoding` {String | Null} default = `'utf8'` - * `mode` {Number} default = `0o666` - * `flag` {String} default = `'w'` -* `callback` {Function} - -Asynchronously writes data to a file, replacing the file if it already exists. -`data` can be a string or a buffer. - -The `encoding` option is ignored if `data` is a buffer. It defaults -to `'utf8'`. - -Example: - -```js -fs.writeFile('message.txt', 'Hello Node.js', (err) => { - if (err) throw err; - console.log('It\'s saved!'); -}); -``` - -If `options` is a string, then it specifies the encoding. Example: - -```js -fs.writeFile('message.txt', 'Hello Node.js', 'utf8', callback); -``` - -Any specified file descriptor has to support writing. - -Note that it is unsafe to use `fs.writeFile` multiple times on the same file -without waiting for the callback. For this scenario, -`fs.createWriteStream` is strongly recommended. - -_Note: Specified file descriptors will not be closed automatically._ - -## fs.writeFileSync(file, data[, options]) - -The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. - -## fs.writeSync(fd, buffer, offset, length[, position]) - -## fs.writeSync(fd, data[, position[, encoding]]) - -Synchronous versions of [`fs.write()`][]. Returns the number of bytes written. - -[`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding -[`Buffer`]: buffer.html#buffer_buffer -[Caveats]: #fs_caveats -[`fs.access()`]: #fs_fs_access_path_mode_callback -[`fs.accessSync()`]: #fs_fs_accesssync_path_mode -[`fs.appendFile()`]: fs.html#fs_fs_appendfile_file_data_options_callback -[`fs.exists()`]: fs.html#fs_fs_exists_path_callback -[`fs.fstat()`]: #fs_fs_fstat_fd_callback -[`fs.FSWatcher`]: #fs_class_fs_fswatcher -[`fs.futimes()`]: #fs_fs_futimes_fd_atime_mtime_callback -[`fs.lstat()`]: #fs_fs_lstat_path_callback -[`fs.open()`]: #fs_fs_open_path_flags_mode_callback -[`fs.read()`]: #fs_fs_read_fd_buffer_offset_length_position_callback -[`fs.readFile`]: #fs_fs_readfile_file_options_callback -[`fs.stat()`]: #fs_fs_stat_path_callback -[`fs.Stats`]: #fs_class_fs_stats -[`fs.statSync()`]: #fs_fs_statsync_path -[`fs.utimes()`]: #fs_fs_futimes_fd_atime_mtime_callback -[`fs.watch()`]: #fs_fs_watch_filename_options_listener -[`fs.write()`]: #fs_fs_write_fd_buffer_offset_length_position_callback -[`fs.writeFile()`]: #fs_fs_writefile_file_data_options_callback -[`net.Socket`]: net.html#net_class_net_socket -[`ReadStream`]: #fs_class_fs_readstream -[`stat()`]: fs.html#fs_fs_stat_path_callback -[`util.inspect(stats)`]: util.html#util_util_inspect_object_options -[`WriteStream`]: #fs_class_fs_writestream -[MDN-Date-getTime]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getTime -[MDN-Date]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date -[Readable Stream]: stream.html#stream_class_stream_readable -[Writable Stream]: stream.html#stream_class_stream_writable diff --git a/doc/api/fs.md b/doc/api/fs.md new file mode 100644 index 00000000000000..0c427ef1319ea3 --- /dev/null +++ b/doc/api/fs.md @@ -0,0 +1,1078 @@ +# File System + + Stability: 2 - Stable + + + +File I/O is provided by simple wrappers around standard POSIX functions. To +use this module do `require('fs')`. All the methods have asynchronous and +synchronous forms. + +The asynchronous form always takes a completion callback as its last argument. +The arguments passed to the completion callback depend on the method, but the +first argument is always reserved for an exception. If the operation was +completed successfully, then the first argument will be `null` or `undefined`. + +When using the synchronous form any exceptions are immediately thrown. +You can use try/catch to handle exceptions or allow them to bubble up. + +Here is an example of the asynchronous version: + +```js +const fs = require('fs'); + +fs.unlink('/tmp/hello', (err) => { + if (err) throw err; + console.log('successfully deleted /tmp/hello'); +}); +``` + +Here is the synchronous version: + +```js +const fs = require('fs'); + +fs.unlinkSync('/tmp/hello'); +console.log('successfully deleted /tmp/hello'); +``` + +With the asynchronous methods there is no guaranteed ordering. So the +following is prone to error: + +```js +fs.rename('/tmp/hello', '/tmp/world', (err) => { + if (err) throw err; + console.log('renamed complete'); +}); +fs.stat('/tmp/world', (err, stats) => { + if (err) throw err; + console.log(`stats: ${JSON.stringify(stats)}`); +}); +``` + +It could be that `fs.stat` is executed before `fs.rename`. +The correct way to do this is to chain the callbacks. + +```js +fs.rename('/tmp/hello', '/tmp/world', (err) => { + if (err) throw err; + fs.stat('/tmp/world', (err, stats) => { + if (err) throw err; + console.log(`stats: ${JSON.stringify(stats)}`); + }); +}); +``` + +In busy processes, the programmer is _strongly encouraged_ to use the +asynchronous versions of these calls. The synchronous versions will block +the entire process until they complete--halting all connections. + +The relative path to a filename can be used. Remember, however, that this path +will be relative to `process.cwd()`. + +Most fs functions let you omit the callback argument. If you do, a default +callback is used that rethrows errors. To get a trace to the original call +site, set the `NODE_DEBUG` environment variable: + +``` +$ cat script.js +function bad() { + require('fs').readFile('/'); +} +bad(); + +$ env NODE_DEBUG=fs node script.js +fs.js:66 + throw err; + ^ +Error: EISDIR, read + at rethrow (fs.js:61:21) + at maybeCallback (fs.js:79:42) + at Object.fs.readFile (fs.js:153:18) + at bad (/path/to/script.js:2:17) + at Object. (/path/to/script.js:5:1) + +``` + +## Buffer API + +`fs` functions support passing and receiving paths as both strings +and Buffers. The latter is intended to make it possible to work with +filesystems that allow for non-UTF-8 filenames. For most typical +uses, working with paths as Buffers will be unnecessary, as the string +API converts to and from UTF-8 automatically. + +*Note* that on certain file systems (such as NTFS and HFS+) filenames +will always be encoded as UTF-8. On such file systems, passing +non-UTF-8 encoded Buffers to `fs` functions will not work as expected. + +## Class: fs.FSWatcher + +Objects returned from `fs.watch()` are of this type. + +### Event: 'change' + +* `event` {String} The type of fs change +* `filename` {String} The filename that changed (if relevant/available) + +Emitted when something changes in a watched directory or file. +See more details in [`fs.watch()`][]. + +### Event: 'error' + +* `error` {Error} + +Emitted when an error occurs. + +### watcher.close() + +Stop watching for changes on the given `fs.FSWatcher`. + +## Class: fs.ReadStream + +`ReadStream` is a [Readable Stream][]. + +### Event: 'open' + +* `fd` {Number} Integer file descriptor used by the ReadStream. + +Emitted when the ReadStream's file is opened. + +### readStream.path + +The path to the file the stream is reading from. + +## Class: fs.Stats + +Objects returned from [`fs.stat()`][], [`fs.lstat()`][] and [`fs.fstat()`][] and their +synchronous counterparts are of this type. + + - `stats.isFile()` + - `stats.isDirectory()` + - `stats.isBlockDevice()` + - `stats.isCharacterDevice()` + - `stats.isSymbolicLink()` (only valid with [`fs.lstat()`][]) + - `stats.isFIFO()` + - `stats.isSocket()` + +For a regular file [`util.inspect(stats)`][] would return a string very +similar to this: + +```js +{ + dev: 2114, + ino: 48064969, + mode: 33188, + nlink: 1, + uid: 85, + gid: 100, + rdev: 0, + size: 527, + blksize: 4096, + blocks: 8, + atime: Mon, 10 Oct 2011 23:24:11 GMT, + mtime: Mon, 10 Oct 2011 23:24:11 GMT, + ctime: Mon, 10 Oct 2011 23:24:11 GMT, + birthtime: Mon, 10 Oct 2011 23:24:11 GMT +} +``` + +Please note that `atime`, `mtime`, `birthtime`, and `ctime` are +instances of [`Date`][MDN-Date] object and to compare the values of +these objects you should use appropriate methods. For most general +uses [`getTime()`][MDN-Date-getTime] will return the number of +milliseconds elapsed since _1 January 1970 00:00:00 UTC_ and this +integer should be sufficient for any comparison, however there are +additional methods which can be used for displaying fuzzy information. +More details can be found in the [MDN JavaScript Reference][MDN-Date] +page. + +### Stat Time Values + +The times in the stat object have the following semantics: + +* `atime` "Access Time" - Time when file data last accessed. Changed + by the `mknod(2)`, `utimes(2)`, and `read(2)` system calls. +* `mtime` "Modified Time" - Time when file data last modified. + Changed by the `mknod(2)`, `utimes(2)`, and `write(2)` system calls. +* `ctime` "Change Time" - Time when file status was last changed + (inode data modification). Changed by the `chmod(2)`, `chown(2)`, + `link(2)`, `mknod(2)`, `rename(2)`, `unlink(2)`, `utimes(2)`, + `read(2)`, and `write(2)` system calls. +* `birthtime` "Birth Time" - Time of file creation. Set once when the + file is created. On filesystems where birthtime is not available, + this field may instead hold either the `ctime` or + `1970-01-01T00:00Z` (ie, unix epoch timestamp `0`). Note that this + value may be greater than `atime` or `mtime` in this case. On Darwin + and other FreeBSD variants, also set if the `atime` is explicitly + set to an earlier value than the current `birthtime` using the + `utimes(2)` system call. + +Prior to Node v0.12, the `ctime` held the `birthtime` on Windows +systems. Note that as of v0.12, `ctime` is not "creation time", and +on Unix systems, it never was. + +## Class: fs.WriteStream + +`WriteStream` is a [Writable Stream][]. + +### Event: 'open' + +* `fd` {Number} Integer file descriptor used by the WriteStream. + +Emitted when the WriteStream's file is opened. + +### writeStream.bytesWritten + +The number of bytes written so far. Does not include data that is still queued +for writing. + +### writeStream.path + +The path to the file the stream is writing to. + +## fs.access(path[, mode], callback) + +Tests a user's permissions for the file specified by `path`. `mode` is an +optional integer that specifies the accessibility checks to be performed. The +following constants define the possible values of `mode`. It is possible to +create a mask consisting of the bitwise OR of two or more values. + +- `fs.F_OK` - File is visible to the calling process. This is useful for +determining if a file exists, but says nothing about `rwx` permissions. +Default if no `mode` is specified. +- `fs.R_OK` - File can be read by the calling process. +- `fs.W_OK` - File can be written by the calling process. +- `fs.X_OK` - File can be executed by the calling process. This has no effect +on Windows (will behave like `fs.F_OK`). + +The final argument, `callback`, is a callback function that is invoked with +a possible error argument. If any of the accessibility checks fail, the error +argument will be populated. The following example checks if the file +`/etc/passwd` can be read and written by the current process. + +```js +fs.access('/etc/passwd', fs.R_OK | fs.W_OK, (err) => { + console.log(err ? 'no access!' : 'can read/write'); +}); +``` + +## fs.accessSync(path[, mode]) + +Synchronous version of [`fs.access()`][]. This throws if any accessibility checks +fail, and does nothing otherwise. + +## fs.appendFile(file, data[, options], callback) + +* `file` {String|Number} filename or file descriptor +* `data` {String|Buffer} +* `options` {Object|String} + * `encoding` {String|Null} default = `'utf8'` + * `mode` {Number} default = `0o666` + * `flag` {String} default = `'a'` +* `callback` {Function} + +Asynchronously append data to a file, creating the file if it does not yet exist. +`data` can be a string or a buffer. + +Example: + +```js +fs.appendFile('message.txt', 'data to append', (err) => { + if (err) throw err; + console.log('The "data to append" was appended to file!'); +}); +``` + +If `options` is a string, then it specifies the encoding. Example: + +```js +fs.appendFile('message.txt', 'data to append', 'utf8', callback); +``` + +Any specified file descriptor has to have been opened for appending. + +_Note: Specified file descriptors will not be closed automatically._ + +## fs.appendFileSync(file, data[, options]) + +The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. + +## fs.chmod(path, mode, callback) + +Asynchronous chmod(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.chmodSync(path, mode) + +Synchronous chmod(2). Returns `undefined`. + +## fs.chown(path, uid, gid, callback) + +Asynchronous chown(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.chownSync(path, uid, gid) + +Synchronous chown(2). Returns `undefined`. + +## fs.close(fd, callback) + +Asynchronous close(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.closeSync(fd) + +Synchronous close(2). Returns `undefined`. + +## fs.createReadStream(path[, options]) + +Returns a new [`ReadStream`][] object. (See [Readable Stream][]). + +Be aware that, unlike the default value set for `highWaterMark` on a +readable stream (16 kb), the stream returned by this method has a +default value of 64 kb for the same parameter. + +`options` is an object or string with the following defaults: + +```js +{ + flags: 'r', + encoding: null, + fd: null, + mode: 0o666, + autoClose: true +} +``` + +`options` can include `start` and `end` values to read a range of bytes from +the file instead of the entire file. Both `start` and `end` are inclusive and +start at 0. The `encoding` can be any one of those accepted by [`Buffer`][]. + +If `fd` is specified, `ReadStream` will ignore the `path` argument and will use +the specified file descriptor. This means that no `'open'` event will be emitted. +Note that `fd` should be blocking; non-blocking `fd`s should be passed to +[`net.Socket`][]. + +If `autoClose` is false, then the file descriptor won't be closed, even if +there's an error. It is your responsibility to close it and make sure +there's no file descriptor leak. If `autoClose` is set to true (default +behavior), on `error` or `end` the file descriptor will be closed +automatically. + +`mode` sets the file mode (permission and sticky bits), but only if the +file was created. + +An example to read the last 10 bytes of a file which is 100 bytes long: + +```js +fs.createReadStream('sample.txt', {start: 90, end: 99}); +``` + +If `options` is a string, then it specifies the encoding. + +## fs.createWriteStream(path[, options]) + +Returns a new [`WriteStream`][] object. (See [Writable Stream][]). + +`options` is an object or string with the following defaults: + +```js +{ + flags: 'w', + defaultEncoding: 'utf8', + fd: null, + mode: 0o666, + autoClose: true +} +``` + +`options` may also include a `start` option to allow writing data at +some position past the beginning of the file. Modifying a file rather +than replacing it may require a `flags` mode of `r+` rather than the +default mode `w`. The `defaultEncoding` can be any one of those accepted by [`Buffer`][]. + +If `autoClose` is set to true (default behavior) on `error` or `end` +the file descriptor will be closed automatically. If `autoClose` is false, +then the file descriptor won't be closed, even if there's an error. +It is your responsibility to close it and make sure +there's no file descriptor leak. + +Like [`ReadStream`][], if `fd` is specified, `WriteStream` will ignore the +`path` argument and will use the specified file descriptor. This means that no +`'open'` event will be emitted. Note that `fd` should be blocking; non-blocking +`fd`s should be passed to [`net.Socket`][]. + +If `options` is a string, then it specifies the encoding. + +## fs.exists(path, callback) + + Stability: 0 - Deprecated: Use [`fs.stat()`][] or [`fs.access()`][] instead. + +Test whether or not the given path exists by checking with the file system. +Then call the `callback` argument with either true or false. Example: + +```js +fs.exists('/etc/passwd', (exists) => { + console.log(exists ? 'it\'s there' : 'no passwd!'); +}); +``` + +`fs.exists()` should not be used to check if a file exists before calling +`fs.open()`. Doing so introduces a race condition since other processes may +change the file's state between the two calls. Instead, user code should +call `fs.open()` directly and handle the error raised if the file is +non-existent. + +## fs.existsSync(path) + + Stability: 0 - Deprecated: Use [`fs.statSync()`][] or [`fs.accessSync()`][] instead. + +Synchronous version of [`fs.exists()`][]. +Returns `true` if the file exists, `false` otherwise. + +## fs.fchmod(fd, mode, callback) + +Asynchronous fchmod(2). No arguments other than a possible exception +are given to the completion callback. + +## fs.fchmodSync(fd, mode) + +Synchronous fchmod(2). Returns `undefined`. + +## fs.fchown(fd, uid, gid, callback) + +Asynchronous fchown(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.fchownSync(fd, uid, gid) + +Synchronous fchown(2). Returns `undefined`. + +## fs.fdatasync(fd, callback) + +Asynchronous fdatasync(2). No arguments other than a possible exception are +given to the completion callback. + +## fs.fdatasyncSync(fd) + +Synchronous fdatasync(2). Returns `undefined`. + +## fs.fstat(fd, callback) + +Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where +`stats` is a `fs.Stats` object. `fstat()` is identical to [`stat()`][], except that +the file to be stat-ed is specified by the file descriptor `fd`. + +## fs.fstatSync(fd) + +Synchronous fstat(2). Returns an instance of `fs.Stats`. + +## fs.fsync(fd, callback) + +Asynchronous fsync(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.fsyncSync(fd) + +Synchronous fsync(2). Returns `undefined`. + +## fs.ftruncate(fd, len, callback) + +Asynchronous ftruncate(2). No arguments other than a possible exception are +given to the completion callback. + +## fs.ftruncateSync(fd, len) + +Synchronous ftruncate(2). Returns `undefined`. + +## fs.futimes(fd, atime, mtime, callback) + +Change the file timestamps of a file referenced by the supplied file +descriptor. + +## fs.futimesSync(fd, atime, mtime) + +Synchronous version of [`fs.futimes()`][]. Returns `undefined`. + +## fs.lchmod(path, mode, callback) + +Asynchronous lchmod(2). No arguments other than a possible exception +are given to the completion callback. + +Only available on Mac OS X. + +## fs.lchmodSync(path, mode) + +Synchronous lchmod(2). Returns `undefined`. + +## fs.lchown(path, uid, gid, callback) + +Asynchronous lchown(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.lchownSync(path, uid, gid) + +Synchronous lchown(2). Returns `undefined`. + +## fs.link(srcpath, dstpath, callback) + +Asynchronous link(2). No arguments other than a possible exception are given to +the completion callback. + +## fs.linkSync(srcpath, dstpath) + +Synchronous link(2). Returns `undefined`. + +## fs.lstat(path, callback) + +Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where +`stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if +`path` is a symbolic link, then the link itself is stat-ed, not the file that it +refers to. + +## fs.lstatSync(path) + +Synchronous lstat(2). Returns an instance of `fs.Stats`. + +## fs.mkdir(path[, mode], callback) + +Asynchronous mkdir(2). No arguments other than a possible exception are given +to the completion callback. `mode` defaults to `0o777`. + +## fs.mkdirSync(path[, mode]) + +Synchronous mkdir(2). Returns `undefined`. + +## fs.mkdtemp(prefix, callback) + +Creates a unique temporary directory. + +Generates six random characters to be appended behind a required +`prefix` to create a unique temporary directory. + +The created folder path is passed as a string to the callback's second +parameter. + +Example: + +```js +fs.mkdtemp('/tmp/foo-', (err, folder) => { + console.log(folder); + // Prints: /tmp/foo-itXde2 +}); +``` + +## fs.mkdtempSync(template) + +The synchronous version of [`fs.mkdtemp()`][]. Returns the created +folder path. + +## fs.open(path, flags[, mode], callback) + +Asynchronous file open. See open(2). `flags` can be: + +* `'r'` - Open file for reading. +An exception occurs if the file does not exist. + +* `'r+'` - Open file for reading and writing. +An exception occurs if the file does not exist. + +* `'rs'` - Open file for reading in synchronous mode. Instructs the operating + system to bypass the local file system cache. + + This is primarily useful for opening files on NFS mounts as it allows you to + skip the potentially stale local cache. It has a very real impact on I/O + performance so don't use this flag unless you need it. + + Note that this doesn't turn `fs.open()` into a synchronous blocking call. + If that's what you want then you should be using `fs.openSync()` + +* `'rs+'` - Open file for reading and writing, telling the OS to open it + synchronously. See notes for `'rs'` about using this with caution. + +* `'w'` - Open file for writing. +The file is created (if it does not exist) or truncated (if it exists). + +* `'wx'` - Like `'w'` but fails if `path` exists. + +* `'w+'` - Open file for reading and writing. +The file is created (if it does not exist) or truncated (if it exists). + +* `'wx+'` - Like `'w+'` but fails if `path` exists. + +* `'a'` - Open file for appending. +The file is created if it does not exist. + +* `'ax'` - Like `'a'` but fails if `path` exists. + +* `'a+'` - Open file for reading and appending. +The file is created if it does not exist. + +* `'ax+'` - Like `'a+'` but fails if `path` exists. + +`mode` sets the file mode (permission and sticky bits), but only if the file was +created. It defaults to `0666`, readable and writable. + +The callback gets two arguments `(err, fd)`. + +The exclusive flag `'x'` (`O_EXCL` flag in open(2)) ensures that `path` is newly +created. On POSIX systems, `path` is considered to exist even if it is a symlink +to a non-existent file. The exclusive flag may or may not work with network file +systems. + +`flags` can also be a number as documented by open(2); commonly used constants +are available from `require('constants')`. On Windows, flags are translated to +their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`, +or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW. + +On Linux, positional writes don't work when the file is opened in append mode. +The kernel ignores the position argument and always appends the data to +the end of the file. + +## fs.openSync(path, flags[, mode]) + +Synchronous version of [`fs.open()`][]. Returns an integer representing the file +descriptor. + +## fs.read(fd, buffer, offset, length, position, callback) + +Read data from the file specified by `fd`. + +`buffer` is the buffer that the data will be written to. + +`offset` is the offset in the buffer to start writing at. + +`length` is an integer specifying the number of bytes to read. + +`position` is an integer specifying where to begin reading from in the file. +If `position` is `null`, data will be read from the current file position. + +The callback is given the three arguments, `(err, bytesRead, buffer)`. + +## fs.readdir(path, callback) + +Asynchronous readdir(3). Reads the contents of a directory. +The callback gets two arguments `(err, files)` where `files` is an array of +the names of the files in the directory excluding `'.'` and `'..'`. + +## fs.readdirSync(path) + +Synchronous readdir(3). Returns an array of filenames excluding `'.'` and +`'..'`. + +## fs.readFile(file[, options], callback) + +* `file` {String | Integer} filename or file descriptor +* `options` {Object | String} + * `encoding` {String | Null} default = `null` + * `flag` {String} default = `'r'` +* `callback` {Function} + +Asynchronously reads the entire contents of a file. Example: + +```js +fs.readFile('/etc/passwd', (err, data) => { + if (err) throw err; + console.log(data); +}); +``` + +The callback is passed two arguments `(err, data)`, where `data` is the +contents of the file. + +If no encoding is specified, then the raw buffer is returned. + +If `options` is a string, then it specifies the encoding. Example: + +```js +fs.readFile('/etc/passwd', 'utf8', callback); +``` + +Any specified file descriptor has to support reading. + +_Note: Specified file descriptors will not be closed automatically._ + +## fs.readFileSync(file[, options]) + +Synchronous version of [`fs.readFile`][]. Returns the contents of the `file`. + +If the `encoding` option is specified then this function returns a +string. Otherwise it returns a buffer. + +## fs.readlink(path, callback) + +Asynchronous readlink(2). The callback gets two arguments `(err, +linkString)`. + +## fs.readlinkSync(path) + +Synchronous readlink(2). Returns the symbolic link's string value. + +## fs.realpath(path[, cache], callback) + +Asynchronous realpath(2). The `callback` gets two arguments `(err, +resolvedPath)`. May use `process.cwd` to resolve relative paths. `cache` is an +object literal of mapped paths that can be used to force a specific path +resolution or avoid additional `fs.stat` calls for known real paths. + +Example: + +```js +var cache = {'/etc':'/private/etc'}; +fs.realpath('/etc/passwd', cache, (err, resolvedPath) => { + if (err) throw err; + console.log(resolvedPath); +}); +``` + +## fs.readSync(fd, buffer, offset, length, position) + +Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. + +## fs.realpathSync(path[, cache]) + +Synchronous realpath(2). Returns the resolved path. `cache` is an +object literal of mapped paths that can be used to force a specific path +resolution or avoid additional `fs.stat` calls for known real paths. + +## fs.rename(oldPath, newPath, callback) + +Asynchronous rename(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.renameSync(oldPath, newPath) + +Synchronous rename(2). Returns `undefined`. + +## fs.rmdir(path, callback) + +Asynchronous rmdir(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.rmdirSync(path) + +Synchronous rmdir(2). Returns `undefined`. + +## fs.stat(path, callback) + +Asynchronous stat(2). The callback gets two arguments `(err, stats)` where +`stats` is a [`fs.Stats`][] object. See the [`fs.Stats`][] section for more +information. + +## fs.statSync(path) + +Synchronous stat(2). Returns an instance of [`fs.Stats`][]. + +## fs.symlink(target, path[, type], callback) + +Asynchronous symlink(2). No arguments other than a possible exception are given +to the completion callback. +The `type` argument can be set to `'dir'`, `'file'`, or `'junction'` (default +is `'file'`) and is only available on Windows (ignored on other platforms). +Note that Windows junction points require the destination path to be absolute. When using +`'junction'`, the `target` argument will automatically be normalized to absolute path. + +Here is an example below: + +```js +fs.symlink('./foo', './new-port'); +``` + +It creates a symbolic link named "new-port" that points to "foo". + +## fs.symlinkSync(target, path[, type]) + +Synchronous symlink(2). Returns `undefined`. + +## fs.truncate(path, len, callback) + +Asynchronous truncate(2). No arguments other than a possible exception are +given to the completion callback. A file descriptor can also be passed as the +first argument. In this case, `fs.ftruncate()` is called. + +## fs.truncateSync(path, len) + +Synchronous truncate(2). Returns `undefined`. + +## fs.unlink(path, callback) + +Asynchronous unlink(2). No arguments other than a possible exception are given +to the completion callback. + +## fs.unlinkSync(path) + +Synchronous unlink(2). Returns `undefined`. + +## fs.unwatchFile(filename[, listener]) + +Stop watching for changes on `filename`. If `listener` is specified, only that +particular listener is removed. Otherwise, *all* listeners are removed and you +have effectively stopped watching `filename`. + +Calling `fs.unwatchFile()` with a filename that is not being watched is a +no-op, not an error. + +_Note: [`fs.watch()`][] is more efficient than `fs.watchFile()` and `fs.unwatchFile()`. +`fs.watch()` should be used instead of `fs.watchFile()` and `fs.unwatchFile()` +when possible._ + +## fs.utimes(path, atime, mtime, callback) + +Change file timestamps of the file referenced by the supplied path. + +Note: the arguments `atime` and `mtime` of the following related functions does +follow the below rules: + +- If the value is a numberable string like `'123456789'`, the value would get + converted to corresponding number. +- If the value is `NaN` or `Infinity`, the value would get converted to + `Date.now()`. + +## fs.utimesSync(path, atime, mtime) + +Synchronous version of [`fs.utimes()`][]. Returns `undefined`. + +## fs.watch(filename[, options][, listener]) + +Watch for changes on `filename`, where `filename` is either a file or a +directory. The returned object is a [`fs.FSWatcher`][]. + +The second argument is optional. The `options` if provided should be an object. +The supported boolean members are `persistent` and `recursive`. `persistent` +indicates whether the process should continue to run as long as files are being +watched. `recursive` indicates whether all subdirectories should be watched, or +only the current directory. This applies when a directory is specified, and only +on supported platforms (See [Caveats][]). + +The default is `{ persistent: true, recursive: false }`. + +The listener callback gets two arguments `(event, filename)`. `event` is either +`'rename'` or `'change'`, and `filename` is the name of the file which triggered +the event. + +### Caveats + + + +The `fs.watch` API is not 100% consistent across platforms, and is +unavailable in some situations. + +The recursive option is only supported on OS X and Windows. + +#### Availability + + + +This feature depends on the underlying operating system providing a way +to be notified of filesystem changes. + +* On Linux systems, this uses `inotify`. +* On BSD systems, this uses `kqueue`. +* On OS X, this uses `kqueue` for files and 'FSEvents' for directories. +* On SunOS systems (including Solaris and SmartOS), this uses `event ports`. +* On Windows systems, this feature depends on `ReadDirectoryChangesW`. + +If the underlying functionality is not available for some reason, then +`fs.watch` will not be able to function. For example, watching files or +directories on network file systems (NFS, SMB, etc.) often doesn't work +reliably or at all. + +You can still use `fs.watchFile`, which uses stat polling, but it is slower and +less reliable. + +#### Inodes + + + +On Linux and OS X systems, `fs.watch()` resolves the path to an [inode][] and +watches the inode. If the watched path is deleted and recreated, it is assigned +a new inode. The watch will emit an event for the delete but will continue +watching the *original* inode. Events for the new inode will not be emitted. +This is expected behavior. + +#### Filename Argument + + + +Providing `filename` argument in the callback is only supported on Linux and +Windows. Even on supported platforms, `filename` is not always guaranteed to +be provided. Therefore, don't assume that `filename` argument is always +provided in the callback, and have some fallback logic if it is null. + +```js +fs.watch('somedir', (event, filename) => { + console.log(`event is: ${event}`); + if (filename) { + console.log(`filename provided: ${filename}`); + } else { + console.log('filename not provided'); + } +}); +``` + +## fs.watchFile(filename[, options], listener) + +Watch for changes on `filename`. The callback `listener` will be called each +time the file is accessed. + +The `options` argument may be omitted. If provided, it should be an object. The +`options` object may contain a boolean named `persistent` that indicates +whether the process should continue to run as long as files are being watched. +The `options` object may specify an `interval` property indicating how often the +target should be polled in milliseconds. The default is +`{ persistent: true, interval: 5007 }`. + +The `listener` gets two arguments the current stat object and the previous +stat object: + +```js +fs.watchFile('message.text', (curr, prev) => { + console.log(`the current mtime is: ${curr.mtime}`); + console.log(`the previous mtime was: ${prev.mtime}`); +}); +``` + +These stat objects are instances of `fs.Stat`. + +If you want to be notified when the file was modified, not just accessed, +you need to compare `curr.mtime` and `prev.mtime`. + +_Note: when an `fs.watchFile` operation results in an `ENOENT` error, it will + invoke the listener once, with all the fields zeroed (or, for dates, the Unix + Epoch). In Windows, `blksize` and `blocks` fields will be `undefined`, instead + of zero. If the file is created later on, the listener will be called again, + with the latest stat objects. This is a change in functionality since v0.10._ + +_Note: [`fs.watch()`][] is more efficient than `fs.watchFile` and `fs.unwatchFile`. +`fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` +when possible._ + +## fs.write(fd, buffer, offset, length[, position], callback) + +Write `buffer` to the file specified by `fd`. + +`offset` and `length` determine the part of the buffer to be written. + +`position` refers to the offset from the beginning of the file where this data +should be written. If `typeof position !== 'number'`, the data will be written +at the current position. See pwrite(2). + +The callback will be given three arguments `(err, written, buffer)` where +`written` specifies how many _bytes_ were written from `buffer`. + +Note that it is unsafe to use `fs.write` multiple times on the same file +without waiting for the callback. For this scenario, +`fs.createWriteStream` is strongly recommended. + +On Linux, positional writes don't work when the file is opened in append mode. +The kernel ignores the position argument and always appends the data to +the end of the file. + +## fs.write(fd, data[, position[, encoding]], callback) + +Write `data` to the file specified by `fd`. If `data` is not a Buffer instance +then the value will be coerced to a string. + +`position` refers to the offset from the beginning of the file where this data +should be written. If `typeof position !== 'number'` the data will be written at +the current position. See pwrite(2). + +`encoding` is the expected string encoding. + +The callback will receive the arguments `(err, written, string)` where `written` +specifies how many _bytes_ the passed string required to be written. Note that +bytes written is not the same as string characters. See [`Buffer.byteLength`][]. + +Unlike when writing `buffer`, the entire string must be written. No substring +may be specified. This is because the byte offset of the resulting data may not +be the same as the string offset. + +Note that it is unsafe to use `fs.write` multiple times on the same file +without waiting for the callback. For this scenario, +`fs.createWriteStream` is strongly recommended. + +On Linux, positional writes don't work when the file is opened in append mode. +The kernel ignores the position argument and always appends the data to +the end of the file. + +## fs.writeFile(file, data[, options], callback) + +* `file` {String | Integer} filename or file descriptor +* `data` {String | Buffer} +* `options` {Object | String} + * `encoding` {String | Null} default = `'utf8'` + * `mode` {Number} default = `0o666` + * `flag` {String} default = `'w'` +* `callback` {Function} + +Asynchronously writes data to a file, replacing the file if it already exists. +`data` can be a string or a buffer. + +The `encoding` option is ignored if `data` is a buffer. It defaults +to `'utf8'`. + +Example: + +```js +fs.writeFile('message.txt', 'Hello Node.js', (err) => { + if (err) throw err; + console.log('It\'s saved!'); +}); +``` + +If `options` is a string, then it specifies the encoding. Example: + +```js +fs.writeFile('message.txt', 'Hello Node.js', 'utf8', callback); +``` + +Any specified file descriptor has to support writing. + +Note that it is unsafe to use `fs.writeFile` multiple times on the same file +without waiting for the callback. For this scenario, +`fs.createWriteStream` is strongly recommended. + +_Note: Specified file descriptors will not be closed automatically._ + +## fs.writeFileSync(file, data[, options]) + +The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. + +## fs.writeSync(fd, buffer, offset, length[, position]) + +## fs.writeSync(fd, data[, position[, encoding]]) + +Synchronous versions of [`fs.write()`][]. Returns the number of bytes written. + +[`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding +[`Buffer`]: buffer.html#buffer_buffer +[Caveats]: #fs_caveats +[`fs.access()`]: #fs_fs_access_path_mode_callback +[`fs.accessSync()`]: #fs_fs_accesssync_path_mode +[`fs.appendFile()`]: fs.html#fs_fs_appendfile_file_data_options_callback +[`fs.exists()`]: fs.html#fs_fs_exists_path_callback +[`fs.fstat()`]: #fs_fs_fstat_fd_callback +[`fs.FSWatcher`]: #fs_class_fs_fswatcher +[`fs.futimes()`]: #fs_fs_futimes_fd_atime_mtime_callback +[`fs.lstat()`]: #fs_fs_lstat_path_callback +[`fs.open()`]: #fs_fs_open_path_flags_mode_callback +[`fs.read()`]: #fs_fs_read_fd_buffer_offset_length_position_callback +[`fs.readFile`]: #fs_fs_readfile_file_options_callback +[`fs.stat()`]: #fs_fs_stat_path_callback +[`fs.Stats`]: #fs_class_fs_stats +[`fs.statSync()`]: #fs_fs_statsync_path +[`fs.utimes()`]: #fs_fs_futimes_fd_atime_mtime_callback +[`fs.watch()`]: #fs_fs_watch_filename_options_listener +[`fs.write()`]: #fs_fs_write_fd_buffer_offset_length_position_callback +[`fs.writeFile()`]: #fs_fs_writefile_file_data_options_callback +[`net.Socket`]: net.html#net_class_net_socket +[`ReadStream`]: #fs_class_fs_readstream +[`stat()`]: fs.html#fs_fs_stat_path_callback +[`util.inspect(stats)`]: util.html#util_util_inspect_object_options +[`WriteStream`]: #fs_class_fs_writestream +[MDN-Date-getTime]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getTime +[MDN-Date]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date +[Readable Stream]: stream.html#stream_class_stream_readable +[Writable Stream]: stream.html#stream_class_stream_writable +[inode]: http://www.linux.org/threads/intro-to-inodes.4130 diff --git a/doc/api/globals.markdown b/doc/api/globals.markdown deleted file mode 100644 index 1bee7d0cf988c2..00000000000000 --- a/doc/api/globals.markdown +++ /dev/null @@ -1,208 +0,0 @@ -# Global Objects - - - -These objects are available in all modules. Some of these objects aren't -actually in the global scope but in the module scope - this will be noted. - -## Class: Buffer - - - -* {Function} - -Used to handle binary data. See the [buffer section][]. - -## \_\_dirname - - - -* {String} - -The name of the directory that the currently executing script resides in. - -Example: running `node example.js` from `/Users/mjr` - -```js -console.log(__dirname); -// /Users/mjr -``` - -`__dirname` isn't actually a global but rather local to each module. - -For instance, given two modules: `a` and `b`, where `b` is a dependency of -`a` and there is a directory structure of: - -* `/Users/mjr/app/a.js` -* `/Users/mjr/app/node_modules/b/b.js` - -References to `__dirname` within `b.js` will return -`/Users/mjr/app/node_modules/b` while references to `__dirname` within `a.js` -will return `/Users/mj/app`. - -## \_\_filename - - - -* {String} - -The filename of the code being executed. This is the resolved absolute path -of this code file. For a main program this is not necessarily the same -filename used in the command line. The value inside a module is the path -to that module file. - -Example: running `node example.js` from `/Users/mjr` - -```js -console.log(__filename); -// /Users/mjr/example.js -``` - -`__filename` isn't actually a global but rather local to each module. - -## clearImmediate(immediateObject) - - - -[`clearImmediate`] is described in the [timers][] section. - -## clearInterval(intervalObject) - - - -[`clearInterval`] is described in the [timers][] section. - -## clearTimeout(timeoutObject) - - - -[`clearTimeout`] is described in the [timers][] section. - -## console - - - -* {Object} - -Used to print to stdout and stderr. See the [`console`][] section. - -## exports - - - -A reference to the `module.exports` that is shorter to type. -See [module system documentation][] for details on when to use `exports` and -when to use `module.exports`. - -`exports` isn't actually a global but rather local to each module. - -See the [module system documentation][] for more information. - -## global - - - -* {Object} The global namespace object. - -In browsers, the top-level scope is the global scope. That means that in -browsers if you're in the global scope `var something` will define a global -variable. In Node.js this is different. The top-level scope is not the global -scope; `var something` inside an Node.js module will be local to that module. - -## module - - - -* {Object} - -A reference to the current module. In particular -`module.exports` is used for defining what a module exports and makes -available through `require()`. - -`module` isn't actually a global but rather local to each module. - -See the [module system documentation][] for more information. - -## process - - - -* {Object} - -The process object. See the [`process` object][] section. - -## require() - - - -* {Function} - -To require modules. See the [Modules][] section. `require` isn't actually a -global but rather local to each module. - -### require.cache - -* {Object} - -Modules are cached in this object when they are required. By deleting a key -value from this object, the next `require` will reload the module. - -### require.extensions - - Stability: 0 - Deprecated - -* {Object} - -Instruct `require` on how to handle certain file extensions. - -Process files with the extension `.sjs` as `.js`: - -```js -require.extensions['.sjs'] = require.extensions['.js']; -``` - -**Deprecated** In the past, this list has been used to load -non-JavaScript modules into Node.js by compiling them on-demand. -However, in practice, there are much better ways to do this, such as -loading modules via some other Node.js program, or compiling them to -JavaScript ahead of time. - -Since the Module system is locked, this feature will probably never go -away. However, it may have subtle bugs and complexities that are best -left untouched. - -### require.resolve() - -Use the internal `require()` machinery to look up the location of a module, -but rather than loading the module, just return the resolved filename. - -## setImmediate(callback[, arg][, ...]) - - - -[`setImmediate`] is described in the [timers][] section. - -## setInterval(callback, delay[, arg][, ...]) - - - -[`setInterval`] is described in the [timers][] section. - -## setTimeout(callback, delay[, arg][, ...]) - - - -[`setTimeout`] is described in the [timers][] section. - -[`console`]: console.html -[`process` object]: process.html#process_process -[buffer section]: buffer.html -[module system documentation]: modules.html -[Modules]: modules.html#modules_modules -[timers]: timers.html -[`clearImmediate`]: timers.html#timers_clearimmediate_immediateobject -[`clearInterval`]: timers.html#timers_clearinterval_intervalobject -[`clearTimeout`]: timers.html#timers_cleartimeout_timeoutobject -[`setImmediate`]: timers.html#timers_setimmediate_callback_arg -[`setInterval`]: timers.html#timers_setinterval_callback_delay_arg -[`setTimeout`]: timers.html#timers_settimeout_callback_delay_arg diff --git a/doc/api/globals.md b/doc/api/globals.md new file mode 100644 index 00000000000000..643ab4334b20a6 --- /dev/null +++ b/doc/api/globals.md @@ -0,0 +1,211 @@ +# Global Objects + + + +These objects are available in all modules. Some of these objects aren't +actually in the global scope but in the module scope - this will be noted. + +## Class: Buffer + + + +* {Function} + +Used to handle binary data. See the [buffer section][]. + +## \_\_dirname + + + +* {String} + +The name of the directory that the currently executing script resides in. + +Example: running `node example.js` from `/Users/mjr` + +```js +console.log(__dirname); +// /Users/mjr +``` + +`__dirname` isn't actually a global but rather local to each module. + +For instance, given two modules: `a` and `b`, where `b` is a dependency of +`a` and there is a directory structure of: + +* `/Users/mjr/app/a.js` +* `/Users/mjr/app/node_modules/b/b.js` + +References to `__dirname` within `b.js` will return +`/Users/mjr/app/node_modules/b` while references to `__dirname` within `a.js` +will return `/Users/mj/app`. + +## \_\_filename + + + +* {String} + +The filename of the code being executed. This is the resolved absolute path +of this code file. For a main program this is not necessarily the same +filename used in the command line. The value inside a module is the path +to that module file. + +Example: running `node example.js` from `/Users/mjr` + +```js +console.log(__filename); +// /Users/mjr/example.js +``` + +`__filename` isn't actually a global but rather local to each module. + +## clearImmediate(immediateObject) + + + +[`clearImmediate`] is described in the [timers][] section. + +## clearInterval(intervalObject) + + + +[`clearInterval`] is described in the [timers][] section. + +## clearTimeout(timeoutObject) + + + +[`clearTimeout`] is described in the [timers][] section. + +## console + + + +* {Object} + +Used to print to stdout and stderr. See the [`console`][] section. + +## exports + + + +A reference to the `module.exports` that is shorter to type. +See [module system documentation][] for details on when to use `exports` and +when to use `module.exports`. + +`exports` isn't actually a global but rather local to each module. + +See the [module system documentation][] for more information. + +## global + + + +* {Object} The global namespace object. + +In browsers, the top-level scope is the global scope. That means that in +browsers if you're in the global scope `var something` will define a global +variable. In Node.js this is different. The top-level scope is not the global +scope; `var something` inside an Node.js module will be local to that module. + +## module + + + +* {Object} + +A reference to the current module. In particular +`module.exports` is used for defining what a module exports and makes +available through `require()`. + +`module` isn't actually a global but rather local to each module. + +See the [module system documentation][] for more information. + +## process + + + +* {Object} + +The process object. See the [`process` object][] section. + +## require() + + + +* {Function} + +To require modules. See the [Modules][] section. `require` isn't actually a +global but rather local to each module. + +### require.cache + +* {Object} + +Modules are cached in this object when they are required. By deleting a key +value from this object, the next `require` will reload the module. Note that +this does not apply to [native addons][], for which reloading will result in an +Error. + +### require.extensions + + Stability: 0 - Deprecated + +* {Object} + +Instruct `require` on how to handle certain file extensions. + +Process files with the extension `.sjs` as `.js`: + +```js +require.extensions['.sjs'] = require.extensions['.js']; +``` + +**Deprecated** In the past, this list has been used to load +non-JavaScript modules into Node.js by compiling them on-demand. +However, in practice, there are much better ways to do this, such as +loading modules via some other Node.js program, or compiling them to +JavaScript ahead of time. + +Since the Module system is locked, this feature will probably never go +away. However, it may have subtle bugs and complexities that are best +left untouched. + +### require.resolve() + +Use the internal `require()` machinery to look up the location of a module, +but rather than loading the module, just return the resolved filename. + +## setImmediate(callback[, arg][, ...]) + + + +[`setImmediate`] is described in the [timers][] section. + +## setInterval(callback, delay[, arg][, ...]) + + + +[`setInterval`] is described in the [timers][] section. + +## setTimeout(callback, delay[, arg][, ...]) + + + +[`setTimeout`] is described in the [timers][] section. + +[`console`]: console.html +[`process` object]: process.html#process_process +[buffer section]: buffer.html +[module system documentation]: modules.html +[Modules]: modules.html#modules_modules +[native addons]: addons.html +[timers]: timers.html +[`clearImmediate`]: timers.html#timers_clearimmediate_immediateobject +[`clearInterval`]: timers.html#timers_clearinterval_intervalobject +[`clearTimeout`]: timers.html#timers_cleartimeout_timeoutobject +[`setImmediate`]: timers.html#timers_setimmediate_callback_arg +[`setInterval`]: timers.html#timers_setinterval_callback_delay_arg +[`setTimeout`]: timers.html#timers_settimeout_callback_delay_arg diff --git a/doc/api/http.markdown b/doc/api/http.markdown deleted file mode 100644 index 0676aaad7e71ec..00000000000000 --- a/doc/api/http.markdown +++ /dev/null @@ -1,1240 +0,0 @@ -# HTTP - - Stability: 2 - Stable - -To use the HTTP server and client one must `require('http')`. - -The HTTP interfaces in Node.js are designed to support many features -of the protocol which have been traditionally difficult to use. -In particular, large, possibly chunk-encoded, messages. The interface is -careful to never buffer entire requests or responses--the -user is able to stream data. - -HTTP message headers are represented by an object like this: - -``` -{ 'content-length': '123', - 'content-type': 'text/plain', - 'connection': 'keep-alive', - 'host': 'mysite.com', - 'accept': '*/*' } -``` - -Keys are lowercased. Values are not modified. - -In order to support the full spectrum of possible HTTP applications, Node.js's -HTTP API is very low-level. It deals with stream handling and message -parsing only. It parses a message into headers and body but it does not -parse the actual headers or the body. - -See [`message.headers`][] for details on how duplicate headers are handled. - -The raw headers as they were received are retained in the `rawHeaders` -property, which is an array of `[key, value, key2, value2, ...]`. For -example, the previous message header object might have a `rawHeaders` -list like the following: - -``` -[ 'ConTent-Length', '123456', - 'content-LENGTH', '123', - 'content-type', 'text/plain', - 'CONNECTION', 'keep-alive', - 'Host', 'mysite.com', - 'accepT', '*/*' ] -``` - -## Class: http.Agent - -The HTTP Agent is used for pooling sockets used in HTTP client -requests. - -The HTTP Agent also defaults client requests to using -Connection:keep-alive. If no pending HTTP requests are waiting on a -socket to become free the socket is closed. This means that Node.js's -pool has the benefit of keep-alive when under load but still does not -require developers to manually close the HTTP clients using -KeepAlive. - -If you opt into using HTTP KeepAlive, you can create an Agent object -with that flag set to `true`. (See the [constructor options][].) -Then, the Agent will keep unused sockets in a pool for later use. They -will be explicitly marked so as to not keep the Node.js process running. -However, it is still a good idea to explicitly [`destroy()`][] KeepAlive -agents when they are no longer in use, so that the Sockets will be shut -down. - -Sockets are removed from the agent's pool when the socket emits either -a `'close'` event or a special `'agentRemove'` event. This means that if -you intend to keep one HTTP request open for a long time and don't -want it to stay in the pool you can do something along the lines of: - -```js -http.get(options, (res) => { - // Do stuff -}).on('socket', (socket) => { - socket.emit('agentRemove'); -}); -``` - -Alternatively, you could just opt out of pooling entirely using -`agent:false`: - -```js -http.get({ - hostname: 'localhost', - port: 80, - path: '/', - agent: false // create a new agent just for this one request -}, (res) => { - // Do stuff with response -}) -``` - -### new Agent([options]) - -* `options` {Object} Set of configurable options to set on the agent. - Can have the following fields: - * `keepAlive` {Boolean} Keep sockets around in a pool to be used by - other requests in the future. Default = `false` - * `keepAliveMsecs` {Integer} When using HTTP KeepAlive, how often - to send TCP KeepAlive packets over sockets being kept alive. - Default = `1000`. Only relevant if `keepAlive` is set to `true`. - * `maxSockets` {Number} Maximum number of sockets to allow per - host. Default = `Infinity`. - * `maxFreeSockets` {Number} Maximum number of sockets to leave open - in a free state. Only relevant if `keepAlive` is set to `true`. - Default = `256`. - -The default [`http.globalAgent`][] that is used by [`http.request()`][] has all -of these values set to their respective defaults. - -To configure any of them, you must create your own [`http.Agent`][] object. - -```js -const http = require('http'); -var keepAliveAgent = new http.Agent({ keepAlive: true }); -options.agent = keepAliveAgent; -http.request(options, onResponseCallback); -``` - -### agent.createConnection(options[, callback]) - -Produces a socket/stream to be used for HTTP requests. - -By default, this function is the same as [`net.createConnection()`][]. However, -custom Agents may override this method in case greater flexibility is desired. - -A socket/stream can be supplied in one of two ways: by returning the -socket/stream from this function, or by passing the socket/stream to `callback`. - -`callback` has a signature of `(err, stream)`. - -### agent.destroy() - -Destroy any sockets that are currently in use by the agent. - -It is usually not necessary to do this. However, if you are using an -agent with KeepAlive enabled, then it is best to explicitly shut down -the agent when you know that it will no longer be used. Otherwise, -sockets may hang open for quite a long time before the server -terminates them. - -### agent.freeSockets - -An object which contains arrays of sockets currently awaiting use by -the Agent when HTTP KeepAlive is used. Do not modify. - -### agent.getName(options) - -Get a unique name for a set of request options, to determine whether a -connection can be reused. In the http agent, this returns -`host:port:localAddress`. In the https agent, the name includes the -CA, cert, ciphers, and other HTTPS/TLS-specific options that determine -socket reusability. - -### agent.maxFreeSockets - -By default set to 256. For Agents supporting HTTP KeepAlive, this -sets the maximum number of sockets that will be left open in the free -state. - -### agent.maxSockets - -By default set to Infinity. Determines how many concurrent sockets the agent -can have open per origin. Origin is either a 'host:port' or -'host:port:localAddress' combination. - -### agent.requests - -An object which contains queues of requests that have not yet been assigned to -sockets. Do not modify. - -### agent.sockets - -An object which contains arrays of sockets currently in use by the -Agent. Do not modify. - -## Class: http.ClientRequest - -This object is created internally and returned from [`http.request()`][]. It -represents an _in-progress_ request whose header has already been queued. The -header is still mutable using the `setHeader(name, value)`, `getHeader(name)`, -`removeHeader(name)` API. The actual header will be sent along with the first -data chunk or when closing the connection. - -To get the response, add a listener for `'response'` to the request object. -`'response'` will be emitted from the request object when the response -headers have been received. The `'response'` event is executed with one -argument which is an instance of [`http.IncomingMessage`][]. - -During the `'response'` event, one can add listeners to the -response object; particularly to listen for the `'data'` event. - -If no `'response'` handler is added, then the response will be -entirely discarded. However, if you add a `'response'` event handler, -then you **must** consume the data from the response object, either by -calling `response.read()` whenever there is a `'readable'` event, or -by adding a `'data'` handler, or by calling the `.resume()` method. -Until the data is consumed, the `'end'` event will not fire. Also, until -the data is read it will consume memory that can eventually lead to a -'process out of memory' error. - -Note: Node.js does not check whether Content-Length and the length of the body -which has been transmitted are equal or not. - -The request implements the [Writable Stream][] interface. This is an -[`EventEmitter`][] with the following events: - -### Event: 'abort' - -`function () { }` - -Emitted when the request has been aborted by the client. This event is only -emitted on the first call to `abort()`. - -### Event: 'checkExpectation' - -`function (request, response) { }` - -Emitted each time a request with an http Expect header is received, where the -value is not 100-continue. If this event isn't listened for, the server will -automatically respond with a 417 Expectation Failed as appropriate. - -Note that when this event is emitted and handled, the `request` event will -not be emitted. - -### Event: 'connect' - -`function (response, socket, head) { }` - -Emitted each time a server responds to a request with a `CONNECT` method. If this -event isn't being listened for, clients receiving a `CONNECT` method will have -their connections closed. - -A client server pair that show you how to listen for the `'connect'` event. - -```js -const http = require('http'); -const net = require('net'); -const url = require('url'); - -// Create an HTTP tunneling proxy -var proxy = http.createServer( (req, res) => { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('okay'); -}); -proxy.on('connect', (req, cltSocket, head) => { - // connect to an origin server - var srvUrl = url.parse(`http://${req.url}`); - var srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => { - cltSocket.write('HTTP/1.1 200 Connection Established\r\n' + - 'Proxy-agent: Node.js-Proxy\r\n' + - '\r\n'); - srvSocket.write(head); - srvSocket.pipe(cltSocket); - cltSocket.pipe(srvSocket); - }); -}); - -// now that proxy is running -proxy.listen(1337, '127.0.0.1', () => { - - // make a request to a tunneling proxy - var options = { - port: 1337, - hostname: '127.0.0.1', - method: 'CONNECT', - path: 'www.google.com:80' - }; - - var req = http.request(options); - req.end(); - - req.on('connect', (res, socket, head) => { - console.log('got connected!'); - - // make a request over an HTTP tunnel - socket.write('GET / HTTP/1.1\r\n' + - 'Host: www.google.com:80\r\n' + - 'Connection: close\r\n' + - '\r\n'); - socket.on('data', (chunk) => { - console.log(chunk.toString()); - }); - socket.on('end', () => { - proxy.close(); - }); - }); -}); -``` - -### Event: 'continue' - -`function () { }` - -Emitted when the server sends a '100 Continue' HTTP response, usually because -the request contained 'Expect: 100-continue'. This is an instruction that -the client should send the request body. - -### Event: 'response' - -`function (response) { }` - -Emitted when a response is received to this request. This event is emitted only -once. The `response` argument will be an instance of [`http.IncomingMessage`][]. - -Options: - -- `host`: A domain name or IP address of the server to issue the request to. -- `port`: Port of remote server. -- `socketPath`: Unix Domain Socket (use one of host:port or socketPath) - -### Event: 'socket' - -`function (socket) { }` - -Emitted after a socket is assigned to this request. - -### Event: 'upgrade' - -`function (response, socket, head) { }` - -Emitted each time a server responds to a request with an upgrade. If this -event isn't being listened for, clients receiving an upgrade header will have -their connections closed. - -A client server pair that show you how to listen for the `'upgrade'` event. - -```js -const http = require('http'); - -// Create an HTTP server -var srv = http.createServer( (req, res) => { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('okay'); -}); -srv.on('upgrade', (req, socket, head) => { - socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n' + - 'Upgrade: WebSocket\r\n' + - 'Connection: Upgrade\r\n' + - '\r\n'); - - socket.pipe(socket); // echo back -}); - -// now that server is running -srv.listen(1337, '127.0.0.1', () => { - - // make a request - var options = { - port: 1337, - hostname: '127.0.0.1', - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket' - } - }; - - var req = http.request(options); - req.end(); - - req.on('upgrade', (res, socket, upgradeHead) => { - console.log('got upgraded!'); - socket.end(); - process.exit(0); - }); -}); -``` - -### request.abort() - -Marks the request as aborting. Calling this will cause remaining data -in the response to be dropped and the socket to be destroyed. - -### request.end([data][, encoding][, callback]) - -Finishes sending the request. If any parts of the body are -unsent, it will flush them to the stream. If the request is -chunked, this will send the terminating `'0\r\n\r\n'`. - -If `data` is specified, it is equivalent to calling -[`response.write(data, encoding)`][] followed by `request.end(callback)`. - -If `callback` is specified, it will be called when the request stream -is finished. - -### request.flushHeaders() - -Flush the request headers. - -For efficiency reasons, Node.js normally buffers the request headers until you -call `request.end()` or write the first chunk of request data. It then tries -hard to pack the request headers and data into a single TCP packet. - -That's usually what you want (it saves a TCP round-trip) but not when the first -data isn't sent until possibly much later. `request.flushHeaders()` lets you bypass -the optimization and kickstart the request. - -### request.setNoDelay([noDelay]) - -Once a socket is assigned to this request and is connected -[`socket.setNoDelay()`][] will be called. - -### request.setSocketKeepAlive([enable][, initialDelay]) - -Once a socket is assigned to this request and is connected -[`socket.setKeepAlive()`][] will be called. - -### request.setTimeout(timeout[, callback]) - -Once a socket is assigned to this request and is connected -[`socket.setTimeout()`][] will be called. - -* `timeout` {Number} Milliseconds before a request is considered to be timed out. -* `callback` {Function} Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. - -### request.write(chunk[, encoding][, callback]) - -Sends a chunk of the body. By calling this method -many times, the user can stream a request body to a -server--in that case it is suggested to use the -`['Transfer-Encoding', 'chunked']` header line when -creating the request. - -The `chunk` argument should be a [`Buffer`][] or a string. - -The `encoding` argument is optional and only applies when `chunk` is a string. -Defaults to `'utf8'`. - -The `callback` argument is optional and will be called when this chunk of data -is flushed. - -Returns `request`. - -## Class: http.Server - -This class inherits from [`net.Server`][] and has the following additional events: - -### Event: 'checkContinue' - -`function (request, response) { }` - -Emitted each time a request with an http Expect: 100-continue is received. -If this event isn't listened for, the server will automatically respond -with a 100 Continue as appropriate. - -Handling this event involves calling [`response.writeContinue()`][] if the client -should continue to send the request body, or generating an appropriate HTTP -response (e.g., 400 Bad Request) if the client should not continue to send the -request body. - -Note that when this event is emitted and handled, the `'request'` event will -not be emitted. - -### Event: 'clientError' - -`function (exception, socket) { }` - -If a client connection emits an `'error'` event, it will be forwarded here. - -`socket` is the [`net.Socket`][] object that the error originated from. - -### Event: 'close' - -`function () { }` - -Emitted when the server closes. - -### Event: 'connect' - -`function (request, socket, head) { }` - -Emitted each time a client requests a http `CONNECT` method. If this event isn't -listened for, then clients requesting a `CONNECT` method will have their -connections closed. - -* `request` is the arguments for the http request, as it is in the request - event. -* `socket` is the network socket between the server and client. -* `head` is an instance of Buffer, the first packet of the tunneling stream, - this may be empty. - -After this event is emitted, the request's socket will not have a `'data'` -event listener, meaning you will need to bind to it in order to handle data -sent to the server on that socket. - -### Event: 'connection' - -`function (socket) { }` - -When a new TCP stream is established. `socket` is an object of type -[`net.Socket`][]. Usually users will not want to access this event. In -particular, the socket will not emit `'readable'` events because of how -the protocol parser attaches to the socket. The `socket` can also be -accessed at `request.connection`. - -### Event: 'request' - -`function (request, response) { }` - -Emitted each time there is a request. Note that there may be multiple requests -per connection (in the case of keep-alive connections). - `request` is an instance of [`http.IncomingMessage`][] and `response` is -an instance of [`http.ServerResponse`][]. - -### Event: 'upgrade' - -`function (request, socket, head) { }` - -Emitted each time a client requests a http upgrade. If this event isn't -listened for, then clients requesting an upgrade will have their connections -closed. - -* `request` is the arguments for the http request, as it is in the request - event. -* `socket` is the network socket between the server and client. -* `head` is an instance of Buffer, the first packet of the upgraded stream, - this may be empty. - -After this event is emitted, the request's socket will not have a `'data'` -event listener, meaning you will need to bind to it in order to handle data -sent to the server on that socket. - -### server.close([callback]) - -Stops the server from accepting new connections. See [`net.Server.close()`][]. - -### server.listen(handle[, callback]) - -* `handle` {Object} -* `callback` {Function} - -The `handle` object can be set to either a server or socket (anything -with an underlying `_handle` member), or a `{fd: }` object. - -This will cause the server to accept connections on the specified -handle, but it is presumed that the file descriptor or handle has -already been bound to a port or domain socket. - -Listening on a file descriptor is not supported on Windows. - -This function is asynchronous. The last parameter `callback` will be added as -a listener for the `'listening'` event. See also [`net.Server.listen()`][]. - -Returns `server`. - -### server.listen(path[, callback]) - -Start a UNIX socket server listening for connections on the given `path`. - -This function is asynchronous. The last parameter `callback` will be added as -a listener for the `'listening'` event. See also [`net.Server.listen(path)`][]. - -### server.listen(port[, hostname][, backlog][, callback]) - -Begin accepting connections on the specified `port` and `hostname`. If the -`hostname` is omitted, the server will accept connections on any IPv6 address -(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A -port value of zero will assign a random port. - -To listen to a unix socket, supply a filename instead of port and hostname. - -Backlog is the maximum length of the queue of pending connections. -The actual length will be determined by your OS through sysctl settings such as -`tcp_max_syn_backlog` and `somaxconn` on linux. The default value of this -parameter is 511 (not 512). - -This function is asynchronous. The last parameter `callback` will be added as -a listener for the `'listening'` event. See also [`net.Server.listen(port)`][]. - -### server.listening - -A Boolean indicating whether or not the server is listening for -connections. - -### server.maxHeadersCount - -Limits maximum incoming headers count, equal to 1000 by default. If set to 0 - -no limit will be applied. - -### server.setTimeout(msecs, callback) - -* `msecs` {Number} -* `callback` {Function} - -Sets the timeout value for sockets, and emits a `'timeout'` event on -the Server object, passing the socket as an argument, if a timeout -occurs. - -If there is a `'timeout'` event listener on the Server object, then it -will be called with the timed-out socket as an argument. - -By default, the Server's timeout value is 2 minutes, and sockets are -destroyed automatically if they time out. However, if you assign a -callback to the Server's `'timeout'` event, then you are responsible -for handling socket timeouts. - -Returns `server`. - -### server.timeout - -* {Number} Default = 120000 (2 minutes) - -The number of milliseconds of inactivity before a socket is presumed -to have timed out. - -Note that the socket timeout logic is set up on connection, so -changing this value only affects *new* connections to the server, not -any existing connections. - -Set to 0 to disable any kind of automatic timeout behavior on incoming -connections. - -## Class: http.ServerResponse - -This object is created internally by a HTTP server--not by the user. It is -passed as the second parameter to the `'request'` event. - -The response implements the [Writable Stream][] interface. This is an -[`EventEmitter`][] with the following events: - -### Event: 'close' - -`function () { }` - -Indicates that the underlying connection was terminated before -[`response.end()`][] was called or able to flush. - -### Event: 'finish' - -`function () { }` - -Emitted when the response has been sent. More specifically, this event is -emitted when the last segment of the response headers and body have been -handed off to the operating system for transmission over the network. It -does not imply that the client has received anything yet. - -After this event, no more events will be emitted on the response object. - -### response.addTrailers(headers) - -This method adds HTTP trailing headers (a header but at the end of the -message) to the response. - -Trailers will **only** be emitted if chunked encoding is used for the -response; if it is not (e.g., if the request was HTTP/1.0), they will -be silently discarded. - -Note that HTTP requires the `Trailer` header to be sent if you intend to -emit trailers, with a list of the header fields in its value. E.g., - -```js -response.writeHead(200, { 'Content-Type': 'text/plain', - 'Trailer': 'Content-MD5' }); -response.write(fileData); -response.addTrailers({'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667'}); -response.end(); -``` - -Attempting to set a header field name or value that contains invalid characters -will result in a [`TypeError`][] being thrown. - -### response.end([data][, encoding][, callback]) - -This method signals to the server that all of the response headers and body -have been sent; that server should consider this message complete. -The method, `response.end()`, MUST be called on each response. - -If `data` is specified, it is equivalent to calling -[`response.write(data, encoding)`][] followed by `response.end(callback)`. - -If `callback` is specified, it will be called when the response stream -is finished. - -### response.finished - -Boolean value that indicates whether the response has completed. Starts -as `false`. After [`response.end()`][] executes, the value will be `true`. - -### response.getHeader(name) - -Reads out a header that's already been queued but not sent to the client. Note -that the name is case insensitive. This can only be called before headers get -implicitly flushed. - -Example: - -```js -var contentType = response.getHeader('content-type'); -``` - -### response.headersSent - -Boolean (read-only). True if headers were sent, false otherwise. - -### response.removeHeader(name) - -Removes a header that's queued for implicit sending. - -Example: - -```js -response.removeHeader('Content-Encoding'); -``` - -### response.sendDate - -When true, the Date header will be automatically generated and sent in -the response if it is not already present in the headers. Defaults to true. - -This should only be disabled for testing; HTTP requires the Date header -in responses. - -### response.setHeader(name, value) - -Sets a single header value for implicit headers. If this header already exists -in the to-be-sent headers, its value will be replaced. Use an array of strings -here if you need to send multiple headers with the same name. - -Example: - -```js -response.setHeader('Content-Type', 'text/html'); -``` - -or - -```js -response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); -``` - -Attempting to set a header field name or value that contains invalid characters -will result in a [`TypeError`][] being thrown. - -When headers have been set with [`response.setHeader()`][], they will be merged with -any headers passed to [`response.writeHead()`][], with the headers passed to -[`response.writeHead()`][] given precedence. - -```js -// returns content-type = text/plain -const server = http.createServer((req,res) => { - res.setHeader('Content-Type', 'text/html'); - res.setHeader('X-Foo', 'bar'); - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('ok'); -}); -``` - -### response.setTimeout(msecs, callback) - -* `msecs` {Number} -* `callback` {Function} - -Sets the Socket's timeout value to `msecs`. If a callback is -provided, then it is added as a listener on the `'timeout'` event on -the response object. - -If no `'timeout'` listener is added to the request, the response, or -the server, then sockets are destroyed when they time out. If you -assign a handler on the request, the response, or the server's -`'timeout'` events, then it is your responsibility to handle timed out -sockets. - -Returns `response`. - -### response.statusCode - -When using implicit headers (not calling [`response.writeHead()`][] explicitly), -this property controls the status code that will be sent to the client when -the headers get flushed. - -Example: - -```js -response.statusCode = 404; -``` - -After response header was sent to the client, this property indicates the -status code which was sent out. - -### response.statusMessage - -When using implicit headers (not calling [`response.writeHead()`][] explicitly), this property -controls the status message that will be sent to the client when the headers get -flushed. If this is left as `undefined` then the standard message for the status -code will be used. - -Example: - -```js -response.statusMessage = 'Not found'; -``` - -After response header was sent to the client, this property indicates the -status message which was sent out. - -### response.write(chunk[, encoding][, callback]) - -If this method is called and [`response.writeHead()`][] has not been called, -it will switch to implicit header mode and flush the implicit headers. - -This sends a chunk of the response body. This method may -be called multiple times to provide successive parts of the body. - -`chunk` can be a string or a buffer. If `chunk` is a string, -the second parameter specifies how to encode it into a byte stream. -By default the `encoding` is `'utf8'`. The last parameter `callback` -will be called when this chunk of data is flushed. - -**Note**: This is the raw HTTP body and has nothing to do with -higher-level multi-part body encodings that may be used. - -The first time [`response.write()`][] is called, it will send the buffered -header information and the first body to the client. The second time -[`response.write()`][] is called, Node.js assumes you're going to be streaming -data, and sends that separately. That is, the response is buffered up to the -first chunk of body. - -Returns `true` if the entire data was flushed successfully to the kernel -buffer. Returns `false` if all or part of the data was queued in user memory. -`'drain'` will be emitted when the buffer is free again. - -### response.writeContinue() - -Sends a HTTP/1.1 100 Continue message to the client, indicating that -the request body should be sent. See the [`'checkContinue'`][] event on `Server`. - -### response.writeHead(statusCode[, statusMessage][, headers]) - -Sends a response header to the request. The status code is a 3-digit HTTP -status code, like `404`. The last argument, `headers`, are the response headers. -Optionally one can give a human-readable `statusMessage` as the second -argument. - -Example: - -```js -var body = 'hello world'; -response.writeHead(200, { - 'Content-Length': body.length, - 'Content-Type': 'text/plain' }); -``` - -This method must only be called once on a message and it must -be called before [`response.end()`][] is called. - -If you call [`response.write()`][] or [`response.end()`][] before calling this, -the implicit/mutable headers will be calculated and call this function for you. - -When headers have been set with [`response.setHeader()`][], they will be merged with -any headers passed to [`response.writeHead()`][], with the headers passed to -[`response.writeHead()`][] given precedence. - -```js -// returns content-type = text/plain -const server = http.createServer((req,res) => { - res.setHeader('Content-Type', 'text/html'); - res.setHeader('X-Foo', 'bar'); - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('ok'); -}); -``` - -Note that Content-Length is given in bytes not characters. The above example -works because the string `'hello world'` contains only single byte characters. -If the body contains higher coded characters then `Buffer.byteLength()` -should be used to determine the number of bytes in a given encoding. -And Node.js does not check whether Content-Length and the length of the body -which has been transmitted are equal or not. - -Attempting to set a header field name or value that contains invalid characters -will result in a [`TypeError`][] being thrown. - -## Class: http.IncomingMessage - -An `IncomingMessage` object is created by [`http.Server`][] or -[`http.ClientRequest`][] and passed as the first argument to the `'request'` -and `'response'` event respectively. It may be used to access response status, -headers and data. - -It implements the [Readable Stream][] interface, as well as the -following additional events, methods, and properties. - -### Event: 'close' - -`function () { }` - -Indicates that the underlying connection was closed. -Just like `'end'`, this event occurs only once per response. - -### message.headers - -The request/response headers object. - -Key-value pairs of header names and values. Header names are lower-cased. -Example: - -```js -// Prints something like: -// -// { 'user-agent': 'curl/7.22.0', -// host: '127.0.0.1:8000', -// accept: '*/*' } -console.log(request.headers); -``` - -Duplicates in raw headers are handled in the following ways, depending on the -header name: - -* Duplicates of `age`, `authorization`, `content-length`, `content-type`, -`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`, -`last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`, -`retry-after`, or `user-agent` are discarded. -* `set-cookie` is always an array. Duplicates are added to the array. -* For all other headers, the values are joined together with ', '. - -### message.httpVersion - -In case of server request, the HTTP version sent by the client. In the case of -client response, the HTTP version of the connected-to server. -Probably either `'1.1'` or `'1.0'`. - -Also `message.httpVersionMajor` is the first integer and -`message.httpVersionMinor` is the second. - -### message.method - -**Only valid for request obtained from [`http.Server`][].** - -The request method as a string. Read only. Example: -`'GET'`, `'DELETE'`. - -### message.rawHeaders - -The raw request/response headers list exactly as they were received. - -Note that the keys and values are in the same list. It is *not* a -list of tuples. So, the even-numbered offsets are key values, and the -odd-numbered offsets are the associated values. - -Header names are not lowercased, and duplicates are not merged. - -```js -// Prints something like: -// -// [ 'user-agent', -// 'this is invalid because there can be only one', -// 'User-Agent', -// 'curl/7.22.0', -// 'Host', -// '127.0.0.1:8000', -// 'ACCEPT', -// '*/*' ] -console.log(request.rawHeaders); -``` - -### message.rawTrailers - -The raw request/response trailer keys and values exactly as they were -received. Only populated at the `'end'` event. - -### message.setTimeout(msecs, callback) - -* `msecs` {Number} -* `callback` {Function} - -Calls `message.connection.setTimeout(msecs, callback)`. - -Returns `message`. - -### message.statusCode - -**Only valid for response obtained from [`http.ClientRequest`][].** - -The 3-digit HTTP response status code. E.G. `404`. - -### message.statusMessage - -**Only valid for response obtained from [`http.ClientRequest`][].** - -The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. - -### message.socket - -The [`net.Socket`][] object associated with the connection. - -With HTTPS support, use [`request.socket.getPeerCertificate()`][] to obtain the -client's authentication details. - -### message.trailers - -The request/response trailers object. Only populated at the `'end'` event. - -### message.url - -**Only valid for request obtained from [`http.Server`][].** - -Request URL string. This contains only the URL that is -present in the actual HTTP request. If the request is: - -``` -GET /status?name=ryan HTTP/1.1\r\n -Accept: text/plain\r\n -\r\n -``` - -Then `request.url` will be: - -``` -'/status?name=ryan' -``` - -If you would like to parse the URL into its parts, you can use -`require('url').parse(request.url)`. Example: - -``` -$ node -> require('url').parse('/status?name=ryan') -{ - href: '/status?name=ryan', - search: '?name=ryan', - query: 'name=ryan', - pathname: '/status' -} -``` - -If you would like to extract the params from the query string, -you can use the `require('querystring').parse` function, or pass -`true` as the second argument to `require('url').parse`. Example: - -``` -$ node -> require('url').parse('/status?name=ryan', true) -{ - href: '/status?name=ryan', - search: '?name=ryan', - query: {name: 'ryan'}, - pathname: '/status' -} -``` - -## http.METHODS - -* {Array} - -A list of the HTTP methods that are supported by the parser. - -## http.STATUS_CODES - -* {Object} - -A collection of all the standard HTTP response status codes, and the -short description of each. For example, `http.STATUS_CODES[404] === 'Not -Found'`. - -## http.createClient([port][, host]) - - Stability: 0 - Deprecated: Use [`http.request()`][] instead. - -Constructs a new HTTP client. `port` and `host` refer to the server to be -connected to. - -## http.createServer([requestListener]) - -Returns a new instance of [`http.Server`][]. - -The `requestListener` is a function which is automatically -added to the `'request'` event. - -## http.get(options[, callback]) - -Since most requests are GET requests without bodies, Node.js provides this -convenience method. The only difference between this method and [`http.request()`][] -is that it sets the method to GET and calls `req.end()` automatically. - -Example: - -```js -http.get('http://www.google.com/index.html', (res) => { - console.log(`Got response: ${res.statusCode}`); - // consume response body - res.resume(); -}).on('error', (e) => { - console.log(`Got error: ${e.message}`); -}); -``` - -## http.globalAgent - -Global instance of Agent which is used as the default for all http client -requests. - -## http.request(options[, callback]) - -Node.js maintains several connections per server to make HTTP requests. -This function allows one to transparently issue requests. - -`options` can be an object or a string. If `options` is a string, it is -automatically parsed with [`url.parse()`][]. - -Options: - -- `protocol`: Protocol to use. Defaults to `'http:'`. -- `host`: A domain name or IP address of the server to issue the request to. - Defaults to `'localhost'`. -- `hostname`: Alias for `host`. To support [`url.parse()`][] `hostname` is - preferred over `host`. -- `family`: IP address family to use when resolving `host` and `hostname`. - Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be - used. -- `port`: Port of remote server. Defaults to 80. -- `localAddress`: Local interface to bind for network connections. -- `socketPath`: Unix Domain Socket (use one of host:port or socketPath). -- `method`: A string specifying the HTTP request method. Defaults to `'GET'`. -- `path`: Request path. Defaults to `'/'`. Should include query string if any. - E.G. `'/index.html?page=12'`. An exception is thrown when the request path - contains illegal characters. Currently, only spaces are rejected but that - may change in the future. -- `headers`: An object containing request headers. -- `auth`: Basic authentication i.e. `'user:password'` to compute an - Authorization header. -- `agent`: Controls [`Agent`][] behavior. When an Agent is used request will - default to `Connection: keep-alive`. Possible values: - - `undefined` (default): use [`http.globalAgent`][] for this host and port. - - `Agent` object: explicitly use the passed in `Agent`. - - `false`: opts out of connection pooling with an Agent, defaults request to - `Connection: close`. -- `createConnection`: A function that produces a socket/stream to use for the - request when the `agent` option is not used. This can be used to avoid - creating a custom Agent class just to override the default `createConnection` - function. See [`agent.createConnection()`][] for more details. - -The optional `callback` parameter will be added as a one time listener for -the `'response'` event. - -`http.request()` returns an instance of the [`http.ClientRequest`][] -class. The `ClientRequest` instance is a writable stream. If one needs to -upload a file with a POST request, then write to the `ClientRequest` object. - -Example: - -```js -var postData = querystring.stringify({ - 'msg' : 'Hello World!' -}); - -var options = { - hostname: 'www.google.com', - port: 80, - path: '/upload', - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Content-Length': postData.length - } -}; - -var req = http.request(options, (res) => { - console.log(`STATUS: ${res.statusCode}`); - console.log(`HEADERS: ${JSON.stringify(res.headers)}`); - res.setEncoding('utf8'); - res.on('data', (chunk) => { - console.log(`BODY: ${chunk}`); - }); - res.on('end', () => { - console.log('No more data in response.') - }) -}); - -req.on('error', (e) => { - console.log(`problem with request: ${e.message}`); -}); - -// write data to request body -req.write(postData); -req.end(); -``` - -Note that in the example `req.end()` was called. With `http.request()` one -must always call `req.end()` to signify that you're done with the request - -even if there is no data being written to the request body. - -If any error is encountered during the request (be that with DNS resolution, -TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted -on the returned request object. As with all `'error'` events, if no listeners -are registered the error will be thrown. - -There are a few special headers that should be noted. - -* Sending a 'Connection: keep-alive' will notify Node.js that the connection to - the server should be persisted until the next request. - -* Sending a 'Content-length' header will disable the default chunked encoding. - -* Sending an 'Expect' header will immediately send the request headers. - Usually, when sending 'Expect: 100-continue', you should both set a timeout - and listen for the `'continue'` event. See RFC2616 Section 8.2.3 for more - information. - -* Sending an Authorization header will override using the `auth` option - to compute basic authentication. - -[`'checkContinue'`]: #http_event_checkcontinue -[`'listening'`]: net.html#net_event_listening -[`'response'`]: #http_event_response -[`Agent`]: #http_class_http_agent -[`agent.createConnection()`]: #http_agent_createconnection -[`Buffer`]: buffer.html#buffer_buffer -[`destroy()`]: #http_agent_destroy -[`EventEmitter`]: events.html#events_class_events_eventemitter -[`http.Agent`]: #http_class_http_agent -[`http.ClientRequest`]: #http_class_http_clientrequest -[`http.globalAgent`]: #http_http_globalagent -[`http.IncomingMessage`]: #http_class_http_incomingmessage -[`http.request()`]: #http_http_request_options_callback -[`http.Server`]: #http_class_http_server -[`http.ServerResponse`]: #http_class_http_serverresponse -[`message.headers`]: #http_message_headers -[`net.createConnection()`]: net.html#net_net_createconnection_options_connectlistener -[`net.Server`]: net.html#net_class_net_server -[`net.Server.close()`]: net.html#net_server_close_callback -[`net.Server.listen()`]: net.html#net_server_listen_handle_callback -[`net.Server.listen(path)`]: net.html#net_server_listen_path_callback -[`net.Server.listen(port)`]: net.html#net_server_listen_port_hostname_backlog_callback -[`net.Socket`]: net.html#net_class_net_socket -[`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed -[`response.end()`]: #http_response_end_data_encoding_callback -[`response.setHeader()`]: #http_response_setheader_name_value -[`response.write()`]: #http_response_write_chunk_encoding_callback -[`response.write(data, encoding)`]: #http_response_write_chunk_encoding_callback -[`response.writeContinue()`]: #http_response_writecontinue -[`response.writeHead()`]: #http_response_writehead_statuscode_statusmessage_headers -[`socket.setKeepAlive()`]: net.html#net_socket_setkeepalive_enable_initialdelay -[`socket.setNoDelay()`]: net.html#net_socket_setnodelay_nodelay -[`socket.setTimeout()`]: net.html#net_socket_settimeout_timeout_callback -[`stream.setEncoding()`]: stream.html#stream_stream_setencoding_encoding -[`TypeError`]: errors.html#errors_class_typeerror -[`url.parse()`]: url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost -[constructor options]: #http_new_agent_options -[Readable Stream]: stream.html#stream_class_stream_readable -[Writable Stream]: stream.html#stream_class_stream_writable diff --git a/doc/api/http.md b/doc/api/http.md new file mode 100644 index 00000000000000..bddea87234e5bd --- /dev/null +++ b/doc/api/http.md @@ -0,0 +1,1241 @@ +# HTTP + + Stability: 2 - Stable + +To use the HTTP server and client one must `require('http')`. + +The HTTP interfaces in Node.js are designed to support many features +of the protocol which have been traditionally difficult to use. +In particular, large, possibly chunk-encoded, messages. The interface is +careful to never buffer entire requests or responses--the +user is able to stream data. + +HTTP message headers are represented by an object like this: + +``` +{ 'content-length': '123', + 'content-type': 'text/plain', + 'connection': 'keep-alive', + 'host': 'mysite.com', + 'accept': '*/*' } +``` + +Keys are lowercased. Values are not modified. + +In order to support the full spectrum of possible HTTP applications, Node.js's +HTTP API is very low-level. It deals with stream handling and message +parsing only. It parses a message into headers and body but it does not +parse the actual headers or the body. + +See [`message.headers`][] for details on how duplicate headers are handled. + +The raw headers as they were received are retained in the `rawHeaders` +property, which is an array of `[key, value, key2, value2, ...]`. For +example, the previous message header object might have a `rawHeaders` +list like the following: + +``` +[ 'ConTent-Length', '123456', + 'content-LENGTH', '123', + 'content-type', 'text/plain', + 'CONNECTION', 'keep-alive', + 'Host', 'mysite.com', + 'accepT', '*/*' ] +``` + +## Class: http.Agent + +The HTTP Agent is used for pooling sockets used in HTTP client +requests. + +The HTTP Agent also defaults client requests to using +Connection:keep-alive. If no pending HTTP requests are waiting on a +socket to become free the socket is closed. This means that Node.js's +pool has the benefit of keep-alive when under load but still does not +require developers to manually close the HTTP clients using +KeepAlive. + +If you opt into using HTTP KeepAlive, you can create an Agent object +with that flag set to `true`. (See the [constructor options][].) +Then, the Agent will keep unused sockets in a pool for later use. They +will be explicitly marked so as to not keep the Node.js process running. +However, it is still a good idea to explicitly [`destroy()`][] KeepAlive +agents when they are no longer in use, so that the Sockets will be shut +down. + +Sockets are removed from the agent's pool when the socket emits either +a `'close'` event or a special `'agentRemove'` event. This means that if +you intend to keep one HTTP request open for a long time and don't +want it to stay in the pool you can do something along the lines of: + +```js +http.get(options, (res) => { + // Do stuff +}).on('socket', (socket) => { + socket.emit('agentRemove'); +}); +``` + +Alternatively, you could just opt out of pooling entirely using +`agent:false`: + +```js +http.get({ + hostname: 'localhost', + port: 80, + path: '/', + agent: false // create a new agent just for this one request +}, (res) => { + // Do stuff with response +}) +``` + +### new Agent([options]) + +* `options` {Object} Set of configurable options to set on the agent. + Can have the following fields: + * `keepAlive` {Boolean} Keep sockets around in a pool to be used by + other requests in the future. Default = `false` + * `keepAliveMsecs` {Integer} When using HTTP KeepAlive, how often + to send TCP KeepAlive packets over sockets being kept alive. + Default = `1000`. Only relevant if `keepAlive` is set to `true`. + * `maxSockets` {Number} Maximum number of sockets to allow per + host. Default = `Infinity`. + * `maxFreeSockets` {Number} Maximum number of sockets to leave open + in a free state. Only relevant if `keepAlive` is set to `true`. + Default = `256`. + +The default [`http.globalAgent`][] that is used by [`http.request()`][] has all +of these values set to their respective defaults. + +To configure any of them, you must create your own [`http.Agent`][] object. + +```js +const http = require('http'); +var keepAliveAgent = new http.Agent({ keepAlive: true }); +options.agent = keepAliveAgent; +http.request(options, onResponseCallback); +``` + +### agent.createConnection(options[, callback]) + +Produces a socket/stream to be used for HTTP requests. + +By default, this function is the same as [`net.createConnection()`][]. However, +custom Agents may override this method in case greater flexibility is desired. + +A socket/stream can be supplied in one of two ways: by returning the +socket/stream from this function, or by passing the socket/stream to `callback`. + +`callback` has a signature of `(err, stream)`. + +### agent.destroy() + +Destroy any sockets that are currently in use by the agent. + +It is usually not necessary to do this. However, if you are using an +agent with KeepAlive enabled, then it is best to explicitly shut down +the agent when you know that it will no longer be used. Otherwise, +sockets may hang open for quite a long time before the server +terminates them. + +### agent.freeSockets + +An object which contains arrays of sockets currently awaiting use by +the Agent when HTTP KeepAlive is used. Do not modify. + +### agent.getName(options) + +Get a unique name for a set of request options, to determine whether a +connection can be reused. In the http agent, this returns +`host:port:localAddress`. In the https agent, the name includes the +CA, cert, ciphers, and other HTTPS/TLS-specific options that determine +socket reusability. + +Options: + +- `host`: A domain name or IP address of the server to issue the request to. +- `port`: Port of remote server. +- `localAddress`: Local interface to bind for network connections when issuing + the request. + +### agent.maxFreeSockets + +By default set to 256. For Agents supporting HTTP KeepAlive, this +sets the maximum number of sockets that will be left open in the free +state. + +### agent.maxSockets + +By default set to Infinity. Determines how many concurrent sockets the agent +can have open per origin. Origin is either a 'host:port' or +'host:port:localAddress' combination. + +### agent.requests + +An object which contains queues of requests that have not yet been assigned to +sockets. Do not modify. + +### agent.sockets + +An object which contains arrays of sockets currently in use by the +Agent. Do not modify. + +## Class: http.ClientRequest + +This object is created internally and returned from [`http.request()`][]. It +represents an _in-progress_ request whose header has already been queued. The +header is still mutable using the `setHeader(name, value)`, `getHeader(name)`, +`removeHeader(name)` API. The actual header will be sent along with the first +data chunk or when closing the connection. + +To get the response, add a listener for `'response'` to the request object. +`'response'` will be emitted from the request object when the response +headers have been received. The `'response'` event is executed with one +argument which is an instance of [`http.IncomingMessage`][]. + +During the `'response'` event, one can add listeners to the +response object; particularly to listen for the `'data'` event. + +If no `'response'` handler is added, then the response will be +entirely discarded. However, if you add a `'response'` event handler, +then you **must** consume the data from the response object, either by +calling `response.read()` whenever there is a `'readable'` event, or +by adding a `'data'` handler, or by calling the `.resume()` method. +Until the data is consumed, the `'end'` event will not fire. Also, until +the data is read it will consume memory that can eventually lead to a +'process out of memory' error. + +Note: Node.js does not check whether Content-Length and the length of the body +which has been transmitted are equal or not. + +The request implements the [Writable Stream][] interface. This is an +[`EventEmitter`][] with the following events: + +### Event: 'abort' + +`function () { }` + +Emitted when the request has been aborted by the client. This event is only +emitted on the first call to `abort()`. + +### Event: 'checkExpectation' + +`function (request, response) { }` + +Emitted each time a request with an http Expect header is received, where the +value is not 100-continue. If this event isn't listened for, the server will +automatically respond with a 417 Expectation Failed as appropriate. + +Note that when this event is emitted and handled, the `request` event will +not be emitted. + +### Event: 'connect' + +`function (response, socket, head) { }` + +Emitted each time a server responds to a request with a `CONNECT` method. If this +event isn't being listened for, clients receiving a `CONNECT` method will have +their connections closed. + +A client server pair that show you how to listen for the `'connect'` event. + +```js +const http = require('http'); +const net = require('net'); +const url = require('url'); + +// Create an HTTP tunneling proxy +var proxy = http.createServer( (req, res) => { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('okay'); +}); +proxy.on('connect', (req, cltSocket, head) => { + // connect to an origin server + var srvUrl = url.parse(`http://${req.url}`); + var srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => { + cltSocket.write('HTTP/1.1 200 Connection Established\r\n' + + 'Proxy-agent: Node.js-Proxy\r\n' + + '\r\n'); + srvSocket.write(head); + srvSocket.pipe(cltSocket); + cltSocket.pipe(srvSocket); + }); +}); + +// now that proxy is running +proxy.listen(1337, '127.0.0.1', () => { + + // make a request to a tunneling proxy + var options = { + port: 1337, + hostname: '127.0.0.1', + method: 'CONNECT', + path: 'www.google.com:80' + }; + + var req = http.request(options); + req.end(); + + req.on('connect', (res, socket, head) => { + console.log('got connected!'); + + // make a request over an HTTP tunnel + socket.write('GET / HTTP/1.1\r\n' + + 'Host: www.google.com:80\r\n' + + 'Connection: close\r\n' + + '\r\n'); + socket.on('data', (chunk) => { + console.log(chunk.toString()); + }); + socket.on('end', () => { + proxy.close(); + }); + }); +}); +``` + +### Event: 'continue' + +`function () { }` + +Emitted when the server sends a '100 Continue' HTTP response, usually because +the request contained 'Expect: 100-continue'. This is an instruction that +the client should send the request body. + +### Event: 'response' + +`function (response) { }` + +Emitted when a response is received to this request. This event is emitted only +once. The `response` argument will be an instance of [`http.IncomingMessage`][]. + +### Event: 'socket' + +`function (socket) { }` + +Emitted after a socket is assigned to this request. + +### Event: 'upgrade' + +`function (response, socket, head) { }` + +Emitted each time a server responds to a request with an upgrade. If this +event isn't being listened for, clients receiving an upgrade header will have +their connections closed. + +A client server pair that show you how to listen for the `'upgrade'` event. + +```js +const http = require('http'); + +// Create an HTTP server +var srv = http.createServer( (req, res) => { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('okay'); +}); +srv.on('upgrade', (req, socket, head) => { + socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n' + + 'Upgrade: WebSocket\r\n' + + 'Connection: Upgrade\r\n' + + '\r\n'); + + socket.pipe(socket); // echo back +}); + +// now that server is running +srv.listen(1337, '127.0.0.1', () => { + + // make a request + var options = { + port: 1337, + hostname: '127.0.0.1', + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket' + } + }; + + var req = http.request(options); + req.end(); + + req.on('upgrade', (res, socket, upgradeHead) => { + console.log('got upgraded!'); + socket.end(); + process.exit(0); + }); +}); +``` + +### request.abort() + +Marks the request as aborting. Calling this will cause remaining data +in the response to be dropped and the socket to be destroyed. + +### request.end([data][, encoding][, callback]) + +Finishes sending the request. If any parts of the body are +unsent, it will flush them to the stream. If the request is +chunked, this will send the terminating `'0\r\n\r\n'`. + +If `data` is specified, it is equivalent to calling +[`response.write(data, encoding)`][] followed by `request.end(callback)`. + +If `callback` is specified, it will be called when the request stream +is finished. + +### request.flushHeaders() + +Flush the request headers. + +For efficiency reasons, Node.js normally buffers the request headers until you +call `request.end()` or write the first chunk of request data. It then tries +hard to pack the request headers and data into a single TCP packet. + +That's usually what you want (it saves a TCP round-trip) but not when the first +data isn't sent until possibly much later. `request.flushHeaders()` lets you bypass +the optimization and kickstart the request. + +### request.setNoDelay([noDelay]) + +Once a socket is assigned to this request and is connected +[`socket.setNoDelay()`][] will be called. + +### request.setSocketKeepAlive([enable][, initialDelay]) + +Once a socket is assigned to this request and is connected +[`socket.setKeepAlive()`][] will be called. + +### request.setTimeout(timeout[, callback]) + +Once a socket is assigned to this request and is connected +[`socket.setTimeout()`][] will be called. + +* `timeout` {Number} Milliseconds before a request is considered to be timed out. +* `callback` {Function} Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. + +### request.write(chunk[, encoding][, callback]) + +Sends a chunk of the body. By calling this method +many times, the user can stream a request body to a +server--in that case it is suggested to use the +`['Transfer-Encoding', 'chunked']` header line when +creating the request. + +The `chunk` argument should be a [`Buffer`][] or a string. + +The `encoding` argument is optional and only applies when `chunk` is a string. +Defaults to `'utf8'`. + +The `callback` argument is optional and will be called when this chunk of data +is flushed. + +Returns `request`. + +## Class: http.Server + +This class inherits from [`net.Server`][] and has the following additional events: + +### Event: 'checkContinue' + +`function (request, response) { }` + +Emitted each time a request with an http Expect: 100-continue is received. +If this event isn't listened for, the server will automatically respond +with a 100 Continue as appropriate. + +Handling this event involves calling [`response.writeContinue()`][] if the client +should continue to send the request body, or generating an appropriate HTTP +response (e.g., 400 Bad Request) if the client should not continue to send the +request body. + +Note that when this event is emitted and handled, the `'request'` event will +not be emitted. + +### Event: 'clientError' + +`function (exception, socket) { }` + +If a client connection emits an `'error'` event, it will be forwarded here. + +`socket` is the [`net.Socket`][] object that the error originated from. + +### Event: 'close' + +`function () { }` + +Emitted when the server closes. + +### Event: 'connect' + +`function (request, socket, head) { }` + +Emitted each time a client requests a http `CONNECT` method. If this event isn't +listened for, then clients requesting a `CONNECT` method will have their +connections closed. + +* `request` is the arguments for the http request, as it is in the request + event. +* `socket` is the network socket between the server and client. +* `head` is an instance of Buffer, the first packet of the tunneling stream, + this may be empty. + +After this event is emitted, the request's socket will not have a `'data'` +event listener, meaning you will need to bind to it in order to handle data +sent to the server on that socket. + +### Event: 'connection' + +`function (socket) { }` + +When a new TCP stream is established. `socket` is an object of type +[`net.Socket`][]. Usually users will not want to access this event. In +particular, the socket will not emit `'readable'` events because of how +the protocol parser attaches to the socket. The `socket` can also be +accessed at `request.connection`. + +### Event: 'request' + +`function (request, response) { }` + +Emitted each time there is a request. Note that there may be multiple requests +per connection (in the case of keep-alive connections). + `request` is an instance of [`http.IncomingMessage`][] and `response` is +an instance of [`http.ServerResponse`][]. + +### Event: 'upgrade' + +`function (request, socket, head) { }` + +Emitted each time a client requests a http upgrade. If this event isn't +listened for, then clients requesting an upgrade will have their connections +closed. + +* `request` is the arguments for the http request, as it is in the request + event. +* `socket` is the network socket between the server and client. +* `head` is an instance of Buffer, the first packet of the upgraded stream, + this may be empty. + +After this event is emitted, the request's socket will not have a `'data'` +event listener, meaning you will need to bind to it in order to handle data +sent to the server on that socket. + +### server.close([callback]) + +Stops the server from accepting new connections. See [`net.Server.close()`][]. + +### server.listen(handle[, callback]) + +* `handle` {Object} +* `callback` {Function} + +The `handle` object can be set to either a server or socket (anything +with an underlying `_handle` member), or a `{fd: }` object. + +This will cause the server to accept connections on the specified +handle, but it is presumed that the file descriptor or handle has +already been bound to a port or domain socket. + +Listening on a file descriptor is not supported on Windows. + +This function is asynchronous. The last parameter `callback` will be added as +a listener for the `'listening'` event. See also [`net.Server.listen()`][]. + +Returns `server`. + +### server.listen(path[, callback]) + +Start a UNIX socket server listening for connections on the given `path`. + +This function is asynchronous. The last parameter `callback` will be added as +a listener for the `'listening'` event. See also [`net.Server.listen(path)`][]. + +### server.listen(port[, hostname][, backlog][, callback]) + +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. + +To listen to a unix socket, supply a filename instead of port and hostname. + +Backlog is the maximum length of the queue of pending connections. +The actual length will be determined by your OS through sysctl settings such as +`tcp_max_syn_backlog` and `somaxconn` on linux. The default value of this +parameter is 511 (not 512). + +This function is asynchronous. The last parameter `callback` will be added as +a listener for the `'listening'` event. See also [`net.Server.listen(port)`][]. + +### server.listening + +A Boolean indicating whether or not the server is listening for +connections. + +### server.maxHeadersCount + +Limits maximum incoming headers count, equal to 1000 by default. If set to 0 - +no limit will be applied. + +### server.setTimeout(msecs, callback) + +* `msecs` {Number} +* `callback` {Function} + +Sets the timeout value for sockets, and emits a `'timeout'` event on +the Server object, passing the socket as an argument, if a timeout +occurs. + +If there is a `'timeout'` event listener on the Server object, then it +will be called with the timed-out socket as an argument. + +By default, the Server's timeout value is 2 minutes, and sockets are +destroyed automatically if they time out. However, if you assign a +callback to the Server's `'timeout'` event, then you are responsible +for handling socket timeouts. + +Returns `server`. + +### server.timeout + +* {Number} Default = 120000 (2 minutes) + +The number of milliseconds of inactivity before a socket is presumed +to have timed out. + +Note that the socket timeout logic is set up on connection, so +changing this value only affects *new* connections to the server, not +any existing connections. + +Set to 0 to disable any kind of automatic timeout behavior on incoming +connections. + +## Class: http.ServerResponse + +This object is created internally by a HTTP server--not by the user. It is +passed as the second parameter to the `'request'` event. + +The response implements the [Writable Stream][] interface. This is an +[`EventEmitter`][] with the following events: + +### Event: 'close' + +`function () { }` + +Indicates that the underlying connection was terminated before +[`response.end()`][] was called or able to flush. + +### Event: 'finish' + +`function () { }` + +Emitted when the response has been sent. More specifically, this event is +emitted when the last segment of the response headers and body have been +handed off to the operating system for transmission over the network. It +does not imply that the client has received anything yet. + +After this event, no more events will be emitted on the response object. + +### response.addTrailers(headers) + +This method adds HTTP trailing headers (a header but at the end of the +message) to the response. + +Trailers will **only** be emitted if chunked encoding is used for the +response; if it is not (e.g., if the request was HTTP/1.0), they will +be silently discarded. + +Note that HTTP requires the `Trailer` header to be sent if you intend to +emit trailers, with a list of the header fields in its value. E.g., + +```js +response.writeHead(200, { 'Content-Type': 'text/plain', + 'Trailer': 'Content-MD5' }); +response.write(fileData); +response.addTrailers({'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667'}); +response.end(); +``` + +Attempting to set a header field name or value that contains invalid characters +will result in a [`TypeError`][] being thrown. + +### response.end([data][, encoding][, callback]) + +This method signals to the server that all of the response headers and body +have been sent; that server should consider this message complete. +The method, `response.end()`, MUST be called on each response. + +If `data` is specified, it is equivalent to calling +[`response.write(data, encoding)`][] followed by `response.end(callback)`. + +If `callback` is specified, it will be called when the response stream +is finished. + +### response.finished + +Boolean value that indicates whether the response has completed. Starts +as `false`. After [`response.end()`][] executes, the value will be `true`. + +### response.getHeader(name) + +Reads out a header that's already been queued but not sent to the client. Note +that the name is case insensitive. This can only be called before headers get +implicitly flushed. + +Example: + +```js +var contentType = response.getHeader('content-type'); +``` + +### response.headersSent + +Boolean (read-only). True if headers were sent, false otherwise. + +### response.removeHeader(name) + +Removes a header that's queued for implicit sending. + +Example: + +```js +response.removeHeader('Content-Encoding'); +``` + +### response.sendDate + +When true, the Date header will be automatically generated and sent in +the response if it is not already present in the headers. Defaults to true. + +This should only be disabled for testing; HTTP requires the Date header +in responses. + +### response.setHeader(name, value) + +Sets a single header value for implicit headers. If this header already exists +in the to-be-sent headers, its value will be replaced. Use an array of strings +here if you need to send multiple headers with the same name. + +Example: + +```js +response.setHeader('Content-Type', 'text/html'); +``` + +or + +```js +response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); +``` + +Attempting to set a header field name or value that contains invalid characters +will result in a [`TypeError`][] being thrown. + +When headers have been set with [`response.setHeader()`][], they will be merged with +any headers passed to [`response.writeHead()`][], with the headers passed to +[`response.writeHead()`][] given precedence. + +```js +// returns content-type = text/plain +const server = http.createServer((req,res) => { + res.setHeader('Content-Type', 'text/html'); + res.setHeader('X-Foo', 'bar'); + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('ok'); +}); +``` + +### response.setTimeout(msecs, callback) + +* `msecs` {Number} +* `callback` {Function} + +Sets the Socket's timeout value to `msecs`. If a callback is +provided, then it is added as a listener on the `'timeout'` event on +the response object. + +If no `'timeout'` listener is added to the request, the response, or +the server, then sockets are destroyed when they time out. If you +assign a handler on the request, the response, or the server's +`'timeout'` events, then it is your responsibility to handle timed out +sockets. + +Returns `response`. + +### response.statusCode + +When using implicit headers (not calling [`response.writeHead()`][] explicitly), +this property controls the status code that will be sent to the client when +the headers get flushed. + +Example: + +```js +response.statusCode = 404; +``` + +After response header was sent to the client, this property indicates the +status code which was sent out. + +### response.statusMessage + +When using implicit headers (not calling [`response.writeHead()`][] explicitly), this property +controls the status message that will be sent to the client when the headers get +flushed. If this is left as `undefined` then the standard message for the status +code will be used. + +Example: + +```js +response.statusMessage = 'Not found'; +``` + +After response header was sent to the client, this property indicates the +status message which was sent out. + +### response.write(chunk[, encoding][, callback]) + +If this method is called and [`response.writeHead()`][] has not been called, +it will switch to implicit header mode and flush the implicit headers. + +This sends a chunk of the response body. This method may +be called multiple times to provide successive parts of the body. + +`chunk` can be a string or a buffer. If `chunk` is a string, +the second parameter specifies how to encode it into a byte stream. +By default the `encoding` is `'utf8'`. The last parameter `callback` +will be called when this chunk of data is flushed. + +**Note**: This is the raw HTTP body and has nothing to do with +higher-level multi-part body encodings that may be used. + +The first time [`response.write()`][] is called, it will send the buffered +header information and the first body to the client. The second time +[`response.write()`][] is called, Node.js assumes you're going to be streaming +data, and sends that separately. That is, the response is buffered up to the +first chunk of body. + +Returns `true` if the entire data was flushed successfully to the kernel +buffer. Returns `false` if all or part of the data was queued in user memory. +`'drain'` will be emitted when the buffer is free again. + +### response.writeContinue() + +Sends a HTTP/1.1 100 Continue message to the client, indicating that +the request body should be sent. See the [`'checkContinue'`][] event on `Server`. + +### response.writeHead(statusCode[, statusMessage][, headers]) + +Sends a response header to the request. The status code is a 3-digit HTTP +status code, like `404`. The last argument, `headers`, are the response headers. +Optionally one can give a human-readable `statusMessage` as the second +argument. + +Example: + +```js +var body = 'hello world'; +response.writeHead(200, { + 'Content-Length': body.length, + 'Content-Type': 'text/plain' }); +``` + +This method must only be called once on a message and it must +be called before [`response.end()`][] is called. + +If you call [`response.write()`][] or [`response.end()`][] before calling this, +the implicit/mutable headers will be calculated and call this function for you. + +When headers have been set with [`response.setHeader()`][], they will be merged with +any headers passed to [`response.writeHead()`][], with the headers passed to +[`response.writeHead()`][] given precedence. + +```js +// returns content-type = text/plain +const server = http.createServer((req,res) => { + res.setHeader('Content-Type', 'text/html'); + res.setHeader('X-Foo', 'bar'); + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('ok'); +}); +``` + +Note that Content-Length is given in bytes not characters. The above example +works because the string `'hello world'` contains only single byte characters. +If the body contains higher coded characters then `Buffer.byteLength()` +should be used to determine the number of bytes in a given encoding. +And Node.js does not check whether Content-Length and the length of the body +which has been transmitted are equal or not. + +Attempting to set a header field name or value that contains invalid characters +will result in a [`TypeError`][] being thrown. + +## Class: http.IncomingMessage + +An `IncomingMessage` object is created by [`http.Server`][] or +[`http.ClientRequest`][] and passed as the first argument to the `'request'` +and `'response'` event respectively. It may be used to access response status, +headers and data. + +It implements the [Readable Stream][] interface, as well as the +following additional events, methods, and properties. + +### Event: 'close' + +`function () { }` + +Indicates that the underlying connection was closed. +Just like `'end'`, this event occurs only once per response. + +### message.headers + +The request/response headers object. + +Key-value pairs of header names and values. Header names are lower-cased. +Example: + +```js +// Prints something like: +// +// { 'user-agent': 'curl/7.22.0', +// host: '127.0.0.1:8000', +// accept: '*/*' } +console.log(request.headers); +``` + +Duplicates in raw headers are handled in the following ways, depending on the +header name: + +* Duplicates of `age`, `authorization`, `content-length`, `content-type`, +`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`, +`last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`, +`retry-after`, or `user-agent` are discarded. +* `set-cookie` is always an array. Duplicates are added to the array. +* For all other headers, the values are joined together with ', '. + +### message.httpVersion + +In case of server request, the HTTP version sent by the client. In the case of +client response, the HTTP version of the connected-to server. +Probably either `'1.1'` or `'1.0'`. + +Also `message.httpVersionMajor` is the first integer and +`message.httpVersionMinor` is the second. + +### message.method + +**Only valid for request obtained from [`http.Server`][].** + +The request method as a string. Read only. Example: +`'GET'`, `'DELETE'`. + +### message.rawHeaders + +The raw request/response headers list exactly as they were received. + +Note that the keys and values are in the same list. It is *not* a +list of tuples. So, the even-numbered offsets are key values, and the +odd-numbered offsets are the associated values. + +Header names are not lowercased, and duplicates are not merged. + +```js +// Prints something like: +// +// [ 'user-agent', +// 'this is invalid because there can be only one', +// 'User-Agent', +// 'curl/7.22.0', +// 'Host', +// '127.0.0.1:8000', +// 'ACCEPT', +// '*/*' ] +console.log(request.rawHeaders); +``` + +### message.rawTrailers + +The raw request/response trailer keys and values exactly as they were +received. Only populated at the `'end'` event. + +### message.setTimeout(msecs, callback) + +* `msecs` {Number} +* `callback` {Function} + +Calls `message.connection.setTimeout(msecs, callback)`. + +Returns `message`. + +### message.statusCode + +**Only valid for response obtained from [`http.ClientRequest`][].** + +The 3-digit HTTP response status code. E.G. `404`. + +### message.statusMessage + +**Only valid for response obtained from [`http.ClientRequest`][].** + +The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. + +### message.socket + +The [`net.Socket`][] object associated with the connection. + +With HTTPS support, use [`request.socket.getPeerCertificate()`][] to obtain the +client's authentication details. + +### message.trailers + +The request/response trailers object. Only populated at the `'end'` event. + +### message.url + +**Only valid for request obtained from [`http.Server`][].** + +Request URL string. This contains only the URL that is +present in the actual HTTP request. If the request is: + +``` +GET /status?name=ryan HTTP/1.1\r\n +Accept: text/plain\r\n +\r\n +``` + +Then `request.url` will be: + +``` +'/status?name=ryan' +``` + +If you would like to parse the URL into its parts, you can use +`require('url').parse(request.url)`. Example: + +``` +$ node +> require('url').parse('/status?name=ryan') +{ + href: '/status?name=ryan', + search: '?name=ryan', + query: 'name=ryan', + pathname: '/status' +} +``` + +If you would like to extract the params from the query string, +you can use the `require('querystring').parse` function, or pass +`true` as the second argument to `require('url').parse`. Example: + +``` +$ node +> require('url').parse('/status?name=ryan', true) +{ + href: '/status?name=ryan', + search: '?name=ryan', + query: {name: 'ryan'}, + pathname: '/status' +} +``` + +## http.METHODS + +* {Array} + +A list of the HTTP methods that are supported by the parser. + +## http.STATUS_CODES + +* {Object} + +A collection of all the standard HTTP response status codes, and the +short description of each. For example, `http.STATUS_CODES[404] === 'Not +Found'`. + +## http.createClient([port][, host]) + + Stability: 0 - Deprecated: Use [`http.request()`][] instead. + +Constructs a new HTTP client. `port` and `host` refer to the server to be +connected to. + +## http.createServer([requestListener]) + +Returns a new instance of [`http.Server`][]. + +The `requestListener` is a function which is automatically +added to the `'request'` event. + +## http.get(options[, callback]) + +Since most requests are GET requests without bodies, Node.js provides this +convenience method. The only difference between this method and [`http.request()`][] +is that it sets the method to GET and calls `req.end()` automatically. + +Example: + +```js +http.get('http://www.google.com/index.html', (res) => { + console.log(`Got response: ${res.statusCode}`); + // consume response body + res.resume(); +}).on('error', (e) => { + console.log(`Got error: ${e.message}`); +}); +``` + +## http.globalAgent + +Global instance of Agent which is used as the default for all http client +requests. + +## http.request(options[, callback]) + +Node.js maintains several connections per server to make HTTP requests. +This function allows one to transparently issue requests. + +`options` can be an object or a string. If `options` is a string, it is +automatically parsed with [`url.parse()`][]. + +Options: + +- `protocol`: Protocol to use. Defaults to `'http:'`. +- `host`: A domain name or IP address of the server to issue the request to. + Defaults to `'localhost'`. +- `hostname`: Alias for `host`. To support [`url.parse()`][] `hostname` is + preferred over `host`. +- `family`: IP address family to use when resolving `host` and `hostname`. + Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be + used. +- `port`: Port of remote server. Defaults to 80. +- `localAddress`: Local interface to bind for network connections. +- `socketPath`: Unix Domain Socket (use one of host:port or socketPath). +- `method`: A string specifying the HTTP request method. Defaults to `'GET'`. +- `path`: Request path. Defaults to `'/'`. Should include query string if any. + E.G. `'/index.html?page=12'`. An exception is thrown when the request path + contains illegal characters. Currently, only spaces are rejected but that + may change in the future. +- `headers`: An object containing request headers. +- `auth`: Basic authentication i.e. `'user:password'` to compute an + Authorization header. +- `agent`: Controls [`Agent`][] behavior. When an Agent is used request will + default to `Connection: keep-alive`. Possible values: + - `undefined` (default): use [`http.globalAgent`][] for this host and port. + - `Agent` object: explicitly use the passed in `Agent`. + - `false`: opts out of connection pooling with an Agent, defaults request to + `Connection: close`. +- `createConnection`: A function that produces a socket/stream to use for the + request when the `agent` option is not used. This can be used to avoid + creating a custom Agent class just to override the default `createConnection` + function. See [`agent.createConnection()`][] for more details. + +The optional `callback` parameter will be added as a one time listener for +the `'response'` event. + +`http.request()` returns an instance of the [`http.ClientRequest`][] +class. The `ClientRequest` instance is a writable stream. If one needs to +upload a file with a POST request, then write to the `ClientRequest` object. + +Example: + +```js +var postData = querystring.stringify({ + 'msg' : 'Hello World!' +}); + +var options = { + hostname: 'www.google.com', + port: 80, + path: '/upload', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Length': postData.length + } +}; + +var req = http.request(options, (res) => { + console.log(`STATUS: ${res.statusCode}`); + console.log(`HEADERS: ${JSON.stringify(res.headers)}`); + res.setEncoding('utf8'); + res.on('data', (chunk) => { + console.log(`BODY: ${chunk}`); + }); + res.on('end', () => { + console.log('No more data in response.') + }) +}); + +req.on('error', (e) => { + console.log(`problem with request: ${e.message}`); +}); + +// write data to request body +req.write(postData); +req.end(); +``` + +Note that in the example `req.end()` was called. With `http.request()` one +must always call `req.end()` to signify that you're done with the request - +even if there is no data being written to the request body. + +If any error is encountered during the request (be that with DNS resolution, +TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted +on the returned request object. As with all `'error'` events, if no listeners +are registered the error will be thrown. + +There are a few special headers that should be noted. + +* Sending a 'Connection: keep-alive' will notify Node.js that the connection to + the server should be persisted until the next request. + +* Sending a 'Content-length' header will disable the default chunked encoding. + +* Sending an 'Expect' header will immediately send the request headers. + Usually, when sending 'Expect: 100-continue', you should both set a timeout + and listen for the `'continue'` event. See RFC2616 Section 8.2.3 for more + information. + +* Sending an Authorization header will override using the `auth` option + to compute basic authentication. + +[`'checkContinue'`]: #http_event_checkcontinue +[`'listening'`]: net.html#net_event_listening +[`'response'`]: #http_event_response +[`Agent`]: #http_class_http_agent +[`agent.createConnection()`]: #http_agent_createconnection_options_callback +[`Buffer`]: buffer.html#buffer_buffer +[`destroy()`]: #http_agent_destroy +[`EventEmitter`]: events.html#events_class_eventemitter +[`http.Agent`]: #http_class_http_agent +[`http.ClientRequest`]: #http_class_http_clientrequest +[`http.globalAgent`]: #http_http_globalagent +[`http.IncomingMessage`]: #http_class_http_incomingmessage +[`http.request()`]: #http_http_request_options_callback +[`http.Server`]: #http_class_http_server +[`http.ServerResponse`]: #http_class_http_serverresponse +[`message.headers`]: #http_message_headers +[`net.createConnection()`]: net.html#net_net_createconnection_options_connectlistener +[`net.Server`]: net.html#net_class_net_server +[`net.Server.close()`]: net.html#net_server_close_callback +[`net.Server.listen()`]: net.html#net_server_listen_handle_backlog_callback +[`net.Server.listen(path)`]: net.html#net_server_listen_path_backlog_callback +[`net.Server.listen(port)`]: net.html#net_server_listen_port_hostname_backlog_callback +[`net.Socket`]: net.html#net_class_net_socket +[`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed +[`response.end()`]: #http_response_end_data_encoding_callback +[`response.setHeader()`]: #http_response_setheader_name_value +[`response.write()`]: #http_response_write_chunk_encoding_callback +[`response.write(data, encoding)`]: #http_response_write_chunk_encoding_callback +[`response.writeContinue()`]: #http_response_writecontinue +[`response.writeHead()`]: #http_response_writehead_statuscode_statusmessage_headers +[`socket.setKeepAlive()`]: net.html#net_socket_setkeepalive_enable_initialdelay +[`socket.setNoDelay()`]: net.html#net_socket_setnodelay_nodelay +[`socket.setTimeout()`]: net.html#net_socket_settimeout_timeout_callback +[`stream.setEncoding()`]: stream.html#stream_stream_setencoding_encoding +[`TypeError`]: errors.html#errors_class_typeerror +[`url.parse()`]: url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost +[constructor options]: #http_new_agent_options +[Readable Stream]: stream.html#stream_class_stream_readable +[Writable Stream]: stream.html#stream_class_stream_writable diff --git a/doc/api/https.markdown b/doc/api/https.md similarity index 100% rename from doc/api/https.markdown rename to doc/api/https.md diff --git a/doc/api/index.markdown b/doc/api/index.markdown deleted file mode 100644 index 1a774507aef098..00000000000000 --- a/doc/api/index.markdown +++ /dev/null @@ -1 +0,0 @@ -@include _toc.markdown diff --git a/doc/api/index.md b/doc/api/index.md new file mode 100644 index 00000000000000..400faf6e5ed34a --- /dev/null +++ b/doc/api/index.md @@ -0,0 +1 @@ +@include _toc.md diff --git a/doc/api/modules.markdown b/doc/api/modules.md similarity index 100% rename from doc/api/modules.markdown rename to doc/api/modules.md diff --git a/doc/api/net.markdown b/doc/api/net.markdown deleted file mode 100644 index 10129c13b8944f..00000000000000 --- a/doc/api/net.markdown +++ /dev/null @@ -1,737 +0,0 @@ -# net - - Stability: 2 - Stable - -The `net` module provides you with an asynchronous network wrapper. It contains -functions for creating both servers and clients (called streams). You can include -this module with `require('net');`. - -## Class: net.Server - -This class is used to create a TCP or local server. - -`net.Server` is an [`EventEmitter`][] with the following events: - -### Event: 'close' - -Emitted when the server closes. Note that if connections exist, this -event is not emitted until all connections are ended. - -### Event: 'connection' - -* {net.Socket} The connection object - -Emitted when a new connection is made. `socket` is an instance of -`net.Socket`. - -### Event: 'error' - -* {Error} - -Emitted when an error occurs. The [`'close'`][] event will be called directly -following this event. See example in discussion of `server.listen`. - -### Event: 'listening' - -Emitted when the server has been bound after calling `server.listen`. - -### server.address() - -Returns the bound address, the address family name and port of the server -as reported by the operating system. -Useful to find which port was assigned when giving getting an OS-assigned address. -Returns an object with three properties, e.g. -`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` - -Example: - -```js -var server = net.createServer((socket) => { - socket.end('goodbye\n'); -}).on('error', (err) => { - // handle errors here - throw err; -}); - -// grab a random port. -server.listen(() => { - address = server.address(); - console.log('opened server on %j', address); -}); -``` - -Don't call `server.address()` until the `'listening'` event has been emitted. - -### server.close([callback]) - -Stops the server from accepting new connections and keeps existing -connections. This function is asynchronous, the server is finally -closed when all connections are ended and the server emits a [`'close'`][] event. -The optional `callback` will be called once the `'close'` event occurs. Unlike -that event, it will be called with an Error as its only argument if the server -was not open when it was closed. - -### server.connections - - Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. - -The number of concurrent connections on the server. - -This becomes `null` when sending a socket to a child with -[`child_process.fork()`][]. To poll forks and get current number of active -connections use asynchronous `server.getConnections` instead. - -### server.getConnections(callback) - -Asynchronously get the number of concurrent connections on the server. Works -when sockets were sent to forks. - -Callback should take two arguments `err` and `count`. - -### server.listen(handle[, backlog][, callback]) - -* `handle` {Object} -* `backlog` {Number} -* `callback` {Function} - -The `handle` object can be set to either a server or socket (anything -with an underlying `_handle` member), or a `{fd: }` object. - -This will cause the server to accept connections on the specified -handle, but it is presumed that the file descriptor or handle has -already been bound to a port or domain socket. - -Listening on a file descriptor is not supported on Windows. - -This function is asynchronous. When the server has been bound, -[`'listening'`][] event will be emitted. -The last parameter `callback` will be added as a listener for the -[`'listening'`][] event. - -The parameter `backlog` behaves the same as in -[`server.listen(port[, hostname][, backlog][, callback])`][`server.listen(port, host, backlog, callback)`]. - -### server.listen(options[, callback]) - -* `options` {Object} - Required. Supports the following properties: - * `port` {Number} - Optional. - * `host` {String} - Optional. - * `backlog` {Number} - Optional. - * `path` {String} - Optional. - * `exclusive` {Boolean} - Optional. -* `callback` {Function} - Optional. - -The `port`, `host`, and `backlog` properties of `options`, as well as the -optional callback function, behave as they do on a call to -[`server.listen(port[, hostname][, backlog][, callback])`][`server.listen(port, host, backlog, callback)`]. -Alternatively, the `path` option can be used to specify a UNIX socket. - -If `exclusive` is `false` (default), then cluster workers will use the same -underlying handle, allowing connection handling duties to be shared. When -`exclusive` is `true`, the handle is not shared, and attempted port sharing -results in an error. An example which listens on an exclusive port is -shown below. - -```js -server.listen({ - host: 'localhost', - port: 80, - exclusive: true -}); -``` - -### server.listen(path[, backlog][, callback]) - -* `path` {String} -* `backlog` {Number} -* `callback` {Function} - -Start a local socket server listening for connections on the given `path`. - -This function is asynchronous. When the server has been bound, -[`'listening'`][] event will be emitted. The last parameter `callback` -will be added as a listener for the [`'listening'`][] event. - -On UNIX, the local domain is usually known as the UNIX domain. The path is a -filesystem path name. It is subject to the same naming conventions and -permissions checks as would be done on file creation, will be visible in the -filesystem, and will *persist until unlinked*. - -On Windows, the local domain is implemented using a named pipe. The path *must* -refer to an entry in `\\?\pipe\` or `\\.\pipe\`. Any characters are permitted, -but the latter may do some processing of pipe names, such as resolving `..` -sequences. Despite appearances, the pipe name space is flat. Pipes will *not -persist*, they are removed when the last reference to them is closed. Do not -forget JavaScript string escaping requires paths to be specified with -double-backslashes, such as: - - net.createServer().listen( - path.join('\\\\?\\pipe', process.cwd(), 'myctl')) - -The parameter `backlog` behaves the same as in -[`server.listen(port[, hostname][, backlog][, callback])`][`server.listen(port, host, backlog, callback)`]. - -### server.listen(port[, hostname][, backlog][, callback]) - -Begin accepting connections on the specified `port` and `hostname`. If the -`hostname` is omitted, the server will accept connections on any IPv6 address -(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A -port value of zero will assign a random port. - -Backlog is the maximum length of the queue of pending connections. -The actual length will be determined by your OS through sysctl settings such as -`tcp_max_syn_backlog` and `somaxconn` on linux. The default value of this -parameter is 511 (not 512). - -This function is asynchronous. When the server has been bound, -[`'listening'`][] event will be emitted. The last parameter `callback` -will be added as a listener for the [`'listening'`][] event. - -One issue some users run into is getting `EADDRINUSE` errors. This means that -another server is already running on the requested port. One way of handling this -would be to wait a second and then try again. This can be done with - -```js -server.on('error', (e) => { - if (e.code == 'EADDRINUSE') { - console.log('Address in use, retrying...'); - setTimeout(() => { - server.close(); - server.listen(PORT, HOST); - }, 1000); - } -}); -``` - -(Note: All sockets in Node.js set `SO_REUSEADDR` already) - -### server.listening - -A Boolean indicating whether or not the server is listening for -connections. - -### server.maxConnections - -Set this property to reject connections when the server's connection count gets -high. - -It is not recommended to use this option once a socket has been sent to a child -with [`child_process.fork()`][]. - -### server.ref() - -Opposite of `unref`, calling `ref` on a previously `unref`d server will *not* -let the program exit if it's the only server left (the default behavior). If -the server is `ref`d calling `ref` again will have no effect. - -Returns `server`. - -### server.unref() - -Calling `unref` on a server will allow the program to exit if this is the only -active server in the event system. If the server is already `unref`d calling -`unref` again will have no effect. - -Returns `server`. - -## Class: net.Socket - -This object is an abstraction of a TCP or local socket. `net.Socket` -instances implement a duplex Stream interface. They can be created by the -user and used as a client (with [`connect()`][]) or they can be created by Node.js -and passed to the user through the `'connection'` event of a server. - -### new net.Socket([options]) - -Construct a new socket object. - -`options` is an object with the following defaults: - -```js -{ - fd: null, - allowHalfOpen: false, - readable: false, - writable: false -} -``` - -`fd` allows you to specify the existing file descriptor of socket. -Set `readable` and/or `writable` to `true` to allow reads and/or writes on this -socket (NOTE: Works only when `fd` is passed). -About `allowHalfOpen`, refer to `createServer()` and `'end'` event. - -`net.Socket` instances are [`EventEmitter`][] with the following events: - -### Event: 'close' - -* `had_error` {Boolean} `true` if the socket had a transmission error. - -Emitted once the socket is fully closed. The argument `had_error` is a boolean -which says if the socket was closed due to a transmission error. - -### Event: 'connect' - -Emitted when a socket connection is successfully established. -See [`connect()`][]. - -### Event: 'data' - -* {Buffer} - -Emitted when data is received. The argument `data` will be a `Buffer` or -`String`. Encoding of data is set by `socket.setEncoding()`. -(See the [Readable Stream][] section for more information.) - -Note that the __data will be lost__ if there is no listener when a `Socket` -emits a `'data'` event. - -### Event: 'drain' - -Emitted when the write buffer becomes empty. Can be used to throttle uploads. - -See also: the return values of `socket.write()` - -### Event: 'end' - -Emitted when the other end of the socket sends a FIN packet. - -By default (`allowHalfOpen == false`) the socket will destroy its file -descriptor once it has written out its pending write queue. However, by -setting `allowHalfOpen == true` the socket will not automatically `end()` -its side allowing the user to write arbitrary amounts of data, with the -caveat that the user is required to `end()` their side now. - -### Event: 'error' - -* {Error} - -Emitted when an error occurs. The `'close'` event will be called directly -following this event. - -### Event: 'lookup' - -Emitted after resolving the hostname but before connecting. -Not applicable to UNIX sockets. - -* `err` {Error|Null} The error object. See [`dns.lookup()`][]. -* `address` {String} The IP address. -* `family` {String|Null} The address type. See [`dns.lookup()`][]. -* `host` {String} The hostname. - -### Event: 'timeout' - -Emitted if the socket times out from inactivity. This is only to notify that -the socket has been idle. The user must manually close the connection. - -See also: [`socket.setTimeout()`][] - -### socket.address() - -Returns the bound address, the address family name and port of the -socket as reported by the operating system. Returns an object with -three properties, e.g. -`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` - -### socket.bufferSize - -`net.Socket` has the property that `socket.write()` always works. This is to -help users get up and running quickly. The computer cannot always keep up -with the amount of data that is written to a socket - the network connection -simply might be too slow. Node.js will internally queue up the data written to a -socket and send it out over the wire when it is possible. (Internally it is -polling on the socket's file descriptor for being writable). - -The consequence of this internal buffering is that memory may grow. This -property shows the number of characters currently buffered to be written. -(Number of characters is approximately equal to the number of bytes to be -written, but the buffer may contain strings, and the strings are lazily -encoded, so the exact number of bytes is not known.) - -Users who experience large or growing `bufferSize` should attempt to -"throttle" the data flows in their program with [`pause()`][] and [`resume()`][]. - -### socket.bytesRead - -The amount of received bytes. - -### socket.bytesWritten - -The amount of bytes sent. - -### socket.connect(options[, connectListener]) - -Opens the connection for a given socket. - -For TCP sockets, `options` argument should be an object which specifies: - - - `port`: Port the client should connect to (Required). - - - `host`: Host the client should connect to. Defaults to `'localhost'`. - - - `localAddress`: Local interface to bind to for network connections. - - - `localPort`: Local port to bind to for network connections. - - - `family` : Version of IP stack. Defaults to `4`. - - - `hints`: [`dns.lookup()` hints][]. Defaults to `0`. - - - `lookup` : Custom lookup function. Defaults to `dns.lookup`. - -For local domain sockets, `options` argument should be an object which -specifies: - - - `path`: Path the client should connect to (Required). - -Normally this method is not needed, as `net.createConnection` opens the -socket. Use this only if you are implementing a custom Socket. - -This function is asynchronous. When the [`'connect'`][] event is emitted the -socket is established. If there is a problem connecting, the `'connect'` event -will not be emitted, the [`'error'`][] event will be emitted with the exception. - -The `connectListener` parameter will be added as a listener for the -[`'connect'`][] event. - -### socket.connect(path[, connectListener]) -### socket.connect(port[, host][, connectListener]) - -As [`socket.connect(options\[, connectListener\])`][`socket.connect(options, connectListener)`], -with options either as either `{port: port, host: host}` or `{path: path}`. - -### socket.destroy() - -Ensures that no more I/O activity happens on this socket. Only necessary in -case of errors (parse error or so). - -### socket.end([data][, encoding]) - -Half-closes the socket. i.e., it sends a FIN packet. It is possible the -server will still send some data. - -If `data` is specified, it is equivalent to calling -`socket.write(data, encoding)` followed by `socket.end()`. - -### socket.localAddress - -The string representation of the local IP address the remote client is -connecting on. For example, if you are listening on `'0.0.0.0'` and the -client connects on `'192.168.1.1'`, the value would be `'192.168.1.1'`. - -### socket.localPort - -The numeric representation of the local port. For example, -`80` or `21`. - -### socket.pause() - -Pauses the reading of data. That is, [`'data'`][] events will not be emitted. -Useful to throttle back an upload. - -### socket.ref() - -Opposite of `unref`, calling `ref` on a previously `unref`d socket will *not* -let the program exit if it's the only socket left (the default behavior). If -the socket is `ref`d calling `ref` again will have no effect. - -Returns `socket`. - -### socket.remoteAddress - -The string representation of the remote IP address. For example, -`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if -the socket is destroyed (for example, if the client disconnected). - -### socket.remoteFamily - -The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. - -### socket.remotePort - -The numeric representation of the remote port. For example, -`80` or `21`. - -### socket.resume() - -Resumes reading after a call to [`pause()`][]. - -### socket.setEncoding([encoding]) - -Set the encoding for the socket as a [Readable Stream][]. See -[`stream.setEncoding()`][] for more information. - -### socket.setKeepAlive([enable][, initialDelay]) - -Enable/disable keep-alive functionality, and optionally set the initial -delay before the first keepalive probe is sent on an idle socket. -`enable` defaults to `false`. - -Set `initialDelay` (in milliseconds) to set the delay between the last -data packet received and the first keepalive probe. Setting 0 for -initialDelay will leave the value unchanged from the default -(or previous) setting. Defaults to `0`. - -Returns `socket`. - -### socket.setNoDelay([noDelay]) - -Disables the Nagle algorithm. By default TCP connections use the Nagle -algorithm, they buffer data before sending it off. Setting `true` for -`noDelay` will immediately fire off data each time `socket.write()` is called. -`noDelay` defaults to `true`. - -Returns `socket`. - -### socket.setTimeout(timeout[, callback]) - -Sets the socket to timeout after `timeout` milliseconds of inactivity on -the socket. By default `net.Socket` do not have a timeout. - -When an idle timeout is triggered the socket will receive a [`'timeout'`][] -event but the connection will not be severed. The user must manually [`end()`][] -or [`destroy()`][] the socket. - -If `timeout` is 0, then the existing idle timeout is disabled. - -The optional `callback` parameter will be added as a one time listener for the -[`'timeout'`][] event. - -Returns `socket`. - -### socket.unref() - -Calling `unref` on a socket will allow the program to exit if this is the only -active socket in the event system. If the socket is already `unref`d calling -`unref` again will have no effect. - -Returns `socket`. - -### socket.write(data[, encoding][, callback]) - -Sends data on the socket. The second parameter specifies the encoding in the -case of a string--it defaults to UTF8 encoding. - -Returns `true` if the entire data was flushed successfully to the kernel -buffer. Returns `false` if all or part of the data was queued in user memory. -[`'drain'`][] will be emitted when the buffer is again free. - -The optional `callback` parameter will be executed when the data is finally -written out - this may not be immediately. - -## net.connect(options[, connectListener]) - -A factory function, which returns a new [`net.Socket`][] and automatically -connects with the supplied `options`. - -The options are passed to both the [`net.Socket`][] constructor and the -[`socket.connect`][] method. - -The `connectListener` parameter will be added as a listener for the -[`'connect'`][] event once. - -Here is an example of a client of the previously described echo server: - -```js -const net = require('net'); -const client = net.connect({port: 8124}, () => { - // 'connect' listener - console.log('connected to server!'); - client.write('world!\r\n'); -}); -client.on('data', (data) => { - console.log(data.toString()); - client.end(); -}); -client.on('end', () => { - console.log('disconnected from server'); -}); -``` - -To connect on the socket `/tmp/echo.sock` the second line would just be -changed to - -```js -const client = net.connect({path: '/tmp/echo.sock'}); -``` - -## net.connect(path[, connectListener]) - -A factory function, which returns a new unix [`net.Socket`][] and automatically -connects to the supplied `path`. - -The `connectListener` parameter will be added as a listener for the -[`'connect'`][] event once. - -## net.connect(port[, host][, connectListener]) - -A factory function, which returns a new [`net.Socket`][] and automatically -connects to the supplied `port` and `host`. - -If `host` is omitted, `'localhost'` will be assumed. - -The `connectListener` parameter will be added as a listener for the -[`'connect'`][] event once. - -## net.createConnection(options[, connectListener]) - -A factory function, which returns a new [`net.Socket`][] and automatically -connects with the supplied `options`. - -The options are passed to both the [`net.Socket`][] constructor and the -[`socket.connect`][] method. - -The `connectListener` parameter will be added as a listener for the -[`'connect'`][] event once. - -Here is an example of a client of the previously described echo server: - -```js -const net = require('net'); -const client = net.createConnection({port: 8124}, () => { - //'connect' listener - console.log('connected to server!'); - client.write('world!\r\n'); -}); -client.on('data', (data) => { - console.log(data.toString()); - client.end(); -}); -client.on('end', () => { - console.log('disconnected from server'); -}); -``` - -To connect on the socket `/tmp/echo.sock` the second line would just be -changed to - -```js -const client = net.connect({path: '/tmp/echo.sock'}); -``` - -## net.createConnection(path[, connectListener]) - -A factory function, which returns a new unix [`net.Socket`][] and automatically -connects to the supplied `path`. - -The `connectListener` parameter will be added as a listener for the -[`'connect'`][] event once. - -## net.createConnection(port[, host][, connectListener]) - -A factory function, which returns a new [`net.Socket`][] and automatically -connects to the supplied `port` and `host`. - -If `host` is omitted, `'localhost'` will be assumed. - -The `connectListener` parameter will be added as a listener for the -[`'connect'`][] event once. - -## net.createServer([options][, connectionListener]) - -Creates a new server. The `connectionListener` argument is -automatically set as a listener for the [`'connection'`][] event. - -`options` is an object with the following defaults: - -```js -{ - allowHalfOpen: false, - pauseOnConnect: false -} -``` - -If `allowHalfOpen` is `true`, then the socket won't automatically send a FIN -packet when the other end of the socket sends a FIN packet. The socket becomes -non-readable, but still writable. You should call the [`end()`][] method explicitly. -See [`'end'`][] event for more information. - -If `pauseOnConnect` is `true`, then the socket associated with each incoming -connection will be paused, and no data will be read from its handle. This allows -connections to be passed between processes without any data being read by the -original process. To begin reading data from a paused socket, call [`resume()`][]. - -Here is an example of an echo server which listens for connections -on port 8124: - -```js -const net = require('net'); -const server = net.createServer((c) => { - // 'connection' listener - console.log('client connected'); - c.on('end', () => { - console.log('client disconnected'); - }); - c.write('hello\r\n'); - c.pipe(c); -}); -server.on('error', (err) => { - throw err; -}); -server.listen(8124, () => { - console.log('server bound'); -}); -``` - -Test this by using `telnet`: - -``` -telnet localhost 8124 -``` - -To listen on the socket `/tmp/echo.sock` the third line from the last would -just be changed to - -```js -server.listen('/tmp/echo.sock', () => { - console.log('server bound'); -}); -``` - -Use `nc` to connect to a UNIX domain socket server: - -```js -nc -U /tmp/echo.sock -``` - -## net.isIP(input) - -Tests if input is an IP address. Returns 0 for invalid strings, -returns 4 for IP version 4 addresses, and returns 6 for IP version 6 addresses. - - -## net.isIPv4(input) - -Returns true if input is a version 4 IP address, otherwise returns false. - - -## net.isIPv6(input) - -Returns true if input is a version 6 IP address, otherwise returns false. - -[`'close'`]: #net_event_close -[`'connect'`]: #net_event_connect -[`'connection'`]: #net_event_connection -[`'data'`]: #net_event_data -[`'drain'`]: #net_event_drain -[`'end'`]: #net_event_end -[`'error'`]: #net_event_error_1 -[`'listening'`]: #net_event_listening -[`'timeout'`]: #net_event_timeout -[`child_process.fork()`]: child_process.html#child_process_child_process_fork_modulepath_args_options -[`connect()`]: #net_socket_connect_options_connectlistener -[`destroy()`]: #net_socket_destroy -[`dns.lookup()`]: dns.html#dns_dns_lookup_hostname_options_callback -[`dns.lookup()` hints]: #dns_supported_getaddrinfo_flags -[`end()`]: #net_socket_end_data_encoding -[`EventEmitter`]: events.html#events_class_events_eventemitter -[`net.Socket`]: #net_class_net_socket -[`pause()`]: #net_socket_pause -[`resume()`]: #net_socket_resume -[`server.getConnections()`]: #net_server_getconnections_callback -[`server.listen(port, host, backlog, callback)`]: #net_server_listen_port_hostname_backlog_callback -[`socket.connect(options, connectListener)`]: #net_socket_connect_options_connectlistener -[`socket.connect`]: #net_socket_connect_options_connectlistener -[`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback -[`stream.setEncoding()`]: stream.html#stream_readable_setencoding_encoding -[Readable Stream]: stream.html#stream_class_stream_readable diff --git a/doc/api/net.md b/doc/api/net.md new file mode 100644 index 00000000000000..7a58bf23108710 --- /dev/null +++ b/doc/api/net.md @@ -0,0 +1,737 @@ +# net + + Stability: 2 - Stable + +The `net` module provides you with an asynchronous network wrapper. It contains +functions for creating both servers and clients (called streams). You can include +this module with `require('net');`. + +## Class: net.Server + +This class is used to create a TCP or local server. + +`net.Server` is an [`EventEmitter`][] with the following events: + +### Event: 'close' + +Emitted when the server closes. Note that if connections exist, this +event is not emitted until all connections are ended. + +### Event: 'connection' + +* {net.Socket} The connection object + +Emitted when a new connection is made. `socket` is an instance of +`net.Socket`. + +### Event: 'error' + +* {Error} + +Emitted when an error occurs. The [`'close'`][] event will be called directly +following this event. See example in discussion of `server.listen`. + +### Event: 'listening' + +Emitted when the server has been bound after calling `server.listen`. + +### server.address() + +Returns the bound address, the address family name and port of the server +as reported by the operating system. +Useful to find which port was assigned when giving getting an OS-assigned address. +Returns an object with three properties, e.g. +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +Example: + +```js +var server = net.createServer((socket) => { + socket.end('goodbye\n'); +}).on('error', (err) => { + // handle errors here + throw err; +}); + +// grab a random port. +server.listen(() => { + address = server.address(); + console.log('opened server on %j', address); +}); +``` + +Don't call `server.address()` until the `'listening'` event has been emitted. + +### server.close([callback]) + +Stops the server from accepting new connections and keeps existing +connections. This function is asynchronous, the server is finally +closed when all connections are ended and the server emits a [`'close'`][] event. +The optional `callback` will be called once the `'close'` event occurs. Unlike +that event, it will be called with an Error as its only argument if the server +was not open when it was closed. + +### server.connections + + Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. + +The number of concurrent connections on the server. + +This becomes `null` when sending a socket to a child with +[`child_process.fork()`][]. To poll forks and get current number of active +connections use asynchronous `server.getConnections` instead. + +### server.getConnections(callback) + +Asynchronously get the number of concurrent connections on the server. Works +when sockets were sent to forks. + +Callback should take two arguments `err` and `count`. + +### server.listen(handle[, backlog][, callback]) + +* `handle` {Object} +* `backlog` {Number} +* `callback` {Function} + +The `handle` object can be set to either a server or socket (anything +with an underlying `_handle` member), or a `{fd: }` object. + +This will cause the server to accept connections on the specified +handle, but it is presumed that the file descriptor or handle has +already been bound to a port or domain socket. + +Listening on a file descriptor is not supported on Windows. + +This function is asynchronous. When the server has been bound, +[`'listening'`][] event will be emitted. +The last parameter `callback` will be added as a listener for the +[`'listening'`][] event. + +The parameter `backlog` behaves the same as in +[`server.listen(port[, hostname][, backlog][, callback])`][`server.listen(port, host, backlog, callback)`]. + +### server.listen(options[, callback]) + +* `options` {Object} - Required. Supports the following properties: + * `port` {Number} - Optional. + * `host` {String} - Optional. + * `backlog` {Number} - Optional. + * `path` {String} - Optional. + * `exclusive` {Boolean} - Optional. +* `callback` {Function} - Optional. + +The `port`, `host`, and `backlog` properties of `options`, as well as the +optional callback function, behave as they do on a call to +[`server.listen(port[, hostname][, backlog][, callback])`][`server.listen(port, host, backlog, callback)`]. +Alternatively, the `path` option can be used to specify a UNIX socket. + +If `exclusive` is `false` (default), then cluster workers will use the same +underlying handle, allowing connection handling duties to be shared. When +`exclusive` is `true`, the handle is not shared, and attempted port sharing +results in an error. An example which listens on an exclusive port is +shown below. + +```js +server.listen({ + host: 'localhost', + port: 80, + exclusive: true +}); +``` + +### server.listen(path[, backlog][, callback]) + +* `path` {String} +* `backlog` {Number} +* `callback` {Function} + +Start a local socket server listening for connections on the given `path`. + +This function is asynchronous. When the server has been bound, +[`'listening'`][] event will be emitted. The last parameter `callback` +will be added as a listener for the [`'listening'`][] event. + +On UNIX, the local domain is usually known as the UNIX domain. The path is a +filesystem path name. It is subject to the same naming conventions and +permissions checks as would be done on file creation, will be visible in the +filesystem, and will *persist until unlinked*. + +On Windows, the local domain is implemented using a named pipe. The path *must* +refer to an entry in `\\?\pipe\` or `\\.\pipe\`. Any characters are permitted, +but the latter may do some processing of pipe names, such as resolving `..` +sequences. Despite appearances, the pipe name space is flat. Pipes will *not +persist*, they are removed when the last reference to them is closed. Do not +forget JavaScript string escaping requires paths to be specified with +double-backslashes, such as: + + net.createServer().listen( + path.join('\\\\?\\pipe', process.cwd(), 'myctl')) + +The parameter `backlog` behaves the same as in +[`server.listen(port[, hostname][, backlog][, callback])`][`server.listen(port, host, backlog, callback)`]. + +### server.listen(port[, hostname][, backlog][, callback]) + +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. + +Backlog is the maximum length of the queue of pending connections. +The actual length will be determined by your OS through sysctl settings such as +`tcp_max_syn_backlog` and `somaxconn` on linux. The default value of this +parameter is 511 (not 512). + +This function is asynchronous. When the server has been bound, +[`'listening'`][] event will be emitted. The last parameter `callback` +will be added as a listener for the [`'listening'`][] event. + +One issue some users run into is getting `EADDRINUSE` errors. This means that +another server is already running on the requested port. One way of handling this +would be to wait a second and then try again. This can be done with + +```js +server.on('error', (e) => { + if (e.code == 'EADDRINUSE') { + console.log('Address in use, retrying...'); + setTimeout(() => { + server.close(); + server.listen(PORT, HOST); + }, 1000); + } +}); +``` + +(Note: All sockets in Node.js set `SO_REUSEADDR` already) + +### server.listening + +A Boolean indicating whether or not the server is listening for +connections. + +### server.maxConnections + +Set this property to reject connections when the server's connection count gets +high. + +It is not recommended to use this option once a socket has been sent to a child +with [`child_process.fork()`][]. + +### server.ref() + +Opposite of `unref`, calling `ref` on a previously `unref`d server will *not* +let the program exit if it's the only server left (the default behavior). If +the server is `ref`d calling `ref` again will have no effect. + +Returns `server`. + +### server.unref() + +Calling `unref` on a server will allow the program to exit if this is the only +active server in the event system. If the server is already `unref`d calling +`unref` again will have no effect. + +Returns `server`. + +## Class: net.Socket + +This object is an abstraction of a TCP or local socket. `net.Socket` +instances implement a duplex Stream interface. They can be created by the +user and used as a client (with [`connect()`][]) or they can be created by Node.js +and passed to the user through the `'connection'` event of a server. + +### new net.Socket([options]) + +Construct a new socket object. + +`options` is an object with the following defaults: + +```js +{ + fd: null, + allowHalfOpen: false, + readable: false, + writable: false +} +``` + +`fd` allows you to specify the existing file descriptor of socket. +Set `readable` and/or `writable` to `true` to allow reads and/or writes on this +socket (NOTE: Works only when `fd` is passed). +About `allowHalfOpen`, refer to `createServer()` and `'end'` event. + +`net.Socket` instances are [`EventEmitter`][] with the following events: + +### Event: 'close' + +* `had_error` {Boolean} `true` if the socket had a transmission error. + +Emitted once the socket is fully closed. The argument `had_error` is a boolean +which says if the socket was closed due to a transmission error. + +### Event: 'connect' + +Emitted when a socket connection is successfully established. +See [`connect()`][]. + +### Event: 'data' + +* {Buffer} + +Emitted when data is received. The argument `data` will be a `Buffer` or +`String`. Encoding of data is set by `socket.setEncoding()`. +(See the [Readable Stream][] section for more information.) + +Note that the __data will be lost__ if there is no listener when a `Socket` +emits a `'data'` event. + +### Event: 'drain' + +Emitted when the write buffer becomes empty. Can be used to throttle uploads. + +See also: the return values of `socket.write()` + +### Event: 'end' + +Emitted when the other end of the socket sends a FIN packet. + +By default (`allowHalfOpen == false`) the socket will destroy its file +descriptor once it has written out its pending write queue. However, by +setting `allowHalfOpen == true` the socket will not automatically `end()` +its side allowing the user to write arbitrary amounts of data, with the +caveat that the user is required to `end()` their side now. + +### Event: 'error' + +* {Error} + +Emitted when an error occurs. The `'close'` event will be called directly +following this event. + +### Event: 'lookup' + +Emitted after resolving the hostname but before connecting. +Not applicable to UNIX sockets. + +* `err` {Error|Null} The error object. See [`dns.lookup()`][]. +* `address` {String} The IP address. +* `family` {String|Null} The address type. See [`dns.lookup()`][]. +* `host` {String} The hostname. + +### Event: 'timeout' + +Emitted if the socket times out from inactivity. This is only to notify that +the socket has been idle. The user must manually close the connection. + +See also: [`socket.setTimeout()`][] + +### socket.address() + +Returns the bound address, the address family name and port of the +socket as reported by the operating system. Returns an object with +three properties, e.g. +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### socket.bufferSize + +`net.Socket` has the property that `socket.write()` always works. This is to +help users get up and running quickly. The computer cannot always keep up +with the amount of data that is written to a socket - the network connection +simply might be too slow. Node.js will internally queue up the data written to a +socket and send it out over the wire when it is possible. (Internally it is +polling on the socket's file descriptor for being writable). + +The consequence of this internal buffering is that memory may grow. This +property shows the number of characters currently buffered to be written. +(Number of characters is approximately equal to the number of bytes to be +written, but the buffer may contain strings, and the strings are lazily +encoded, so the exact number of bytes is not known.) + +Users who experience large or growing `bufferSize` should attempt to +"throttle" the data flows in their program with [`pause()`][] and [`resume()`][]. + +### socket.bytesRead + +The amount of received bytes. + +### socket.bytesWritten + +The amount of bytes sent. + +### socket.connect(options[, connectListener]) + +Opens the connection for a given socket. + +For TCP sockets, `options` argument should be an object which specifies: + + - `port`: Port the client should connect to (Required). + + - `host`: Host the client should connect to. Defaults to `'localhost'`. + + - `localAddress`: Local interface to bind to for network connections. + + - `localPort`: Local port to bind to for network connections. + + - `family` : Version of IP stack. Defaults to `4`. + + - `hints`: [`dns.lookup()` hints][]. Defaults to `0`. + + - `lookup` : Custom lookup function. Defaults to `dns.lookup`. + +For local domain sockets, `options` argument should be an object which +specifies: + + - `path`: Path the client should connect to (Required). + +Normally this method is not needed, as `net.createConnection` opens the +socket. Use this only if you are implementing a custom Socket. + +This function is asynchronous. When the [`'connect'`][] event is emitted the +socket is established. If there is a problem connecting, the `'connect'` event +will not be emitted, the [`'error'`][] event will be emitted with the exception. + +The `connectListener` parameter will be added as a listener for the +[`'connect'`][] event. + +### socket.connect(path[, connectListener]) +### socket.connect(port[, host][, connectListener]) + +As [`socket.connect(options\[, connectListener\])`][`socket.connect(options, connectListener)`], +with options either as either `{port: port, host: host}` or `{path: path}`. + +### socket.destroy() + +Ensures that no more I/O activity happens on this socket. Only necessary in +case of errors (parse error or so). + +### socket.end([data][, encoding]) + +Half-closes the socket. i.e., it sends a FIN packet. It is possible the +server will still send some data. + +If `data` is specified, it is equivalent to calling +`socket.write(data, encoding)` followed by `socket.end()`. + +### socket.localAddress + +The string representation of the local IP address the remote client is +connecting on. For example, if you are listening on `'0.0.0.0'` and the +client connects on `'192.168.1.1'`, the value would be `'192.168.1.1'`. + +### socket.localPort + +The numeric representation of the local port. For example, +`80` or `21`. + +### socket.pause() + +Pauses the reading of data. That is, [`'data'`][] events will not be emitted. +Useful to throttle back an upload. + +### socket.ref() + +Opposite of `unref`, calling `ref` on a previously `unref`d socket will *not* +let the program exit if it's the only socket left (the default behavior). If +the socket is `ref`d calling `ref` again will have no effect. + +Returns `socket`. + +### socket.remoteAddress + +The string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if +the socket is destroyed (for example, if the client disconnected). + +### socket.remoteFamily + +The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### socket.remotePort + +The numeric representation of the remote port. For example, +`80` or `21`. + +### socket.resume() + +Resumes reading after a call to [`pause()`][]. + +### socket.setEncoding([encoding]) + +Set the encoding for the socket as a [Readable Stream][]. See +[`stream.setEncoding()`][] for more information. + +### socket.setKeepAlive([enable][, initialDelay]) + +Enable/disable keep-alive functionality, and optionally set the initial +delay before the first keepalive probe is sent on an idle socket. +`enable` defaults to `false`. + +Set `initialDelay` (in milliseconds) to set the delay between the last +data packet received and the first keepalive probe. Setting 0 for +initialDelay will leave the value unchanged from the default +(or previous) setting. Defaults to `0`. + +Returns `socket`. + +### socket.setNoDelay([noDelay]) + +Disables the Nagle algorithm. By default TCP connections use the Nagle +algorithm, they buffer data before sending it off. Setting `true` for +`noDelay` will immediately fire off data each time `socket.write()` is called. +`noDelay` defaults to `true`. + +Returns `socket`. + +### socket.setTimeout(timeout[, callback]) + +Sets the socket to timeout after `timeout` milliseconds of inactivity on +the socket. By default `net.Socket` do not have a timeout. + +When an idle timeout is triggered the socket will receive a [`'timeout'`][] +event but the connection will not be severed. The user must manually [`end()`][] +or [`destroy()`][] the socket. + +If `timeout` is 0, then the existing idle timeout is disabled. + +The optional `callback` parameter will be added as a one time listener for the +[`'timeout'`][] event. + +Returns `socket`. + +### socket.unref() + +Calling `unref` on a socket will allow the program to exit if this is the only +active socket in the event system. If the socket is already `unref`d calling +`unref` again will have no effect. + +Returns `socket`. + +### socket.write(data[, encoding][, callback]) + +Sends data on the socket. The second parameter specifies the encoding in the +case of a string--it defaults to UTF8 encoding. + +Returns `true` if the entire data was flushed successfully to the kernel +buffer. Returns `false` if all or part of the data was queued in user memory. +[`'drain'`][] will be emitted when the buffer is again free. + +The optional `callback` parameter will be executed when the data is finally +written out - this may not be immediately. + +## net.connect(options[, connectListener]) + +A factory function, which returns a new [`net.Socket`][] and automatically +connects with the supplied `options`. + +The options are passed to both the [`net.Socket`][] constructor and the +[`socket.connect`][] method. + +The `connectListener` parameter will be added as a listener for the +[`'connect'`][] event once. + +Here is an example of a client of the previously described echo server: + +```js +const net = require('net'); +const client = net.connect({port: 8124}, () => { + // 'connect' listener + console.log('connected to server!'); + client.write('world!\r\n'); +}); +client.on('data', (data) => { + console.log(data.toString()); + client.end(); +}); +client.on('end', () => { + console.log('disconnected from server'); +}); +``` + +To connect on the socket `/tmp/echo.sock` the second line would just be +changed to + +```js +const client = net.connect({path: '/tmp/echo.sock'}); +``` + +## net.connect(path[, connectListener]) + +A factory function, which returns a new unix [`net.Socket`][] and automatically +connects to the supplied `path`. + +The `connectListener` parameter will be added as a listener for the +[`'connect'`][] event once. + +## net.connect(port[, host][, connectListener]) + +A factory function, which returns a new [`net.Socket`][] and automatically +connects to the supplied `port` and `host`. + +If `host` is omitted, `'localhost'` will be assumed. + +The `connectListener` parameter will be added as a listener for the +[`'connect'`][] event once. + +## net.createConnection(options[, connectListener]) + +A factory function, which returns a new [`net.Socket`][] and automatically +connects with the supplied `options`. + +The options are passed to both the [`net.Socket`][] constructor and the +[`socket.connect`][] method. + +The `connectListener` parameter will be added as a listener for the +[`'connect'`][] event once. + +Here is an example of a client of the previously described echo server: + +```js +const net = require('net'); +const client = net.createConnection({port: 8124}, () => { + //'connect' listener + console.log('connected to server!'); + client.write('world!\r\n'); +}); +client.on('data', (data) => { + console.log(data.toString()); + client.end(); +}); +client.on('end', () => { + console.log('disconnected from server'); +}); +``` + +To connect on the socket `/tmp/echo.sock` the second line would just be +changed to + +```js +const client = net.connect({path: '/tmp/echo.sock'}); +``` + +## net.createConnection(path[, connectListener]) + +A factory function, which returns a new unix [`net.Socket`][] and automatically +connects to the supplied `path`. + +The `connectListener` parameter will be added as a listener for the +[`'connect'`][] event once. + +## net.createConnection(port[, host][, connectListener]) + +A factory function, which returns a new [`net.Socket`][] and automatically +connects to the supplied `port` and `host`. + +If `host` is omitted, `'localhost'` will be assumed. + +The `connectListener` parameter will be added as a listener for the +[`'connect'`][] event once. + +## net.createServer([options][, connectionListener]) + +Creates a new server. The `connectionListener` argument is +automatically set as a listener for the [`'connection'`][] event. + +`options` is an object with the following defaults: + +```js +{ + allowHalfOpen: false, + pauseOnConnect: false +} +``` + +If `allowHalfOpen` is `true`, then the socket won't automatically send a FIN +packet when the other end of the socket sends a FIN packet. The socket becomes +non-readable, but still writable. You should call the [`end()`][] method explicitly. +See [`'end'`][] event for more information. + +If `pauseOnConnect` is `true`, then the socket associated with each incoming +connection will be paused, and no data will be read from its handle. This allows +connections to be passed between processes without any data being read by the +original process. To begin reading data from a paused socket, call [`resume()`][]. + +Here is an example of an echo server which listens for connections +on port 8124: + +```js +const net = require('net'); +const server = net.createServer((c) => { + // 'connection' listener + console.log('client connected'); + c.on('end', () => { + console.log('client disconnected'); + }); + c.write('hello\r\n'); + c.pipe(c); +}); +server.on('error', (err) => { + throw err; +}); +server.listen(8124, () => { + console.log('server bound'); +}); +``` + +Test this by using `telnet`: + +``` +telnet localhost 8124 +``` + +To listen on the socket `/tmp/echo.sock` the third line from the last would +just be changed to + +```js +server.listen('/tmp/echo.sock', () => { + console.log('server bound'); +}); +``` + +Use `nc` to connect to a UNIX domain socket server: + +```js +nc -U /tmp/echo.sock +``` + +## net.isIP(input) + +Tests if input is an IP address. Returns 0 for invalid strings, +returns 4 for IP version 4 addresses, and returns 6 for IP version 6 addresses. + + +## net.isIPv4(input) + +Returns true if input is a version 4 IP address, otherwise returns false. + + +## net.isIPv6(input) + +Returns true if input is a version 6 IP address, otherwise returns false. + +[`'close'`]: #net_event_close +[`'connect'`]: #net_event_connect +[`'connection'`]: #net_event_connection +[`'data'`]: #net_event_data +[`'drain'`]: #net_event_drain +[`'end'`]: #net_event_end +[`'error'`]: #net_event_error_1 +[`'listening'`]: #net_event_listening +[`'timeout'`]: #net_event_timeout +[`child_process.fork()`]: child_process.html#child_process_child_process_fork_modulepath_args_options +[`connect()`]: #net_socket_connect_options_connectlistener +[`destroy()`]: #net_socket_destroy +[`dns.lookup()`]: dns.html#dns_dns_lookup_hostname_options_callback +[`dns.lookup()` hints]: #dns_supported_getaddrinfo_flags +[`end()`]: #net_socket_end_data_encoding +[`EventEmitter`]: events.html#events_class_eventemitter +[`net.Socket`]: #net_class_net_socket +[`pause()`]: #net_socket_pause +[`resume()`]: #net_socket_resume +[`server.getConnections()`]: #net_server_getconnections_callback +[`server.listen(port, host, backlog, callback)`]: #net_server_listen_port_hostname_backlog_callback +[`socket.connect(options, connectListener)`]: #net_socket_connect_options_connectlistener +[`socket.connect`]: #net_socket_connect_options_connectlistener +[`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback +[`stream.setEncoding()`]: stream.html#stream_readable_setencoding_encoding +[Readable Stream]: stream.html#stream_class_stream_readable diff --git a/doc/api/os.markdown b/doc/api/os.md similarity index 100% rename from doc/api/os.markdown rename to doc/api/os.md diff --git a/doc/api/path.markdown b/doc/api/path.markdown deleted file mode 100644 index b1110e7f21aa0b..00000000000000 --- a/doc/api/path.markdown +++ /dev/null @@ -1,329 +0,0 @@ -# Path - - Stability: 2 - Stable - -This module contains utilities for handling and transforming file -paths. Almost all these methods perform only string transformations. -The file system is not consulted to check whether paths are valid. - -Use `require('path')` to use this module. The following methods are provided: - -## path.basename(p[, ext]) - -Return the last portion of a path. Similar to the Unix `basename` command. - -Example: - -```js -path.basename('/foo/bar/baz/asdf/quux.html') -// returns 'quux.html' - -path.basename('/foo/bar/baz/asdf/quux.html', '.html') -// returns 'quux' -``` - -## path.delimiter - -The platform-specific path delimiter, `;` or `':'`. - -An example on \*nix: - -```js -console.log(process.env.PATH) -// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' - -process.env.PATH.split(path.delimiter) -// returns ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] -``` - -An example on Windows: - -```js -console.log(process.env.PATH) -// 'C:\Windows\system32;C:\Windows;C:\Program Files\node\' - -process.env.PATH.split(path.delimiter) -// returns ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\'] -``` - -## path.dirname(p) - -Return the directory name of a path. Similar to the Unix `dirname` command. - -Example: - -```js -path.dirname('/foo/bar/baz/asdf/quux') -// returns '/foo/bar/baz/asdf' -``` - -## path.extname(p) - -Return the extension of the path, from the last '.' to end of string -in the last portion of the path. If there is no '.' in the last portion -of the path or the first character of it is '.', then it returns -an empty string. Examples: - -```js -path.extname('index.html') -// returns '.html' - -path.extname('index.coffee.md') -// returns '.md' - -path.extname('index.') -// returns '.' - -path.extname('index') -// returns '' - -path.extname('.index') -// returns '' -``` - -## path.format(pathObject) - -Returns a path string from an object. This is the opposite of [`path.parse`][]. - -If `pathObject` has `dir` and `base` properties, the returned string will -be a concatenation of the `dir` property, the platform-dependent path separator, -and the `base` property. - -If the `dir` property is not supplied, the `root` property will be used as the -`dir` property. However, it will be assumed that the `root` property already -ends with the platform-dependent path separator. In this case, the returned -string will be the concatenation fo the `root` property and the `base` property. - -If both the `dir` and the `root` properties are not supplied, then the returned -string will be the contents of the `base` property. - -If the `base` property is not supplied, a concatenation of the `name` property -and the `ext` property will be used as the `base` property. - -An example on Posix systems: - -```js -path.format({ - root : "/", - dir : "/home/user/dir", - base : "file.txt", - ext : ".txt", - name : "file" -}); -// returns '/home/user/dir/file.txt' -``` - -An example on Windows: - -```js -path.format({ - root : "C:\\", - dir : "C:\\path\\dir", - base : "file.txt", - ext : ".txt", - name : "file" -}) -// returns 'C:\\path\\dir\\file.txt' -``` - -## path.isAbsolute(path) - -Determines whether `path` is an absolute path. An absolute path will always -resolve to the same location, regardless of the working directory. - -Posix examples: - -```js -path.isAbsolute('/foo/bar') // true -path.isAbsolute('/baz/..') // true -path.isAbsolute('qux/') // false -path.isAbsolute('.') // false -``` - -Windows examples: - -```js -path.isAbsolute('//server') // true -path.isAbsolute('C:/foo/..') // true -path.isAbsolute('bar\\baz') // false -path.isAbsolute('.') // false -``` - -*Note:* If the path string passed as parameter is a zero-length string, unlike - other path module functions, it will be used as-is and `false` will be - returned. - -## path.join([path1][, path2][, ...]) - -Join all arguments together and normalize the resulting path. - -Arguments must be strings. In v0.8, non-string arguments were -silently ignored. In v0.10 and up, an exception is thrown. - -Example: - -```js -path.join('/foo', 'bar', 'baz/asdf', 'quux', '..') -// returns '/foo/bar/baz/asdf' - -path.join('foo', {}, 'bar') -// throws exception -TypeError: Arguments to path.join must be strings -``` - -*Note:* If the arguments to `join` have zero-length strings, unlike other path - module functions, they will be ignored. If the joined path string is a - zero-length string then `'.'` will be returned, which represents the - current working directory. - -## path.normalize(p) - -Normalize a string path, taking care of `'..'` and `'.'` parts. - -When multiple slashes are found, they're replaced by a single one; -when the path contains a trailing slash, it is preserved. -On Windows backslashes are used. - -Example: - -```js -path.normalize('/foo/bar//baz/asdf/quux/..') -// returns '/foo/bar/baz/asdf' -``` - -*Note:* If the path string passed as argument is a zero-length string then `'.'` - will be returned, which represents the current working directory. - -## path.parse(pathString) - -Returns an object from a path string. - -An example on \*nix: - -```js -path.parse('/home/user/dir/file.txt') -// returns -// { -// root : "/", -// dir : "/home/user/dir", -// base : "file.txt", -// ext : ".txt", -// name : "file" -// } -``` - -An example on Windows: - -```js -path.parse('C:\\path\\dir\\index.html') -// returns -// { -// root : "C:\\", -// dir : "C:\\path\\dir", -// base : "index.html", -// ext : ".html", -// name : "index" -// } -``` - -## path.posix - -Provide access to aforementioned `path` methods but always interact in a posix -compatible way. - -## path.relative(from, to) - -Solve the relative path from `from` to `to`. - -At times we have two absolute paths, and we need to derive the relative -path from one to the other. This is actually the reverse transform of -`path.resolve`, which means we see that: - -```js -path.resolve(from, path.relative(from, to)) == path.resolve(to) -``` - -Examples: - -```js -path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') -// returns '..\\..\\impl\\bbb' - -path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') -// returns '../../impl/bbb' -``` - -*Note:* If the arguments to `relative` have zero-length strings then the current - working directory will be used instead of the zero-length strings. If - both the paths are the same then a zero-length string will be returned. - -## path.resolve([from ...], to) - -Resolves `to` to an absolute path. - -If `to` isn't already absolute `from` arguments are prepended in right to left -order, until an absolute path is found. If after using all `from` paths still -no absolute path is found, the current working directory is used as well. The -resulting path is normalized, and trailing slashes are removed unless the path -gets resolved to the root directory. Non-string `from` arguments are ignored. - -Another way to think of it is as a sequence of `cd` commands in a shell. - -```js -path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile') -``` - -Is similar to: - -``` -cd foo/bar -cd /tmp/file/ -cd .. -cd a/../subfile -pwd -``` - -The difference is that the different paths don't need to exist and may also be -files. - -Examples: - -```js -path.resolve('/foo/bar', './baz') -// returns '/foo/bar/baz' - -path.resolve('/foo/bar', '/tmp/file/') -// returns '/tmp/file' - -path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') -// if currently in /home/myself/node, it returns -// '/home/myself/node/wwwroot/static_files/gif/image.gif' -``` - -*Note:* If the arguments to `resolve` have zero-length strings then the current - working directory will be used instead of them. - -## path.sep - -The platform-specific file separator. `'\\'` or `'/'`. - -An example on \*nix: - -```js -'foo/bar/baz'.split(path.sep) -// returns ['foo', 'bar', 'baz'] -``` - -An example on Windows: - -```js -'foo\\bar\\baz'.split(path.sep) -// returns ['foo', 'bar', 'baz'] -``` - -## path.win32 - -Provide access to aforementioned `path` methods but always interact in a win32 -compatible way. - -[`path.parse`]: #path_path_parse_pathstring diff --git a/doc/api/path.md b/doc/api/path.md new file mode 100644 index 00000000000000..07f4a07a9282fb --- /dev/null +++ b/doc/api/path.md @@ -0,0 +1,354 @@ +# Path + + Stability: 2 - Stable + +This module contains utilities for handling and transforming file +paths. Almost all these methods perform only string transformations. +The file system is not consulted to check whether paths are valid. + +Use `require('path')` to use this module. The following methods are provided: + +## path.basename(p[, ext]) + +Return the last portion of a path. Similar to the Unix `basename` command. + +Example: + +```js +path.basename('/foo/bar/baz/asdf/quux.html') +// returns 'quux.html' + +path.basename('/foo/bar/baz/asdf/quux.html', '.html') +// returns 'quux' +``` + +## path.delimiter + +The platform-specific path delimiter, `;` or `':'`. + +An example on \*nix: + +```js +console.log(process.env.PATH) +// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' + +process.env.PATH.split(path.delimiter) +// returns ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] +``` + +An example on Windows: + +```js +console.log(process.env.PATH) +// 'C:\Windows\system32;C:\Windows;C:\Program Files\node\' + +process.env.PATH.split(path.delimiter) +// returns ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\'] +``` + +## path.dirname(p) + +Return the directory name of a path. Similar to the Unix `dirname` command. + +Example: + +```js +path.dirname('/foo/bar/baz/asdf/quux') +// returns '/foo/bar/baz/asdf' +``` + +## path.extname(p) + +Return the extension of the path, from the last '.' to end of string +in the last portion of the path. If there is no '.' in the last portion +of the path or the first character of it is '.', then it returns +an empty string. Examples: + +```js +path.extname('index.html') +// returns '.html' + +path.extname('index.coffee.md') +// returns '.md' + +path.extname('index.') +// returns '.' + +path.extname('index') +// returns '' + +path.extname('.index') +// returns '' +``` + +## path.format(pathObject) + +Returns a path string from an object. This is the opposite of [`path.parse`][]. + +If `pathObject` has `dir` and `base` properties, the returned string will +be a concatenation of the `dir` property, the platform-dependent path separator, +and the `base` property. + +If the `dir` property is not supplied, the `root` property will be used as the +`dir` property. However, it will be assumed that the `root` property already +ends with the platform-dependent path separator. In this case, the returned +string will be the concatenation of the `root` property and the `base` property. + +If both the `dir` and the `root` properties are not supplied, then the returned +string will be the contents of the `base` property. + +If the `base` property is not supplied, a concatenation of the `name` property +and the `ext` property will be used as the `base` property. + +Examples: + +Some Posix system examples: + +```js +// If `dir` and `base` are provided, `dir` + platform separator + `base` +// will be returned. +path.format({ + dir: '/home/user/dir', + base: 'file.txt' +}); +// returns '/home/user/dir/file.txt' + +// `root` will be used if `dir` is not specified. +// `name` + `ext` will be used if `base` is not specified. +// If only `root` is provided or `dir` is equal to `root` then the +// platform separator will not be included. +path.format({ + root: '/', + base: 'file.txt' +}); +// returns '/file.txt' + +path.format({ + dir: '/', + root: '/', + name: 'file', + ext: '.txt' +}); +// returns '/file.txt' + +// `base` will be returned if `dir` or `root` are not provided. +path.format({ + base: 'file.txt' +}); +// returns 'file.txt' +``` + +An example on Windows: + +```js +path.format({ + root : "C:\\", + dir : "C:\\path\\dir", + base : "file.txt", + ext : ".txt", + name : "file" +}) +// returns 'C:\\path\\dir\\file.txt' +``` + +## path.isAbsolute(path) + +Determines whether `path` is an absolute path. An absolute path will always +resolve to the same location, regardless of the working directory. + +Posix examples: + +```js +path.isAbsolute('/foo/bar') // true +path.isAbsolute('/baz/..') // true +path.isAbsolute('qux/') // false +path.isAbsolute('.') // false +``` + +Windows examples: + +```js +path.isAbsolute('//server') // true +path.isAbsolute('C:/foo/..') // true +path.isAbsolute('bar\\baz') // false +path.isAbsolute('.') // false +``` + +*Note:* If the path string passed as parameter is a zero-length string, unlike + other path module functions, it will be used as-is and `false` will be + returned. + +## path.join([path1][, path2][, ...]) + +Join all arguments together and normalize the resulting path. + +Arguments must be strings. In v0.8, non-string arguments were +silently ignored. In v0.10 and up, an exception is thrown. + +Example: + +```js +path.join('/foo', 'bar', 'baz/asdf', 'quux', '..') +// returns '/foo/bar/baz/asdf' + +path.join('foo', {}, 'bar') +// throws exception +TypeError: Arguments to path.join must be strings +``` + +*Note:* If the arguments to `join` have zero-length strings, unlike other path + module functions, they will be ignored. If the joined path string is a + zero-length string then `'.'` will be returned, which represents the + current working directory. + +## path.normalize(p) + +Normalize a string path, taking care of `'..'` and `'.'` parts. + +When multiple slashes are found, they're replaced by a single one; +when the path contains a trailing slash, it is preserved. +On Windows backslashes are used. + +Example: + +```js +path.normalize('/foo/bar//baz/asdf/quux/..') +// returns '/foo/bar/baz/asdf' +``` + +*Note:* If the path string passed as argument is a zero-length string then `'.'` + will be returned, which represents the current working directory. + +## path.parse(pathString) + +Returns an object from a path string. + +An example on \*nix: + +```js +path.parse('/home/user/dir/file.txt') +// returns +// { +// root : "/", +// dir : "/home/user/dir", +// base : "file.txt", +// ext : ".txt", +// name : "file" +// } +``` + +An example on Windows: + +```js +path.parse('C:\\path\\dir\\index.html') +// returns +// { +// root : "C:\\", +// dir : "C:\\path\\dir", +// base : "index.html", +// ext : ".html", +// name : "index" +// } +``` + +## path.posix + +Provide access to aforementioned `path` methods but always interact in a posix +compatible way. + +## path.relative(from, to) + +Solve the relative path from `from` to `to`. + +At times we have two absolute paths, and we need to derive the relative +path from one to the other. This is actually the reverse transform of +`path.resolve`, which means we see that: + +```js +path.resolve(from, path.relative(from, to)) == path.resolve(to) +``` + +Examples: + +```js +path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') +// returns '..\\..\\impl\\bbb' + +path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') +// returns '../../impl/bbb' +``` + +*Note:* If the arguments to `relative` have zero-length strings then the current + working directory will be used instead of the zero-length strings. If + both the paths are the same then a zero-length string will be returned. + +## path.resolve([from ...], to) + +Resolves `to` to an absolute path. + +If `to` isn't already absolute `from` arguments are prepended in right to left +order, until an absolute path is found. If after using all `from` paths still +no absolute path is found, the current working directory is used as well. The +resulting path is normalized, and trailing slashes are removed unless the path +gets resolved to the root directory. Non-string `from` arguments are ignored. + +Another way to think of it is as a sequence of `cd` commands in a shell. + +```js +path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile') +``` + +Is similar to: + +``` +cd foo/bar +cd /tmp/file/ +cd .. +cd a/../subfile +pwd +``` + +The difference is that the different paths don't need to exist and may also be +files. + +Examples: + +```js +path.resolve('/foo/bar', './baz') +// returns '/foo/bar/baz' + +path.resolve('/foo/bar', '/tmp/file/') +// returns '/tmp/file' + +path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') +// if currently in /home/myself/node, it returns +// '/home/myself/node/wwwroot/static_files/gif/image.gif' +``` + +*Note:* If the arguments to `resolve` have zero-length strings then the current + working directory will be used instead of them. + +## path.sep + +The platform-specific file separator. `'\\'` or `'/'`. + +An example on \*nix: + +```js +'foo/bar/baz'.split(path.sep) +// returns ['foo', 'bar', 'baz'] +``` + +An example on Windows: + +```js +'foo\\bar\\baz'.split(path.sep) +// returns ['foo', 'bar', 'baz'] +``` + +## path.win32 + +Provide access to aforementioned `path` methods but always interact in a win32 +compatible way. + +[`path.parse`]: #path_path_parse_pathstring diff --git a/doc/api/process.markdown b/doc/api/process.markdown deleted file mode 100644 index d9bd8cc452904e..00000000000000 --- a/doc/api/process.markdown +++ /dev/null @@ -1,1101 +0,0 @@ -# process - - - -The `process` object is a global object and can be accessed from anywhere. -It is an instance of [`EventEmitter`][]. - -## Event: 'beforeExit' - -This event is emitted when Node.js empties its event loop and has nothing else -to schedule. Normally, Node.js exits when there is no work scheduled, but a -listener for `'beforeExit'` can make asynchronous calls, and cause Node.js to -continue. - -`'beforeExit'` is not emitted for conditions causing explicit termination, such -as [`process.exit()`][] or uncaught exceptions, and should not be used as an -alternative to the `'exit'` event unless the intention is to schedule more work. - -## Event: 'exit' - -Emitted when the process is about to exit. There is no way to prevent the -exiting of the event loop at this point, and once all `'exit'` listeners have -finished running the process will exit. Therefore you **must** only perform -**synchronous** operations in this handler. This is a good hook to perform -checks on the module's state (like for unit tests). The callback takes one -argument, the code the process is exiting with. - -This event is only emitted when Node.js exits explicitly by process.exit() or -implicitly by the event loop draining. - -Example of listening for `'exit'`: - -```js -process.on('exit', (code) => { - // do *NOT* do this - setTimeout(() => { - console.log('This will not run'); - }, 0); - console.log('About to exit with code:', code); -}); -``` - -## Event: 'message' - -* `message` {Object} a parsed JSON object or primitive value -* `sendHandle` {Handle object} a [`net.Socket`][] or [`net.Server`][] object, or - undefined. - -Messages sent by [`ChildProcess.send()`][] are obtained using the `'message'` -event on the child's process object. - -## Event: 'rejectionHandled' - -Emitted whenever a Promise was rejected and an error handler was attached to it -(for example with `.catch()`) later than after an event loop turn. This event -is emitted with the following arguments: - - - `p` the promise that was previously emitted in an `'unhandledRejection'` - event, but which has now gained a rejection handler. - -There is no notion of a top level for a promise chain at which rejections can -always be handled. Being inherently asynchronous in nature, a promise rejection -can be handled at a future point in time — possibly much later than the -event loop turn it takes for the `'unhandledRejection'` event to be emitted. - -Another way of stating this is that, unlike in synchronous code where there is -an ever-growing list of unhandled exceptions, with promises there is a -growing-and-shrinking list of unhandled rejections. In synchronous code, the -`'uncaughtException'` event tells you when the list of unhandled exceptions -grows. And in asynchronous code, the `'unhandledRejection'` event tells you -when the list of unhandled rejections grows, while the `'rejectionHandled'` -event tells you when the list of unhandled rejections shrinks. - -For example using the rejection detection hooks in order to keep a map of all -the rejected promise reasons at a given time: - -```js -const unhandledRejections = new Map(); -process.on('unhandledRejection', (reason, p) => { - unhandledRejections.set(p, reason); -}); -process.on('rejectionHandled', (p) => { - unhandledRejections.delete(p); -}); -``` - -This map will grow and shrink over time, reflecting rejections that start -unhandled and then become handled. You could record the errors in some error -log, either periodically (probably best for long-running programs, allowing -you to clear the map, which in the case of a very buggy program could grow -indefinitely) or upon process exit (more convenient for scripts). - -## Event: 'uncaughtException' - -The `'uncaughtException'` event is emitted when an exception bubbles all the -way back to the event loop. By default, Node.js handles such exceptions by -printing the stack trace to stderr and exiting. Adding a handler for the -`'uncaughtException'` event overrides this default behavior. - -For example: - -```js -process.on('uncaughtException', (err) => { - console.log(`Caught exception: ${err}`); -}); - -setTimeout(() => { - console.log('This will still run.'); -}, 500); - -// Intentionally cause an exception, but don't catch it. -nonexistentFunc(); -console.log('This will not run.'); -``` - -### Warning: Using `'uncaughtException'` correctly - -Note that `'uncaughtException'` is a crude mechanism for exception handling -intended to be used only as a last resort. The event *should not* be used as -an equivalent to `On Error Resume Next`. Unhandled exceptions inherently mean -that an application is in an undefined state. Attempting to resume application -code without properly recovering from the exception can cause additional -unforeseen and unpredictable issues. - -Exceptions thrown from within the event handler will not be caught. Instead the -process will exit with a non zero exit code and the stack trace will be printed. -This is to avoid infinite recursion. - -Attempting to resume normally after an uncaught exception can be similar to -pulling out of the power cord when upgrading a computer -- nine out of ten -times nothing happens - but the 10th time, the system becomes corrupted. - -The correct use of `'uncaughtException'` is to perform synchronous cleanup -of allocated resources (e.g. file descriptors, handles, etc) before shutting -down the process. It is not safe to resume normal operation after -`'uncaughtException'`. - -## Event: 'unhandledRejection' - -Emitted whenever a `Promise` is rejected and no error handler is attached to -the promise within a turn of the event loop. When programming with promises -exceptions are encapsulated as rejected promises. Such promises can be caught -and handled using [`promise.catch(...)`][] and rejections are propagated through -a promise chain. This event is useful for detecting and keeping track of -promises that were rejected whose rejections were not handled yet. This event -is emitted with the following arguments: - - - `reason` the object with which the promise was rejected (usually an - [`Error`][] instance). - - `p` the promise that was rejected. - -Here is an example that logs every unhandled rejection to the console - -```js -process.on('unhandledRejection', (reason, p) => { - console.log("Unhandled Rejection at: Promise ", p, " reason: ", reason); - // application specific logging, throwing an error, or other logic here -}); -``` - -For example, here is a rejection that will trigger the `'unhandledRejection'` -event: - -```js -somePromise.then((res) => { - return reportToUser(JSON.pasre(res)); // note the typo (`pasre`) -}); // no `.catch` or `.then` -``` - -Here is an example of a coding pattern that will also trigger -`'unhandledRejection'`: - -```js -function SomeResource() { - // Initially set the loaded status to a rejected promise - this.loaded = Promise.reject(new Error('Resource not yet loaded!')); -} - -var resource = new SomeResource(); -// no .catch or .then on resource.loaded for at least a turn -``` - -In cases like this, you may not want to track the rejection as a developer -error like you would for other `'unhandledRejection'` events. To address -this, you can either attach a dummy `.catch(() => { })` handler to -`resource.loaded`, preventing the `'unhandledRejection'` event from being -emitted, or you can use the [`'rejectionHandled'`][] event. - -## Exit Codes - -Node.js will normally exit with a `0` status code when no more async -operations are pending. The following status codes are used in other -cases: - -* `1` **Uncaught Fatal Exception** - There was an uncaught exception, - and it was not handled by a domain or an `'uncaughtException'` event - handler. -* `2` - Unused (reserved by Bash for builtin misuse) -* `3` **Internal JavaScript Parse Error** - The JavaScript source code - internal in Node.js's bootstrapping process caused a parse error. This - is extremely rare, and generally can only happen during development - of Node.js itself. -* `4` **Internal JavaScript Evaluation Failure** - The JavaScript - source code internal in Node.js's bootstrapping process failed to - return a function value when evaluated. This is extremely rare, and - generally can only happen during development of Node.js itself. -* `5` **Fatal Error** - There was a fatal unrecoverable error in V8. - Typically a message will be printed to stderr with the prefix `FATAL - ERROR`. -* `6` **Non-function Internal Exception Handler** - There was an - uncaught exception, but the internal fatal exception handler - function was somehow set to a non-function, and could not be called. -* `7` **Internal Exception Handler Run-Time Failure** - There was an - uncaught exception, and the internal fatal exception handler - function itself threw an error while attempting to handle it. This - can happen, for example, if a `process.on('uncaughtException')` or - `domain.on('error')` handler throws an error. -* `8` - Unused. In previous versions of Node.js, exit code 8 sometimes - indicated an uncaught exception. -* `9` - **Invalid Argument** - Either an unknown option was specified, - or an option requiring a value was provided without a value. -* `10` **Internal JavaScript Run-Time Failure** - The JavaScript - source code internal in Node.js's bootstrapping process threw an error - when the bootstrapping function was called. This is extremely rare, - and generally can only happen during development of Node.js itself. -* `12` **Invalid Debug Argument** - The `--debug` and/or `--debug-brk` - options were set, but an invalid port number was chosen. -* `>128` **Signal Exits** - If Node.js receives a fatal signal such as - `SIGKILL` or `SIGHUP`, then its exit code will be `128` plus the - value of the signal code. This is a standard Unix practice, since - exit codes are defined to be 7-bit integers, and signal exits set - the high-order bit, and then contain the value of the signal code. - -## Signal Events - - - - -Emitted when the processes receives a signal. See sigaction(2) for a list of -standard POSIX signal names such as `SIGINT`, `SIGHUP`, etc. - -Example of listening for `SIGINT`: - -```js -// Start reading from stdin so we don't exit. -process.stdin.resume(); - -process.on('SIGINT', () => { - console.log('Got SIGINT. Press Control-D to exit.'); -}); -``` - -An easy way to send the `SIGINT` signal is with `Control-C` in most terminal -programs. - -Note: - -- `SIGUSR1` is reserved by Node.js to start the debugger. It's possible to - install a listener but that won't stop the debugger from starting. -- `SIGTERM` and `SIGINT` have default handlers on non-Windows platforms that - resets the terminal mode before exiting with code `128 + signal number`. If - one of these signals has a listener installed, its default behavior will be - removed (Node.js will no longer exit). -- `SIGPIPE` is ignored by default. It can have a listener installed. -- `SIGHUP` is generated on Windows when the console window is closed, and on other - platforms under various similar conditions, see signal(7). It can have a - listener installed, however Node.js will be unconditionally terminated by - Windows about 10 seconds later. On non-Windows platforms, the default - behavior of `SIGHUP` is to terminate Node.js, but once a listener has been - installed its default behavior will be removed. -- `SIGTERM` is not supported on Windows, it can be listened on. -- `SIGINT` from the terminal is supported on all platforms, and can usually be - generated with `CTRL+C` (though this may be configurable). It is not generated - when terminal raw mode is enabled. -- `SIGBREAK` is delivered on Windows when `CTRL+BREAK` is pressed, on - non-Windows - platforms it can be listened on, but there is no way to send or generate it. -- `SIGWINCH` is delivered when the console has been resized. On Windows, this - will only happen on write to the console when the cursor is being moved, or - when a readable tty is used in raw mode. -- `SIGKILL` cannot have a listener installed, it will unconditionally terminate - Node.js on all platforms. -- `SIGSTOP` cannot have a listener installed. - -Note that Windows does not support sending Signals, but Node.js offers some -emulation with `process.kill()`, and `child_process.kill()`. Sending signal `0` -can be used to test for the existence of a process. Sending `SIGINT`, -`SIGTERM`, and `SIGKILL` cause the unconditional termination of the target -process. - -## process.abort() - -This causes Node.js to emit an abort. This will cause Node.js to exit and -generate a core file. - -## process.arch - -What processor architecture you're running on: `'arm'`, `'ia32'`, or `'x64'`. - -```js -console.log('This processor architecture is ' + process.arch); -``` - -## process.argv - -An array containing the command line arguments. The first element will be -'node', the second element will be the name of the JavaScript file. The -next elements will be any additional command line arguments. - -```js -// print process.argv -process.argv.forEach((val, index, array) => { - console.log(`${index}: ${val}`); -}); -``` - -This will generate: - -``` -$ node process-2.js one two=three four -0: node -1: /Users/mjr/work/node/process-2.js -2: one -3: two=three -4: four -``` - -## process.chdir(directory) - -Changes the current working directory of the process or throws an exception if that fails. - -```js -console.log(`Starting directory: ${process.cwd()}`); -try { - process.chdir('/tmp'); - console.log(`New directory: ${process.cwd()}`); -} -catch (err) { - console.log(`chdir: ${err}`); -} -``` - -## process.config - -An Object containing the JavaScript representation of the configure options -that were used to compile the current Node.js executable. This is the same as -the `config.gypi` file that was produced when running the `./configure` script. - -An example of the possible output looks like: - -``` -{ - target_defaults: - { cflags: [], - default_configuration: 'Release', - defines: [], - include_dirs: [], - libraries: [] }, - variables: - { - host_arch: 'x64', - node_install_npm: 'true', - node_prefix: '', - node_shared_cares: 'false', - node_shared_http_parser: 'false', - node_shared_libuv: 'false', - node_shared_zlib: 'false', - node_use_dtrace: 'false', - node_use_openssl: 'true', - node_shared_openssl: 'false', - strict_aliasing: 'true', - target_arch: 'x64', - v8_use_snapshot: 'true' - } -} -``` - -## process.connected - -* {Boolean} Set to false after `process.disconnect()` is called - -If `process.connected` is false, it is no longer possible to send messages. - -## process.cwd() - -Returns the current working directory of the process. - -```js -console.log(`Current directory: ${process.cwd()}`); -``` - -## process.disconnect() - -Close the IPC channel to the parent process, allowing this child to exit -gracefully once there are no other connections keeping it alive. - -Identical to the parent process's [`ChildProcess.disconnect()`][]. - -If Node.js was not spawned with an IPC channel, `process.disconnect()` will be -undefined. - -## process.env - -An object containing the user environment. See environ(7). - -An example of this object looks like: - -```js -{ TERM: 'xterm-256color', - SHELL: '/usr/local/bin/bash', - USER: 'maciej', - PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', - PWD: '/Users/maciej', - EDITOR: 'vim', - SHLVL: '1', - HOME: '/Users/maciej', - LOGNAME: 'maciej', - _: '/usr/local/bin/node' } -``` - -You can write to this object, but changes won't be reflected outside of your -process. That means that the following won't work: - -``` -$ node -e 'process.env.foo = "bar"' && echo $foo -``` - -But this will: - -```js -process.env.foo = 'bar'; -console.log(process.env.foo); -``` - -Assigning a property on `process.env` will implicitly convert the value -to a string. - -Example: - -```js -process.env.test = null; -console.log(process.env.test); -// => 'null' -process.env.test = undefined; -console.log(process.env.test); -// => 'undefined' -``` - -Use `delete` to delete a property from `process.env`. - -Example: - -```js -process.env.TEST = 1; -delete process.env.TEST; -console.log(process.env.TEST); -// => undefined -``` - -## process.execArgv - -This is the set of Node.js-specific command line options from the -executable that started the process. These options do not show up in -`process.argv`, and do not include the Node.js executable, the name of -the script, or any options following the script name. These options -are useful in order to spawn child processes with the same execution -environment as the parent. - -Example: - -``` -$ node --harmony script.js --version -``` - -results in process.execArgv: - -```js -['--harmony'] -``` - -and process.argv: - -```js -['/usr/local/bin/node', 'script.js', '--version'] -``` - -## process.execPath - -This is the absolute pathname of the executable that started the process. - -Example: - -``` -/usr/local/bin/node -``` - - -## process.exit([code]) - -Ends the process with the specified `code`. If omitted, exit uses the -'success' code `0`. - -To exit with a 'failure' code: - -```js -process.exit(1); -``` - -The shell that executed Node.js should see the exit code as 1. - - -## process.exitCode - -A number which will be the process exit code, when the process either -exits gracefully, or is exited via [`process.exit()`][] without specifying -a code. - -Specifying a code to `process.exit(code)` will override any previous -setting of `process.exitCode`. - - -## process.getegid() - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Gets the effective group identity of the process. (See getegid(2).) -This is the numerical group id, not the group name. - -```js -if (process.getegid) { - console.log(`Current gid: ${process.getegid()}`); -} -``` - - -## process.geteuid() - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Gets the effective user identity of the process. (See geteuid(2).) -This is the numerical userid, not the username. - -```js -if (process.geteuid) { - console.log(`Current uid: ${process.geteuid()}`); -} -``` - -## process.getgid() - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Gets the group identity of the process. (See getgid(2).) -This is the numerical group id, not the group name. - -```js -if (process.getgid) { - console.log(`Current gid: ${process.getgid()}`); -} -``` - -## process.getgroups() - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Returns an array with the supplementary group IDs. POSIX leaves it unspecified -if the effective group ID is included but Node.js ensures it always is. - -## process.getuid() - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Gets the user identity of the process. (See getuid(2).) -This is the numerical userid, not the username. - -```js -if (process.getuid) { - console.log(`Current uid: ${process.getuid()}`); -} -``` - -## process.hrtime() - -Returns the current high-resolution real time in a `[seconds, nanoseconds]` -tuple Array. It is relative to an arbitrary time in the past. It is not -related to the time of day and therefore not subject to clock drift. The -primary use is for measuring performance between intervals. - -You may pass in the result of a previous call to `process.hrtime()` to get -a diff reading, useful for benchmarks and measuring intervals: - -```js -var time = process.hrtime(); -// [ 1800216, 25 ] - -setTimeout(() => { - var diff = process.hrtime(time); - // [ 1, 552 ] - - console.log('benchmark took %d nanoseconds', diff[0] * 1e9 + diff[1]); - // benchmark took 1000000527 nanoseconds -}, 1000); -``` - - -## process.initgroups(user, extra_group) - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Reads /etc/group and initializes the group access list, using all groups of -which the user is a member. This is a privileged operation, meaning you need -to be root or have the `CAP_SETGID` capability. - -`user` is a user name or user ID. `extra_group` is a group name or group ID. - -Some care needs to be taken when dropping privileges. Example: - -```js -console.log(process.getgroups()); // [ 0 ] -process.initgroups('bnoordhuis', 1000); // switch user -console.log(process.getgroups()); // [ 27, 30, 46, 1000, 0 ] -process.setgid(1000); // drop root gid -console.log(process.getgroups()); // [ 27, 30, 46, 1000 ] -``` - -## process.kill(pid[, signal]) - -Send a signal to a process. `pid` is the process id and `signal` is the -string describing the signal to send. Signal names are strings like -`SIGINT` or `SIGHUP`. If omitted, the signal will be `SIGTERM`. -See [Signal Events][] and kill(2) for more information. - -Will throw an error if target does not exist, and as a special case, a signal -of `0` can be used to test for the existence of a process. Windows platforms -will throw an error if the `pid` is used to kill a process group. - -Note that even though the name of this function is `process.kill`, it is really -just a signal sender, like the `kill` system call. The signal sent may do -something other than kill the target process. - -Example of sending a signal to yourself: - -```js -process.on('SIGHUP', () => { - console.log('Got SIGHUP signal.'); -}); - -setTimeout(() => { - console.log('Exiting.'); - process.exit(0); -}, 100); - -process.kill(process.pid, 'SIGHUP'); -``` - -Note: When SIGUSR1 is received by Node.js it starts the debugger, see -[Signal Events][]. - -## process.mainModule - -Alternate way to retrieve [`require.main`][]. The difference is that if the main -module changes at runtime, `require.main` might still refer to the original main -module in modules that were required before the change occurred. Generally it's -safe to assume that the two refer to the same module. - -As with `require.main`, it will be `undefined` if there was no entry script. - -## process.memoryUsage() - -Returns an object describing the memory usage of the Node.js process -measured in bytes. - -```js -const util = require('util'); - -console.log(util.inspect(process.memoryUsage())); -``` - -This will generate: - -```js -{ rss: 4935680, - heapTotal: 1826816, - heapUsed: 650472 } -``` - -`heapTotal` and `heapUsed` refer to V8's memory usage. - - -## process.nextTick(callback[, arg][, ...]) - -* `callback` {Function} - -Once the current event loop turn runs to completion, call the callback -function. - -This is *not* a simple alias to [`setTimeout(fn, 0)`][], it's much more -efficient. It runs before any additional I/O events (including -timers) fire in subsequent ticks of the event loop. - -```js -console.log('start'); -process.nextTick(() => { - console.log('nextTick callback'); -}); -console.log('scheduled'); -// Output: -// start -// scheduled -// nextTick callback -``` - -This is important in developing APIs where you want to give the user the -chance to assign event handlers after an object has been constructed, -but before any I/O has occurred. - -```js -function MyThing(options) { - this.setupOptions(options); - - process.nextTick(() => { - this.startDoingStuff(); - }); -} - -var thing = new MyThing(); -thing.getReadyForStuff(); - -// thing.startDoingStuff() gets called now, not before. -``` - -It is very important for APIs to be either 100% synchronous or 100% -asynchronous. Consider this example: - -```js -// WARNING! DO NOT USE! BAD UNSAFE HAZARD! -function maybeSync(arg, cb) { - if (arg) { - cb(); - return; - } - - fs.stat('file', cb); -} -``` - -This API is hazardous. If you do this: - -```js -maybeSync(true, () => { - foo(); -}); -bar(); -``` - -then it's not clear whether `foo()` or `bar()` will be called first. - -This approach is much better: - -```js -function definitelyAsync(arg, cb) { - if (arg) { - process.nextTick(cb); - return; - } - - fs.stat('file', cb); -} -``` - -Note: the nextTick queue is completely drained on each pass of the -event loop **before** additional I/O is processed. As a result, -recursively setting nextTick callbacks will block any I/O from -happening, just like a `while(true);` loop. - -## process.pid - -The PID of the process. - -```js -console.log(`This process is pid ${process.pid}`); -``` - -## process.platform - -What platform you're running on: -`'darwin'`, `'freebsd'`, `'linux'`, `'sunos'` or `'win32'` - -```js -console.log(`This platform is ${process.platform}`); -``` - -## process.release - -An Object containing metadata related to the current release, including URLs -for the source tarball and headers-only tarball. - -`process.release` contains the following properties: - -* `name`: a string with a value that will always be `'node'` for Node.js. For - legacy io.js releases, this will be `'io.js'`. -* `sourceUrl`: a complete URL pointing to a _.tar.gz_ file containing the - source of the current release. -* `headersUrl`: a complete URL pointing to a _.tar.gz_ file containing only - the header files for the current release. This file is significantly smaller - than the full source file and can be used for compiling add-ons against - Node.js. -* `libUrl`: a complete URL pointing to an _node.lib_ file matching the - architecture and version of the current release. This file is used for - compiling add-ons against Node.js. _This property is only present on Windows - builds of Node.js and will be missing on all other platforms._ - -e.g. - -```js -{ name: 'node', - sourceUrl: 'https://nodejs.org/download/release/v4.0.0/node-v4.0.0.tar.gz', - headersUrl: 'https://nodejs.org/download/release/v4.0.0/node-v4.0.0-headers.tar.gz', - libUrl: 'https://nodejs.org/download/release/v4.0.0/win-x64/node.lib' } -``` - -In custom builds from non-release versions of the source tree, only the -`name` property may be present. The additional properties should not be -relied upon to exist. - -## process.send(message[, sendHandle[, options]][, callback]) - -* `message` {Object} -* `sendHandle` {Handle object} -* `options` {Object} -* `callback` {Function} -* Return: {Boolean} - -When Node.js is spawned with an IPC channel attached, it can send messages to its -parent process using `process.send()`. Each will be received as a -[`'message'`][] event on the parent's `ChildProcess` object. - -*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.* - -If Node.js was not spawned with an IPC channel, `process.send()` will be undefined. - -## process.setegid(id) - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Sets the effective group identity of the process. (See setegid(2).) -This accepts either a numerical ID or a groupname string. If a groupname -is specified, this method blocks while resolving it to a numerical ID. - -```js -if (process.getegid && process.setegid) { - console.log(`Current gid: ${process.getegid()}`); - try { - process.setegid(501); - console.log(`New gid: ${process.getegid()}`); - } - catch (err) { - console.log(`Failed to set gid: ${err}`); - } -} -``` - -## process.seteuid(id) - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Sets the effective user identity of the process. (See seteuid(2).) -This accepts either a numerical ID or a username string. If a username -is specified, this method blocks while resolving it to a numerical ID. - -```js -if (process.geteuid && process.seteuid) { - console.log(`Current uid: ${process.geteuid()}`); - try { - process.seteuid(501); - console.log(`New uid: ${process.geteuid()}`); - } - catch (err) { - console.log(`Failed to set uid: ${err}`); - } -} -``` - -## process.setgid(id) - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Sets the group identity of the process. (See setgid(2).) This accepts either -a numerical ID or a groupname string. If a groupname is specified, this method -blocks while resolving it to a numerical ID. - -```js -if (process.getgid && process.setgid) { - console.log(`Current gid: ${process.getgid()}`); - try { - process.setgid(501); - console.log(`New gid: ${process.getgid()}`); - } - catch (err) { - console.log(`Failed to set gid: ${err}`); - } -} -``` - -## process.setgroups(groups) - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Sets the supplementary group IDs. This is a privileged operation, meaning you -need to be root or have the `CAP_SETGID` capability. - -The list can contain group IDs, group names or both. - -## process.setuid(id) - -Note: this function is only available on POSIX platforms (i.e. not Windows, -Android) - -Sets the user identity of the process. (See setuid(2).) This accepts either -a numerical ID or a username string. If a username is specified, this method -blocks while resolving it to a numerical ID. - -```js -if (process.getuid && process.setuid) { - console.log(`Current uid: ${process.getuid()}`); - try { - process.setuid(501); - console.log(`New uid: ${process.getuid()}`); - } - catch (err) { - console.log(`Failed to set uid: ${err}`); - } -} -``` - -## process.stderr - -A writable stream to stderr (on fd `2`). - -`process.stderr` and `process.stdout` are unlike other streams in Node.js in -that they cannot be closed (`end()` will throw), they never emit the `finish` -event and that writes can block when output is redirected to a file (although -disks are fast and operating systems normally employ write-back caching so it -should be a very rare occurrence indeed.) - -## process.stdin - -A `Readable Stream` for stdin (on fd `0`). - -Example of opening standard input and listening for both events: - -```js -process.stdin.setEncoding('utf8'); - -process.stdin.on('readable', () => { - var chunk = process.stdin.read(); - if (chunk !== null) { - process.stdout.write(`data: ${chunk}`); - } -}); - -process.stdin.on('end', () => { - process.stdout.write('end'); -}); -``` - -As a Stream, `process.stdin` can also be used in "old" mode that is compatible -with scripts written for node.js prior to v0.10. -For more information see [Stream compatibility][]. - -In "old" Streams mode the stdin stream is paused by default, so one -must call `process.stdin.resume()` to read from it. Note also that calling -`process.stdin.resume()` itself would switch stream to "old" mode. - -If you are starting a new project you should prefer a more recent "new" Streams -mode over "old" one. - -## process.stdout - -A `Writable Stream` to `stdout` (on fd `1`). - -For example, a `console.log` equivalent could look like this: - -```js -console.log = (msg) => { - process.stdout.write(`${msg}\n`); -}; -``` - -`process.stderr` and `process.stdout` are unlike other streams in Node.js in -that they cannot be closed (`end()` will throw), they never emit the `'finish'` -event and that writes can block when output is redirected to a file (although -disks are fast and operating systems normally employ write-back caching so it -should be a very rare occurrence indeed.) - -To check if Node.js is being run in a TTY context, read the `isTTY` property -on `process.stderr`, `process.stdout`, or `process.stdin`: - -``` -$ node -p "Boolean(process.stdin.isTTY)" -true -$ echo "foo" | node -p "Boolean(process.stdin.isTTY)" -false - -$ node -p "Boolean(process.stdout.isTTY)" -true -$ node -p "Boolean(process.stdout.isTTY)" | cat -false -``` - -See [the tty docs][] for more information. - -## process.title - -Getter/setter to set what is displayed in `ps`. - -When used as a setter, the maximum length is platform-specific and probably -short. - -On Linux and OS X, it's limited to the size of the binary name plus the -length of the command line arguments because it overwrites the argv memory. - -v0.8 allowed for longer process title strings by also overwriting the environ -memory but that was potentially insecure/confusing in some (rather obscure) -cases. - -## process.umask([mask]) - -Sets or reads the process's file mode creation mask. Child processes inherit -the mask from the parent process. Returns the old mask if `mask` argument is -given, otherwise returns the current mask. - -```js -const newmask = 0o022; -const oldmask = process.umask(newmask); -console.log( - `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}` -); -``` - - -## process.uptime() - -Number of seconds Node.js has been running. - -## process.version - -A compiled-in property that exposes `NODE_VERSION`. - -```js -console.log(`Version: ${process.version}`); -``` - -## process.versions - -A property exposing version strings of Node.js and its dependencies. - -```js -console.log(process.versions); -``` - -Will print something like: - -```js -{ http_parser: '2.3.0', - node: '1.1.1', - v8: '4.1.0.14', - uv: '1.3.0', - zlib: '1.2.8', - ares: '1.10.0-DEV', - modules: '43', - icu: '55.1', - openssl: '1.0.1k' } -``` - -[`'message'`]: child_process.html#child_process_event_message -[`ChildProcess.disconnect()`]: child_process.html#child_process_child_disconnect -[`ChildProcess.send()`]: child_process.html#child_process_child_send_message_sendhandle_callback -[`Error`]: errors.html#errors_class_error -[`EventEmitter`]: events.html#events_class_events_eventemitter -[`net.Server`]: net.html#net_class_net_server -[`net.Socket`]: net.html#net_class_net_socket -[`process.exit()`]: #process_process_exit_code -[`promise.catch(...)`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch -[`'rejectionHandled'`]: #process_event_rejectionhandled -[`require.main`]: modules.html#modules_accessing_the_main_module -[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg -[Signal Events]: #process_signal_events -[Stream compatibility]: stream.html#stream_compatibility_with_older_node_js_versions -[the tty docs]: tty.html#tty_tty -[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify \ No newline at end of file diff --git a/doc/api/process.md b/doc/api/process.md new file mode 100644 index 00000000000000..99827e3b05451b --- /dev/null +++ b/doc/api/process.md @@ -0,0 +1,1101 @@ +# process + + + +The `process` object is a global object and can be accessed from anywhere. +It is an instance of [`EventEmitter`][]. + +## Event: 'beforeExit' + +This event is emitted when Node.js empties its event loop and has nothing else +to schedule. Normally, Node.js exits when there is no work scheduled, but a +listener for `'beforeExit'` can make asynchronous calls, and cause Node.js to +continue. + +`'beforeExit'` is not emitted for conditions causing explicit termination, such +as [`process.exit()`][] or uncaught exceptions, and should not be used as an +alternative to the `'exit'` event unless the intention is to schedule more work. + +## Event: 'exit' + +Emitted when the process is about to exit. There is no way to prevent the +exiting of the event loop at this point, and once all `'exit'` listeners have +finished running the process will exit. Therefore you **must** only perform +**synchronous** operations in this handler. This is a good hook to perform +checks on the module's state (like for unit tests). The callback takes one +argument, the code the process is exiting with. + +This event is only emitted when Node.js exits explicitly by process.exit() or +implicitly by the event loop draining. + +Example of listening for `'exit'`: + +```js +process.on('exit', (code) => { + // do *NOT* do this + setTimeout(() => { + console.log('This will not run'); + }, 0); + console.log('About to exit with code:', code); +}); +``` + +## Event: 'message' + +* `message` {Object} a parsed JSON object or primitive value +* `sendHandle` {Handle object} a [`net.Socket`][] or [`net.Server`][] object, or + undefined. + +Messages sent by [`ChildProcess.send()`][] are obtained using the `'message'` +event on the child's process object. + +## Event: 'rejectionHandled' + +Emitted whenever a Promise was rejected and an error handler was attached to it +(for example with `.catch()`) later than after an event loop turn. This event +is emitted with the following arguments: + + - `p` the promise that was previously emitted in an `'unhandledRejection'` + event, but which has now gained a rejection handler. + +There is no notion of a top level for a promise chain at which rejections can +always be handled. Being inherently asynchronous in nature, a promise rejection +can be handled at a future point in time — possibly much later than the +event loop turn it takes for the `'unhandledRejection'` event to be emitted. + +Another way of stating this is that, unlike in synchronous code where there is +an ever-growing list of unhandled exceptions, with promises there is a +growing-and-shrinking list of unhandled rejections. In synchronous code, the +`'uncaughtException'` event tells you when the list of unhandled exceptions +grows. And in asynchronous code, the `'unhandledRejection'` event tells you +when the list of unhandled rejections grows, while the `'rejectionHandled'` +event tells you when the list of unhandled rejections shrinks. + +For example using the rejection detection hooks in order to keep a map of all +the rejected promise reasons at a given time: + +```js +const unhandledRejections = new Map(); +process.on('unhandledRejection', (reason, p) => { + unhandledRejections.set(p, reason); +}); +process.on('rejectionHandled', (p) => { + unhandledRejections.delete(p); +}); +``` + +This map will grow and shrink over time, reflecting rejections that start +unhandled and then become handled. You could record the errors in some error +log, either periodically (probably best for long-running programs, allowing +you to clear the map, which in the case of a very buggy program could grow +indefinitely) or upon process exit (more convenient for scripts). + +## Event: 'uncaughtException' + +The `'uncaughtException'` event is emitted when an exception bubbles all the +way back to the event loop. By default, Node.js handles such exceptions by +printing the stack trace to stderr and exiting. Adding a handler for the +`'uncaughtException'` event overrides this default behavior. + +For example: + +```js +process.on('uncaughtException', (err) => { + console.log(`Caught exception: ${err}`); +}); + +setTimeout(() => { + console.log('This will still run.'); +}, 500); + +// Intentionally cause an exception, but don't catch it. +nonexistentFunc(); +console.log('This will not run.'); +``` + +### Warning: Using `'uncaughtException'` correctly + +Note that `'uncaughtException'` is a crude mechanism for exception handling +intended to be used only as a last resort. The event *should not* be used as +an equivalent to `On Error Resume Next`. Unhandled exceptions inherently mean +that an application is in an undefined state. Attempting to resume application +code without properly recovering from the exception can cause additional +unforeseen and unpredictable issues. + +Exceptions thrown from within the event handler will not be caught. Instead the +process will exit with a non zero exit code and the stack trace will be printed. +This is to avoid infinite recursion. + +Attempting to resume normally after an uncaught exception can be similar to +pulling out of the power cord when upgrading a computer -- nine out of ten +times nothing happens - but the 10th time, the system becomes corrupted. + +The correct use of `'uncaughtException'` is to perform synchronous cleanup +of allocated resources (e.g. file descriptors, handles, etc) before shutting +down the process. It is not safe to resume normal operation after +`'uncaughtException'`. + +## Event: 'unhandledRejection' + +Emitted whenever a `Promise` is rejected and no error handler is attached to +the promise within a turn of the event loop. When programming with promises +exceptions are encapsulated as rejected promises. Such promises can be caught +and handled using [`promise.catch(...)`][] and rejections are propagated through +a promise chain. This event is useful for detecting and keeping track of +promises that were rejected whose rejections were not handled yet. This event +is emitted with the following arguments: + + - `reason` the object with which the promise was rejected (usually an + [`Error`][] instance). + - `p` the promise that was rejected. + +Here is an example that logs every unhandled rejection to the console + +```js +process.on('unhandledRejection', (reason, p) => { + console.log("Unhandled Rejection at: Promise ", p, " reason: ", reason); + // application specific logging, throwing an error, or other logic here +}); +``` + +For example, here is a rejection that will trigger the `'unhandledRejection'` +event: + +```js +somePromise.then((res) => { + return reportToUser(JSON.pasre(res)); // note the typo (`pasre`) +}); // no `.catch` or `.then` +``` + +Here is an example of a coding pattern that will also trigger +`'unhandledRejection'`: + +```js +function SomeResource() { + // Initially set the loaded status to a rejected promise + this.loaded = Promise.reject(new Error('Resource not yet loaded!')); +} + +var resource = new SomeResource(); +// no .catch or .then on resource.loaded for at least a turn +``` + +In cases like this, you may not want to track the rejection as a developer +error like you would for other `'unhandledRejection'` events. To address +this, you can either attach a dummy `.catch(() => { })` handler to +`resource.loaded`, preventing the `'unhandledRejection'` event from being +emitted, or you can use the [`'rejectionHandled'`][] event. + +## Exit Codes + +Node.js will normally exit with a `0` status code when no more async +operations are pending. The following status codes are used in other +cases: + +* `1` **Uncaught Fatal Exception** - There was an uncaught exception, + and it was not handled by a domain or an `'uncaughtException'` event + handler. +* `2` - Unused (reserved by Bash for builtin misuse) +* `3` **Internal JavaScript Parse Error** - The JavaScript source code + internal in Node.js's bootstrapping process caused a parse error. This + is extremely rare, and generally can only happen during development + of Node.js itself. +* `4` **Internal JavaScript Evaluation Failure** - The JavaScript + source code internal in Node.js's bootstrapping process failed to + return a function value when evaluated. This is extremely rare, and + generally can only happen during development of Node.js itself. +* `5` **Fatal Error** - There was a fatal unrecoverable error in V8. + Typically a message will be printed to stderr with the prefix `FATAL + ERROR`. +* `6` **Non-function Internal Exception Handler** - There was an + uncaught exception, but the internal fatal exception handler + function was somehow set to a non-function, and could not be called. +* `7` **Internal Exception Handler Run-Time Failure** - There was an + uncaught exception, and the internal fatal exception handler + function itself threw an error while attempting to handle it. This + can happen, for example, if a `process.on('uncaughtException')` or + `domain.on('error')` handler throws an error. +* `8` - Unused. In previous versions of Node.js, exit code 8 sometimes + indicated an uncaught exception. +* `9` - **Invalid Argument** - Either an unknown option was specified, + or an option requiring a value was provided without a value. +* `10` **Internal JavaScript Run-Time Failure** - The JavaScript + source code internal in Node.js's bootstrapping process threw an error + when the bootstrapping function was called. This is extremely rare, + and generally can only happen during development of Node.js itself. +* `12` **Invalid Debug Argument** - The `--debug` and/or `--debug-brk` + options were set, but an invalid port number was chosen. +* `>128` **Signal Exits** - If Node.js receives a fatal signal such as + `SIGKILL` or `SIGHUP`, then its exit code will be `128` plus the + value of the signal code. This is a standard Unix practice, since + exit codes are defined to be 7-bit integers, and signal exits set + the high-order bit, and then contain the value of the signal code. + +## Signal Events + + + + +Emitted when the processes receives a signal. See sigaction(2) for a list of +standard POSIX signal names such as `SIGINT`, `SIGHUP`, etc. + +Example of listening for `SIGINT`: + +```js +// Start reading from stdin so we don't exit. +process.stdin.resume(); + +process.on('SIGINT', () => { + console.log('Got SIGINT. Press Control-D to exit.'); +}); +``` + +An easy way to send the `SIGINT` signal is with `Control-C` in most terminal +programs. + +Note: + +- `SIGUSR1` is reserved by Node.js to start the debugger. It's possible to + install a listener but that won't stop the debugger from starting. +- `SIGTERM` and `SIGINT` have default handlers on non-Windows platforms that + resets the terminal mode before exiting with code `128 + signal number`. If + one of these signals has a listener installed, its default behavior will be + removed (Node.js will no longer exit). +- `SIGPIPE` is ignored by default. It can have a listener installed. +- `SIGHUP` is generated on Windows when the console window is closed, and on other + platforms under various similar conditions, see signal(7). It can have a + listener installed, however Node.js will be unconditionally terminated by + Windows about 10 seconds later. On non-Windows platforms, the default + behavior of `SIGHUP` is to terminate Node.js, but once a listener has been + installed its default behavior will be removed. +- `SIGTERM` is not supported on Windows, it can be listened on. +- `SIGINT` from the terminal is supported on all platforms, and can usually be + generated with `CTRL+C` (though this may be configurable). It is not generated + when terminal raw mode is enabled. +- `SIGBREAK` is delivered on Windows when `CTRL+BREAK` is pressed, on + non-Windows + platforms it can be listened on, but there is no way to send or generate it. +- `SIGWINCH` is delivered when the console has been resized. On Windows, this + will only happen on write to the console when the cursor is being moved, or + when a readable tty is used in raw mode. +- `SIGKILL` cannot have a listener installed, it will unconditionally terminate + Node.js on all platforms. +- `SIGSTOP` cannot have a listener installed. + +Note that Windows does not support sending Signals, but Node.js offers some +emulation with `process.kill()`, and `child_process.kill()`. Sending signal `0` +can be used to test for the existence of a process. Sending `SIGINT`, +`SIGTERM`, and `SIGKILL` cause the unconditional termination of the target +process. + +## process.abort() + +This causes Node.js to emit an abort. This will cause Node.js to exit and +generate a core file. + +## process.arch + +What processor architecture you're running on: `'arm'`, `'ia32'`, or `'x64'`. + +```js +console.log('This processor architecture is ' + process.arch); +``` + +## process.argv + +An array containing the command line arguments. The first element will be +'node', the second element will be the name of the JavaScript file. The +next elements will be any additional command line arguments. + +```js +// print process.argv +process.argv.forEach((val, index, array) => { + console.log(`${index}: ${val}`); +}); +``` + +This will generate: + +``` +$ node process-2.js one two=three four +0: node +1: /Users/mjr/work/node/process-2.js +2: one +3: two=three +4: four +``` + +## process.chdir(directory) + +Changes the current working directory of the process or throws an exception if that fails. + +```js +console.log(`Starting directory: ${process.cwd()}`); +try { + process.chdir('/tmp'); + console.log(`New directory: ${process.cwd()}`); +} +catch (err) { + console.log(`chdir: ${err}`); +} +``` + +## process.config + +An Object containing the JavaScript representation of the configure options +that were used to compile the current Node.js executable. This is the same as +the `config.gypi` file that was produced when running the `./configure` script. + +An example of the possible output looks like: + +``` +{ + target_defaults: + { cflags: [], + default_configuration: 'Release', + defines: [], + include_dirs: [], + libraries: [] }, + variables: + { + host_arch: 'x64', + node_install_npm: 'true', + node_prefix: '', + node_shared_cares: 'false', + node_shared_http_parser: 'false', + node_shared_libuv: 'false', + node_shared_zlib: 'false', + node_use_dtrace: 'false', + node_use_openssl: 'true', + node_shared_openssl: 'false', + strict_aliasing: 'true', + target_arch: 'x64', + v8_use_snapshot: 'true' + } +} +``` + +## process.connected + +* {Boolean} Set to false after `process.disconnect()` is called + +If `process.connected` is false, it is no longer possible to send messages. + +## process.cwd() + +Returns the current working directory of the process. + +```js +console.log(`Current directory: ${process.cwd()}`); +``` + +## process.disconnect() + +Close the IPC channel to the parent process, allowing this child to exit +gracefully once there are no other connections keeping it alive. + +Identical to the parent process's [`ChildProcess.disconnect()`][]. + +If Node.js was not spawned with an IPC channel, `process.disconnect()` will be +undefined. + +## process.env + +An object containing the user environment. See environ(7). + +An example of this object looks like: + +```js +{ TERM: 'xterm-256color', + SHELL: '/usr/local/bin/bash', + USER: 'maciej', + PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', + PWD: '/Users/maciej', + EDITOR: 'vim', + SHLVL: '1', + HOME: '/Users/maciej', + LOGNAME: 'maciej', + _: '/usr/local/bin/node' } +``` + +You can write to this object, but changes won't be reflected outside of your +process. That means that the following won't work: + +``` +$ node -e 'process.env.foo = "bar"' && echo $foo +``` + +But this will: + +```js +process.env.foo = 'bar'; +console.log(process.env.foo); +``` + +Assigning a property on `process.env` will implicitly convert the value +to a string. + +Example: + +```js +process.env.test = null; +console.log(process.env.test); +// => 'null' +process.env.test = undefined; +console.log(process.env.test); +// => 'undefined' +``` + +Use `delete` to delete a property from `process.env`. + +Example: + +```js +process.env.TEST = 1; +delete process.env.TEST; +console.log(process.env.TEST); +// => undefined +``` + +## process.execArgv + +This is the set of Node.js-specific command line options from the +executable that started the process. These options do not show up in +`process.argv`, and do not include the Node.js executable, the name of +the script, or any options following the script name. These options +are useful in order to spawn child processes with the same execution +environment as the parent. + +Example: + +``` +$ node --harmony script.js --version +``` + +results in process.execArgv: + +```js +['--harmony'] +``` + +and process.argv: + +```js +['/usr/local/bin/node', 'script.js', '--version'] +``` + +## process.execPath + +This is the absolute pathname of the executable that started the process. + +Example: + +``` +/usr/local/bin/node +``` + + +## process.exit([code]) + +Ends the process with the specified `code`. If omitted, exit uses the +'success' code `0`. + +To exit with a 'failure' code: + +```js +process.exit(1); +``` + +The shell that executed Node.js should see the exit code as 1. + + +## process.exitCode + +A number which will be the process exit code, when the process either +exits gracefully, or is exited via [`process.exit()`][] without specifying +a code. + +Specifying a code to `process.exit(code)` will override any previous +setting of `process.exitCode`. + + +## process.getegid() + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Gets the effective group identity of the process. (See getegid(2).) +This is the numerical group id, not the group name. + +```js +if (process.getegid) { + console.log(`Current gid: ${process.getegid()}`); +} +``` + + +## process.geteuid() + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Gets the effective user identity of the process. (See geteuid(2).) +This is the numerical userid, not the username. + +```js +if (process.geteuid) { + console.log(`Current uid: ${process.geteuid()}`); +} +``` + +## process.getgid() + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Gets the group identity of the process. (See getgid(2).) +This is the numerical group id, not the group name. + +```js +if (process.getgid) { + console.log(`Current gid: ${process.getgid()}`); +} +``` + +## process.getgroups() + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Returns an array with the supplementary group IDs. POSIX leaves it unspecified +if the effective group ID is included but Node.js ensures it always is. + +## process.getuid() + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Gets the user identity of the process. (See getuid(2).) +This is the numerical userid, not the username. + +```js +if (process.getuid) { + console.log(`Current uid: ${process.getuid()}`); +} +``` + +## process.hrtime() + +Returns the current high-resolution real time in a `[seconds, nanoseconds]` +tuple Array. It is relative to an arbitrary time in the past. It is not +related to the time of day and therefore not subject to clock drift. The +primary use is for measuring performance between intervals. + +You may pass in the result of a previous call to `process.hrtime()` to get +a diff reading, useful for benchmarks and measuring intervals: + +```js +var time = process.hrtime(); +// [ 1800216, 25 ] + +setTimeout(() => { + var diff = process.hrtime(time); + // [ 1, 552 ] + + console.log('benchmark took %d nanoseconds', diff[0] * 1e9 + diff[1]); + // benchmark took 1000000527 nanoseconds +}, 1000); +``` + + +## process.initgroups(user, extra_group) + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Reads /etc/group and initializes the group access list, using all groups of +which the user is a member. This is a privileged operation, meaning you need +to be root or have the `CAP_SETGID` capability. + +`user` is a user name or user ID. `extra_group` is a group name or group ID. + +Some care needs to be taken when dropping privileges. Example: + +```js +console.log(process.getgroups()); // [ 0 ] +process.initgroups('bnoordhuis', 1000); // switch user +console.log(process.getgroups()); // [ 27, 30, 46, 1000, 0 ] +process.setgid(1000); // drop root gid +console.log(process.getgroups()); // [ 27, 30, 46, 1000 ] +``` + +## process.kill(pid[, signal]) + +Send a signal to a process. `pid` is the process id and `signal` is the +string describing the signal to send. Signal names are strings like +`SIGINT` or `SIGHUP`. If omitted, the signal will be `SIGTERM`. +See [Signal Events][] and kill(2) for more information. + +Will throw an error if target does not exist, and as a special case, a signal +of `0` can be used to test for the existence of a process. Windows platforms +will throw an error if the `pid` is used to kill a process group. + +Note that even though the name of this function is `process.kill`, it is really +just a signal sender, like the `kill` system call. The signal sent may do +something other than kill the target process. + +Example of sending a signal to yourself: + +```js +process.on('SIGHUP', () => { + console.log('Got SIGHUP signal.'); +}); + +setTimeout(() => { + console.log('Exiting.'); + process.exit(0); +}, 100); + +process.kill(process.pid, 'SIGHUP'); +``` + +Note: When SIGUSR1 is received by Node.js it starts the debugger, see +[Signal Events][]. + +## process.mainModule + +Alternate way to retrieve [`require.main`][]. The difference is that if the main +module changes at runtime, `require.main` might still refer to the original main +module in modules that were required before the change occurred. Generally it's +safe to assume that the two refer to the same module. + +As with `require.main`, it will be `undefined` if there was no entry script. + +## process.memoryUsage() + +Returns an object describing the memory usage of the Node.js process +measured in bytes. + +```js +const util = require('util'); + +console.log(util.inspect(process.memoryUsage())); +``` + +This will generate: + +```js +{ rss: 4935680, + heapTotal: 1826816, + heapUsed: 650472 } +``` + +`heapTotal` and `heapUsed` refer to V8's memory usage. + + +## process.nextTick(callback[, arg][, ...]) + +* `callback` {Function} + +Once the current event loop turn runs to completion, call the callback +function. + +This is *not* a simple alias to [`setTimeout(fn, 0)`][], it's much more +efficient. It runs before any additional I/O events (including +timers) fire in subsequent ticks of the event loop. + +```js +console.log('start'); +process.nextTick(() => { + console.log('nextTick callback'); +}); +console.log('scheduled'); +// Output: +// start +// scheduled +// nextTick callback +``` + +This is important in developing APIs where you want to give the user the +chance to assign event handlers after an object has been constructed, +but before any I/O has occurred. + +```js +function MyThing(options) { + this.setupOptions(options); + + process.nextTick(() => { + this.startDoingStuff(); + }); +} + +var thing = new MyThing(); +thing.getReadyForStuff(); + +// thing.startDoingStuff() gets called now, not before. +``` + +It is very important for APIs to be either 100% synchronous or 100% +asynchronous. Consider this example: + +```js +// WARNING! DO NOT USE! BAD UNSAFE HAZARD! +function maybeSync(arg, cb) { + if (arg) { + cb(); + return; + } + + fs.stat('file', cb); +} +``` + +This API is hazardous. If you do this: + +```js +maybeSync(true, () => { + foo(); +}); +bar(); +``` + +then it's not clear whether `foo()` or `bar()` will be called first. + +This approach is much better: + +```js +function definitelyAsync(arg, cb) { + if (arg) { + process.nextTick(cb); + return; + } + + fs.stat('file', cb); +} +``` + +Note: the nextTick queue is completely drained on each pass of the +event loop **before** additional I/O is processed. As a result, +recursively setting nextTick callbacks will block any I/O from +happening, just like a `while(true);` loop. + +## process.pid + +The PID of the process. + +```js +console.log(`This process is pid ${process.pid}`); +``` + +## process.platform + +What platform you're running on: +`'darwin'`, `'freebsd'`, `'linux'`, `'sunos'` or `'win32'` + +```js +console.log(`This platform is ${process.platform}`); +``` + +## process.release + +An Object containing metadata related to the current release, including URLs +for the source tarball and headers-only tarball. + +`process.release` contains the following properties: + +* `name`: a string with a value that will always be `'node'` for Node.js. For + legacy io.js releases, this will be `'io.js'`. +* `sourceUrl`: a complete URL pointing to a _.tar.gz_ file containing the + source of the current release. +* `headersUrl`: a complete URL pointing to a _.tar.gz_ file containing only + the header files for the current release. This file is significantly smaller + than the full source file and can be used for compiling add-ons against + Node.js. +* `libUrl`: a complete URL pointing to an _node.lib_ file matching the + architecture and version of the current release. This file is used for + compiling add-ons against Node.js. _This property is only present on Windows + builds of Node.js and will be missing on all other platforms._ + +e.g. + +```js +{ name: 'node', + sourceUrl: 'https://nodejs.org/download/release/v4.0.0/node-v4.0.0.tar.gz', + headersUrl: 'https://nodejs.org/download/release/v4.0.0/node-v4.0.0-headers.tar.gz', + libUrl: 'https://nodejs.org/download/release/v4.0.0/win-x64/node.lib' } +``` + +In custom builds from non-release versions of the source tree, only the +`name` property may be present. The additional properties should not be +relied upon to exist. + +## process.send(message[, sendHandle[, options]][, callback]) + +* `message` {Object} +* `sendHandle` {Handle object} +* `options` {Object} +* `callback` {Function} +* Return: {Boolean} + +When Node.js is spawned with an IPC channel attached, it can send messages to its +parent process using `process.send()`. Each will be received as a +[`'message'`][] event on the parent's `ChildProcess` object. + +*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.* + +If Node.js was not spawned with an IPC channel, `process.send()` will be undefined. + +## process.setegid(id) + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Sets the effective group identity of the process. (See setegid(2).) +This accepts either a numerical ID or a groupname string. If a groupname +is specified, this method blocks while resolving it to a numerical ID. + +```js +if (process.getegid && process.setegid) { + console.log(`Current gid: ${process.getegid()}`); + try { + process.setegid(501); + console.log(`New gid: ${process.getegid()}`); + } + catch (err) { + console.log(`Failed to set gid: ${err}`); + } +} +``` + +## process.seteuid(id) + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Sets the effective user identity of the process. (See seteuid(2).) +This accepts either a numerical ID or a username string. If a username +is specified, this method blocks while resolving it to a numerical ID. + +```js +if (process.geteuid && process.seteuid) { + console.log(`Current uid: ${process.geteuid()}`); + try { + process.seteuid(501); + console.log(`New uid: ${process.geteuid()}`); + } + catch (err) { + console.log(`Failed to set uid: ${err}`); + } +} +``` + +## process.setgid(id) + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Sets the group identity of the process. (See setgid(2).) This accepts either +a numerical ID or a groupname string. If a groupname is specified, this method +blocks while resolving it to a numerical ID. + +```js +if (process.getgid && process.setgid) { + console.log(`Current gid: ${process.getgid()}`); + try { + process.setgid(501); + console.log(`New gid: ${process.getgid()}`); + } + catch (err) { + console.log(`Failed to set gid: ${err}`); + } +} +``` + +## process.setgroups(groups) + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Sets the supplementary group IDs. This is a privileged operation, meaning you +need to be root or have the `CAP_SETGID` capability. + +The list can contain group IDs, group names or both. + +## process.setuid(id) + +Note: this function is only available on POSIX platforms (i.e. not Windows, +Android) + +Sets the user identity of the process. (See setuid(2).) This accepts either +a numerical ID or a username string. If a username is specified, this method +blocks while resolving it to a numerical ID. + +```js +if (process.getuid && process.setuid) { + console.log(`Current uid: ${process.getuid()}`); + try { + process.setuid(501); + console.log(`New uid: ${process.getuid()}`); + } + catch (err) { + console.log(`Failed to set uid: ${err}`); + } +} +``` + +## process.stderr + +A writable stream to stderr (on fd `2`). + +`process.stderr` and `process.stdout` are unlike other streams in Node.js in +that they cannot be closed (`end()` will throw), they never emit the `finish` +event and that writes can block when output is redirected to a file (although +disks are fast and operating systems normally employ write-back caching so it +should be a very rare occurrence indeed.) + +## process.stdin + +A `Readable Stream` for stdin (on fd `0`). + +Example of opening standard input and listening for both events: + +```js +process.stdin.setEncoding('utf8'); + +process.stdin.on('readable', () => { + var chunk = process.stdin.read(); + if (chunk !== null) { + process.stdout.write(`data: ${chunk}`); + } +}); + +process.stdin.on('end', () => { + process.stdout.write('end'); +}); +``` + +As a Stream, `process.stdin` can also be used in "old" mode that is compatible +with scripts written for node.js prior to v0.10. +For more information see [Stream compatibility][]. + +In "old" Streams mode the stdin stream is paused by default, so one +must call `process.stdin.resume()` to read from it. Note also that calling +`process.stdin.resume()` itself would switch stream to "old" mode. + +If you are starting a new project you should prefer a more recent "new" Streams +mode over "old" one. + +## process.stdout + +A `Writable Stream` to `stdout` (on fd `1`). + +For example, a `console.log` equivalent could look like this: + +```js +console.log = (msg) => { + process.stdout.write(`${msg}\n`); +}; +``` + +`process.stderr` and `process.stdout` are unlike other streams in Node.js in +that they cannot be closed (`end()` will throw), they never emit the `'finish'` +event and that writes can block when output is redirected to a file (although +disks are fast and operating systems normally employ write-back caching so it +should be a very rare occurrence indeed.) + +To check if Node.js is being run in a TTY context, read the `isTTY` property +on `process.stderr`, `process.stdout`, or `process.stdin`: + +``` +$ node -p "Boolean(process.stdin.isTTY)" +true +$ echo "foo" | node -p "Boolean(process.stdin.isTTY)" +false + +$ node -p "Boolean(process.stdout.isTTY)" +true +$ node -p "Boolean(process.stdout.isTTY)" | cat +false +``` + +See [the tty docs][] for more information. + +## process.title + +Getter/setter to set what is displayed in `ps`. + +When used as a setter, the maximum length is platform-specific and probably +short. + +On Linux and OS X, it's limited to the size of the binary name plus the +length of the command line arguments because it overwrites the argv memory. + +v0.8 allowed for longer process title strings by also overwriting the environ +memory but that was potentially insecure/confusing in some (rather obscure) +cases. + +## process.umask([mask]) + +Sets or reads the process's file mode creation mask. Child processes inherit +the mask from the parent process. Returns the old mask if `mask` argument is +given, otherwise returns the current mask. + +```js +const newmask = 0o022; +const oldmask = process.umask(newmask); +console.log( + `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}` +); +``` + + +## process.uptime() + +Number of seconds Node.js has been running. + +## process.version + +A compiled-in property that exposes `NODE_VERSION`. + +```js +console.log(`Version: ${process.version}`); +``` + +## process.versions + +A property exposing version strings of Node.js and its dependencies. + +```js +console.log(process.versions); +``` + +Will print something like: + +```js +{ http_parser: '2.3.0', + node: '1.1.1', + v8: '4.1.0.14', + uv: '1.3.0', + zlib: '1.2.8', + ares: '1.10.0-DEV', + modules: '43', + icu: '55.1', + openssl: '1.0.1k' } +``` + +[`'message'`]: child_process.html#child_process_event_message +[`ChildProcess.disconnect()`]: child_process.html#child_process_child_disconnect +[`ChildProcess.send()`]: child_process.html#child_process_child_send_message_sendhandle_options_callback +[`Error`]: errors.html#errors_class_error +[`EventEmitter`]: events.html#events_class_eventemitter +[`net.Server`]: net.html#net_class_net_server +[`net.Socket`]: net.html#net_class_net_socket +[`process.exit()`]: #process_process_exit_code +[`promise.catch(...)`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch +[`'rejectionHandled'`]: #process_event_rejectionhandled +[`require.main`]: modules.html#modules_accessing_the_main_module +[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg +[Signal Events]: #process_signal_events +[Stream compatibility]: stream.html#stream_compatibility_with_older_node_js_versions +[the tty docs]: tty.html#tty_tty +[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify diff --git a/doc/api/punycode.markdown b/doc/api/punycode.md similarity index 100% rename from doc/api/punycode.markdown rename to doc/api/punycode.md diff --git a/doc/api/querystring.markdown b/doc/api/querystring.md similarity index 100% rename from doc/api/querystring.markdown rename to doc/api/querystring.md diff --git a/doc/api/readline.markdown b/doc/api/readline.md similarity index 100% rename from doc/api/readline.markdown rename to doc/api/readline.md diff --git a/doc/api/repl.markdown b/doc/api/repl.md similarity index 100% rename from doc/api/repl.markdown rename to doc/api/repl.md diff --git a/doc/api/stream.markdown b/doc/api/stream.md similarity index 100% rename from doc/api/stream.markdown rename to doc/api/stream.md diff --git a/doc/api/string_decoder.markdown b/doc/api/string_decoder.md similarity index 100% rename from doc/api/string_decoder.markdown rename to doc/api/string_decoder.md diff --git a/doc/api/synopsis.markdown b/doc/api/synopsis.md similarity index 100% rename from doc/api/synopsis.markdown rename to doc/api/synopsis.md diff --git a/doc/api/timers.markdown b/doc/api/timers.md similarity index 100% rename from doc/api/timers.markdown rename to doc/api/timers.md diff --git a/doc/api/tls.markdown b/doc/api/tls.markdown deleted file mode 100644 index 32dec055564be4..00000000000000 --- a/doc/api/tls.markdown +++ /dev/null @@ -1,1008 +0,0 @@ -# TLS (SSL) - - Stability: 2 - Stable - -Use `require('tls')` to access this module. - -The `tls` module uses OpenSSL to provide Transport Layer Security and/or -Secure Socket Layer: encrypted stream communication. - -TLS/SSL is a public/private key infrastructure. Each client and each -server must have a private key. A private key is created like this: - -``` -openssl genrsa -out ryans-key.pem 2048 -``` - -All servers and some clients need to have a certificate. Certificates are public -keys signed by a Certificate Authority or self-signed. The first step to -getting a certificate is to create a "Certificate Signing Request" (CSR) -file. This is done with: - -``` -openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem -``` - -To create a self-signed certificate with the CSR, do this: - -``` -openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem -``` - -Alternatively you can send the CSR to a Certificate Authority for signing. - -For Perfect Forward Secrecy, it is required to generate Diffie-Hellman -parameters: - -``` -openssl dhparam -outform PEM -out dhparam.pem 2048 -``` - -To create a .pfx or .p12, do this: - -``` -openssl pkcs12 -export -in agent5-cert.pem -inkey agent5-key.pem \ - -certfile ca-cert.pem -out agent5.pfx -``` - - - `in`: certificate - - `inkey`: private key - - `certfile`: all CA certs concatenated in one file like - `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` - -## ALPN, NPN and SNI - - - -ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next -Protocol Negotiation) and, SNI (Server Name Indication) are TLS -handshake extensions: - - * ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP, - SPDY, HTTP/2) - * SNI - Allows the use of one TLS server for multiple hostnames with different - SSL certificates. - -## Client-initiated renegotiation attack mitigation - - - -The TLS protocol lets the client renegotiate certain aspects of the TLS session. -Unfortunately, session renegotiation requires a disproportionate amount of -server-side resources, which makes it a potential vector for denial-of-service -attacks. - -To mitigate this, renegotiation is limited to three times every 10 minutes. An -error is emitted on the [`tls.TLSSocket`][] instance when the threshold is -exceeded. These limits are configurable: - - - `tls.CLIENT_RENEG_LIMIT`: renegotiation limit, default is 3. - - - `tls.CLIENT_RENEG_WINDOW`: renegotiation window in seconds, default is - 10 minutes. - -Do not change the defaults without a full understanding of the implications. - -To test the server, connect to it with `openssl s_client -connect address:port` -and tap `R` (i.e., the letter `R` followed by a carriage return) a few -times. - -## Modifying the Default TLS Cipher suite - -Node.js is built with a default suite of enabled and disabled TLS ciphers. -Currently, the default cipher suite is: - -``` -ECDHE-RSA-AES128-GCM-SHA256: -ECDHE-ECDSA-AES128-GCM-SHA256: -ECDHE-RSA-AES256-GCM-SHA384: -ECDHE-ECDSA-AES256-GCM-SHA384: -DHE-RSA-AES128-GCM-SHA256: -ECDHE-RSA-AES128-SHA256: -DHE-RSA-AES128-SHA256: -ECDHE-RSA-AES256-SHA384: -DHE-RSA-AES256-SHA384: -ECDHE-RSA-AES256-SHA256: -DHE-RSA-AES256-SHA256: -HIGH: -!aNULL: -!eNULL: -!EXPORT: -!DES: -!RC4: -!MD5: -!PSK: -!SRP: -!CAMELLIA -``` - -This default can be overriden entirely using the `--tls-cipher-list` command -line switch. For instance, the following makes -`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: - -``` -node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" -``` - -Note that the default cipher suite included within Node.js has been carefully -selected to reflect current security best practices and risk mitigation. -Changing the default cipher suite can have a significant impact on the security -of an application. The `--tls-cipher-list` switch should by used only if -absolutely necessary. - -## Perfect Forward Secrecy - - - -The term "[Forward Secrecy]" or "Perfect Forward Secrecy" describes a feature of -key-agreement (i.e., key-exchange) methods. Practically it means that even if -the private key of a server is compromised, communication can only be -decrypted by eavesdroppers if they manage to obtain the key-pair specifically -generated for each session. - -This is achieved by randomly generating a key pair for key-agreement on every -handshake (in contrast to using the same key for all sessions). Methods -implementing this technique, thus offering Perfect Forward Secrecy, are -called "ephemeral". - -Currently two methods are commonly used to achieve Perfect Forward Secrecy (note -the character "E" appended to the traditional abbreviations): - - * [DHE] - An ephemeral version of the Diffie Hellman key-agreement protocol. - * [ECDHE] - An ephemeral version of the Elliptic Curve Diffie Hellman - key-agreement protocol. - -Ephemeral methods may have some performance drawbacks, because key generation -is expensive. - -## Class: CryptoStream - - Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. - -This is an encrypted stream. - -### cryptoStream.bytesWritten - -A proxy to the underlying socket's bytesWritten accessor, this will return -the total bytes written to the socket, *including the TLS overhead*. - -## Class: SecurePair - -Returned by tls.createSecurePair. - -### Event: 'secure' - -This event is emitted from the SecurePair once the pair has successfully -established a secure connection. - -As with checking for the server [`secureConnection`](#event-secureconnection) -event, `pair.cleartext.authorized` should be inspected to confirm whether the -certificate used is properly authorized. - -## Class: tls.Server - -This class is a subclass of `net.Server` and has the same methods on it. -Instead of accepting only raw TCP connections, this accepts encrypted -connections using TLS or SSL. - -### Event: 'clientError' - -`function (exception, tlsSocket) { }` - -When a client connection emits an `'error'` event before a secure connection is -established it will be forwarded here. - -`tlsSocket` is the [`tls.TLSSocket`][] that the error originated from. - -### Event: 'newSession' - -`function (sessionId, sessionData, callback) { }` - -Emitted on creation of a TLS session. May be used to store sessions in external -storage. `callback` must be invoked eventually, otherwise no data will be -sent or received from the secure connection. - -NOTE: adding this event listener will only have an effect on connections -established after the addition of the event listener. - -### Event: 'OCSPRequest' - -`function (certificate, issuer, callback) { }` - -Emitted when the client sends a certificate status request. The server's -current certificate can be parsed to obtain the OCSP URL and certificate ID; -after obtaining an OCSP response `callback(null, resp)` is then invoked, where -`resp` is a `Buffer` instance. Both `certificate` and `issuer` are `Buffer` -DER-representations of the primary and issuer's certificates. They can be used -to obtain the OCSP certificate ID and OCSP endpoint URL. - -Alternatively, `callback(null, null)` may be called, meaning that there was no -OCSP response. - -Calling `callback(err)` will result in a `socket.destroy(err)` call. - -Typical flow: - -1. Client connects to the server and sends an `'OCSPRequest'` to it (via status - info extension in ClientHello). -2. Server receives the request and invokes the `'OCSPRequest'` event listener - if present. -3. Server extracts the OCSP URL from either the `certificate` or `issuer` and - performs an [OCSP request] to the CA. -4. Server receives `OCSPResponse` from the CA and sends it back to the client - via the `callback` argument -5. Client validates the response and either destroys the socket or performs a - handshake. - -NOTE: `issuer` could be `null` if the certificate is self-signed or if the -issuer is not in the root certificates list. (An issuer may be provided via the -`ca` option.) - -NOTE: adding this event listener will only have an effect on connections -established after the addition of the event listener. - -NOTE: An npm module like [asn1.js] may be used to parse the certificates. - -### Event: 'resumeSession' - -`function (sessionId, callback) { }` - -Emitted when the client wants to resume the previous TLS session. The event -listener may perform a lookup in external storage using the given `sessionId` -and invoke `callback(null, sessionData)` once finished. If the session can't be -resumed (i.e., doesn't exist in storage) one may call `callback(null, null)`. -Calling `callback(err)` will terminate incoming connection and destroy the -socket. - -NOTE: adding this event listener will only have an effect on connections -established after the addition of the event listener. - -Here's an example for using TLS session resumption: - -```js -var tlsSessionStore = {}; -server.on('newSession', (id, data, cb) => { - tlsSessionStore[id.toString('hex')] = data; - cb(); -}); -server.on('resumeSession', (id, cb) => { - cb(null, tlsSessionStore[id.toString('hex')] || null); -}); -``` - -### Event: 'secureConnection' - -`function (tlsSocket) {}` - -This event is emitted after the handshaking process for a new connection has -successfully completed. The argument is an instance of [`tls.TLSSocket`][] and -has all the common stream methods and events. - -`socket.authorized` is a boolean value which indicates if the -client has been verified by one of the supplied certificate authorities for the -server. If `socket.authorized` is false, then `socket.authorizationError` is -set to describe how authorization failed. Implied but worth mentioning: -depending on the settings of the TLS server, unauthorized connections may -be accepted. - -`socket.npnProtocol` is a string containing the selected NPN protocol -and `socket.alpnProtocol` is a string containing the selected ALPN -protocol. When both NPN and ALPN extensions are received, ALPN takes -precedence over NPN and the next protocol is selected by ALPN. When -ALPN has no selected protocol, this returns false. - -`socket.servername` is a string containing the server name requested with -SNI. - -### server.addContext(hostname, context) - -Add secure context that will be used if the client request's SNI hostname -matches the supplied `hostname` (wildcards can be used). `context` can contain -`key`, `cert`, `ca` or any other properties from -[`tls.createSecureContext()`][] `options` argument. - -### server.address() - -Returns the bound address, the address family name, and port of the -server as reported by the operating system. See [`net.Server.address()`][] for -more information. - -### server.close([callback]) - -Stops the server from accepting new connections. This function is -asynchronous, the server is finally closed when the server emits a `'close'` -event. Optionally, you can pass a callback to listen for the `'close'` event. - -### server.connections - -The number of concurrent connections on the server. - -### server.getTicketKeys() - -Returns a `Buffer` instance holding the keys currently used for -encryption/decryption of the [TLS Session Tickets][] - -### server.listen(port[, hostname][, callback]) - -Begin accepting connections on the specified `port` and `hostname`. If the -`hostname` is omitted, the server will accept connections on any IPv6 address -(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A -port value of zero will assign a random port. - -This function is asynchronous. The last parameter `callback` will be called -when the server has been bound. - -See `net.Server` for more information. - -### server.setTicketKeys(keys) - -Updates the keys for encryption/decryption of the [TLS Session Tickets][]. - -NOTE: the buffer should be 48 bytes long. See `ticketKeys` option in -[tls.createServer](#tlscreateserveroptions-secureconnectionlistener) for -more information on how it is used. - -NOTE: the change is effective only for future server connections. Existing -or currently pending server connections will use the previous keys. - -### server.maxConnections - -Set this property to reject connections when the server's connection count -exceeds the specified threshold. - - -## Class: tls.TLSSocket - -This is a wrapped version of [`net.Socket`][] that does transparent encryption -of written data and all required TLS negotiation. - -This instance implements the duplex [Stream][] interface. It has all the -common stream methods and events. - -Methods that return TLS connection metadata (e.g. -[`tls.TLSSocket.getPeerCertificate()`][] will only return data while the -connection is open. - -### new tls.TLSSocket(socket[, options]) - -Construct a new TLSSocket object from an existing TCP socket. - -`socket` is an instance of [`net.Socket`][] - -`options` is an optional object that might contain following properties: - - - `secureContext`: An optional TLS context object from - [`tls.createSecureContext()`][] - - - `isServer`: If `true` the TLS socket will be instantiated in server-mode. - Default: `false` - - - `server`: An optional [`net.Server`][] instance - - - `requestCert`: Optional, see [`tls.createSecurePair()`][] - - - `rejectUnauthorized`: Optional, see [`tls.createSecurePair()`][] - - - `NPNProtocols`: Optional, see [`tls.createServer()`][] - - - `ALPNProtocols`: Optional, see [`tls.createServer()`][] - - - `SNICallback`: Optional, see [`tls.createServer()`][] - - - `session`: Optional, a `Buffer` instance, containing a TLS session - - - `requestOCSP`: Optional, if `true` the OCSP status request extension will - be added to the client hello and an `'OCSPResponse'` event will be emitted - on the socket before establishing a secure communication - -### Event: 'OCSPResponse' - -`function (response) { }` - -This event will be emitted if the `requestOCSP` option was set. `response` is a -`Buffer` containing the server's OCSP response. - -Traditionally, the `response` is a signed object from the server's CA that -contains information about server's certificate revocation status. - -### Event: 'secureConnect' - -This event is emitted after the handshaking process for a new connection has -successfully completed. The listener will be called regardless of whether or not -the server's certificate has been authorized. It is the user's responsibility to -test `tlsSocket.authorized` to see if the server certificate was signed by one -of the specified CAs. If `tlsSocket.authorized === false` then the error can be -found in `tlsSocket.authorizationError`. Also, if either ALPN or NPN was used -`tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` can be checked for the -negotiated protocol. - -### tlsSocket.address() - -Returns the bound address, the address family name, and port of the -underlying socket as reported by the operating system. Returns an -object with three properties, e.g., -`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` - -### tlsSocket.authorized - -A boolean that is `true` if the peer certificate was signed by one of the -specified CAs, otherwise `false`. - -### tlsSocket.authorizationError - -The reason why the peer's certificate has not been verified. This property -becomes available only when `tlsSocket.authorized === false`. - -### tlsSocket.encrypted - -Static boolean value, always `true`. May be used to distinguish TLS sockets -from regular ones. - -### tlsSocket.getCipher() - -Returns an object representing the cipher name and the SSL/TLS protocol version -that first defined the cipher. - -Example: -`{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` - -See SSL_CIPHER_get_name() and SSL_CIPHER_get_version() in -https://www.openssl.org/docs/manmaster/ssl/SSL_CIPHER_get_name.html for more -information. - -### tlsSocket.getEphemeralKeyInfo() - -Returns an object representing the type, name, and size of parameter of -an ephemeral key exchange in [Perfect Forward Secrecy][] on a client -connection. It returns an empty object when the key exchange is not -ephemeral. As this is only supported on a client socket, it returns `null` -if called on a server socket. The supported types are 'DH' and 'ECDH'. The -`name` property is only available in 'ECDH'. - -Example: - - { type: 'ECDH', name: 'prime256v1', size: 256 } - -### tlsSocket.getPeerCertificate([ detailed ]) - -Returns an object representing the peer's certificate. The returned object has -some properties corresponding to the fields of the certificate. If the -`detailed` argument is `true` the full chain with the `issuer` property will be -returned, if `false` only the top certificate without the `issuer` property. - -Example: - -``` -{ subject: - { C: 'UK', - ST: 'Acknack Ltd', - L: 'Rhys Jones', - O: 'node.js', - OU: 'Test TLS Certificate', - CN: 'localhost' }, - issuerInfo: - { C: 'UK', - ST: 'Acknack Ltd', - L: 'Rhys Jones', - O: 'node.js', - OU: 'Test TLS Certificate', - CN: 'localhost' }, - issuer: - { ... another certificate ... }, - raw: < RAW DER buffer >, - valid_from: 'Nov 11 09:52:22 2009 GMT', - valid_to: 'Nov 6 09:52:22 2029 GMT', - fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', - serialNumber: 'B9B0D332A1AA5635' } -``` - -If the peer does not provide a certificate, it returns `null` or an empty -object. - -### tlsSocket.getProtocol() - -Returns a string containing the negotiated SSL/TLS protocol version of the -current connection. `'unknown'` will be returned for connected sockets that have -not completed the handshaking process. `null` will be returned for server -sockets or disconnected client sockets. - -Examples: -``` -'SSLv3' -'TLSv1' -'TLSv1.1' -'TLSv1.2' -'unknown' -``` - -See https://www.openssl.org/docs/manmaster/ssl/SSL_get_version.html for more -information. - -### tlsSocket.getSession() - -Returns the ASN.1 encoded TLS session or `undefined` if none was negotiated. -Could be used to speed up handshake establishment when reconnecting to the -server. - -### tlsSocket.getTLSTicket() - -NOTE: Works only with client TLS sockets. Useful only for debugging, for -session reuse provide `session` option to [`tls.connect()`][]. - -Returns the TLS session ticket or `undefined` if none was negotiated. - -### tlsSocket.localAddress - -The string representation of the local IP address. - -### tlsSocket.localPort - -The numeric representation of the local port. - -### tlsSocket.remoteAddress - -The string representation of the remote IP address. For example, -`'74.125.127.100'` or `'2001:4860:a005::68'`. - -### tlsSocket.remoteFamily - -The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. - -### tlsSocket.remotePort - -The numeric representation of the remote port. For example, `443`. - -### tlsSocket.renegotiate(options, callback) - -Initiate TLS renegotiation process. The `options` object may contain the -following fields: `rejectUnauthorized`, `requestCert`. (See [`tls.createServer -()`][] for details.) `callback(err)` will be executed with `null` as `err`, -once the renegotiation is successfully completed. - -NOTE: Can be used to request peer's certificate after the secure connection -has been established. - -ANOTHER NOTE: When running as the server, socket will be destroyed -with an error after `handshakeTimeout` timeout. - -### tlsSocket.setMaxSendFragment(size) - -Set maximum TLS fragment size (default and maximum value is: `16384`, minimum -is: `512`). Returns `true` on success, `false` otherwise. - -Smaller fragment sizes decrease the buffering latency on the client: larger -fragments are buffered by the TLS layer until the entire fragment is received -and its integrity is verified; large fragments can span multiple roundtrips -and their processing can be delayed due to packet loss or reordering. However, -smaller fragments add extra TLS framing bytes and CPU overhead, which may -decrease overall server throughput. - - -## tls.connect(options[, callback]) -## tls.connect(port[, host][, options][, callback]) - -Creates a new client connection to the given `port` and `host` (old API) or -`options.port` and `options.host`. (If `host` is omitted, it defaults to -`localhost`.) `options` should be an object which specifies: - - - `host`: Host the client should connect to. - - - `port`: Port the client should connect to. - - - `socket`: Establish secure connection on a given socket rather than - creating a new socket. If this option is specified, `host` and `port` - are ignored. - - - `path`: Creates unix socket connection to path. If this option is - specified, `host` and `port` are ignored. - - - `pfx`: A string or `Buffer` containing the private key, certificate, and - CA certs of the client in PFX or PKCS12 format. - - - `key`: A string, `Buffer`, array of strings, or array of `Buffer`s - containing the private key of the client in PEM format. - - - `passphrase`: A string containing the passphrase for the private key or pfx. - - - `cert`: A string, `Buffer`, array of strings, or array of `Buffer`s - containing the certificate key of the client in PEM format. - - - `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted - certificates in PEM format. If this is omitted several well known "root" - CAs (like VeriSign) will be used. These are used to authorize connections. - - - `ciphers`: A string describing the ciphers to use or exclude, separated by - `:`. Uses the same default cipher suite as [`tls.createServer()`][]. - - - `rejectUnauthorized`: If `true`, the server certificate is verified against - the list of supplied CAs. An `'error'` event is emitted if verification - fails; `err.code` contains the OpenSSL error code. Default: `true`. - - - `NPNProtocols`: An array of strings or `Buffer`s containing supported NPN - protocols. `Buffer`s should have the following format: - `0x05hello0x05world`, where the first byte is the next protocol name's - length. (Passing an array is usually be much simpler: `['hello', 'world']`.) - - - `ALPNProtocols`: An array of strings or `Buffer`s containing the - supported ALPN protocols. `Buffer`s should have following format: - `0x05hello0x05world`, where the first byte is the next protocol - name's length. (Passing an array is usually be much simpler: - `['hello', 'world']`.) - - - `servername`: Server name for the SNI (Server Name Indication) TLS - extension. - - - `checkServerIdentity(servername, cert)`: Provide an override for checking - the server's hostname against the certificate. Should return an error if - verification fails. Returns `undefined` if passing. - - - `secureProtocol`: The SSL method to use, e.g., `SSLv3_method` to force - SSL version 3. The possible values depend on the version of OpenSSL - installed in the environment and are defined in the constant - [SSL_METHODS][]. - - - `secureContext`: An optional TLS context object from - `tls.createSecureContext( ... )`. It can be used for caching client - certificates, keys, and CA certificates. - - - `session`: A `Buffer` instance, containing TLS session. - - - `minDHSize`: Minimum size of the DH parameter in bits to accept a TLS - connection. When a server offers a DH parameter with a size less - than this, the TLS connection is destroyed and an error is thrown. Default: - 1024. - -The `callback` parameter will be added as a listener for the -[`'secureConnect'`][] event. - -`tls.connect()` returns a [`tls.TLSSocket`][] object. - -Here is an example of a client of echo server as described previously: - -```js -const tls = require('tls'); -const fs = require('fs'); - -const options = { - // These are necessary only if using the client certificate authentication - key: fs.readFileSync('client-key.pem'), - cert: fs.readFileSync('client-cert.pem'), - - // This is necessary only if the server uses the self-signed certificate - ca: [ fs.readFileSync('server-cert.pem') ] -}; - -var socket = tls.connect(8000, options, () => { - console.log('client connected', - socket.authorized ? 'authorized' : 'unauthorized'); - process.stdin.pipe(socket); - process.stdin.resume(); -}); -socket.setEncoding('utf8'); -socket.on('data', (data) => { - console.log(data); -}); -socket.on('end', () => { - server.close(); -}); -``` - -Or - -```js -const tls = require('tls'); -const fs = require('fs'); - -const options = { - pfx: fs.readFileSync('client.pfx') -}; - -var socket = tls.connect(8000, options, () => { - console.log('client connected', - socket.authorized ? 'authorized' : 'unauthorized'); - process.stdin.pipe(socket); - process.stdin.resume(); -}); -socket.setEncoding('utf8'); -socket.on('data', (data) => { - console.log(data); -}); -socket.on('end', () => { - server.close(); -}); -``` - - -## tls.createSecureContext(options) - -Creates a credentials object; the `options` object may contain the following -fields: - -* `pfx` : A string or `Buffer` holding the PFX or PKCS12 encoded private - key, certificate, and CA certificates. -* `key`: A string or `Buffer` containing the private key of the server in - PEM format. To support multiple keys using different algorithms, an array - can be provided. It can either be a plain array of keys or an array of - objects in the format `{pem: key, passphrase: passphrase}`. (Required) -* `passphrase` : A string containing the passphrase for the private key or pfx. -* `cert` : A string containing the PEM encoded certificate -* `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted - certificates in PEM format. If this is omitted several well known "root" - CAs (like VeriSign) will be used. These are used to authorize connections. -* `crl` : Either a string or list of strings of PEM encoded CRLs - (Certificate Revocation List). -* `ciphers`: A string describing the ciphers to use or exclude. - Consult - - for details on the format. -* `honorCipherOrder` : When choosing a cipher, use the server's preferences - instead of the client preferences. For further details see `tls` module - documentation. - -If no 'CA' details are given, then Node.js will use the default -publicly trusted list of CAs as given in -. - -## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options]) - -Creates a new secure pair object with two streams, one of which reads and writes -the encrypted data and the other of which reads and writes the cleartext data. -Generally, the encrypted stream is piped to/from an incoming encrypted data -stream and the cleartext one is used as a replacement for the initial encrypted -stream. - - - `credentials`: A secure context object from `tls.createSecureContext( ... )`. - - - `isServer`: A boolean indicating whether this TLS connection should be - opened as a server or a client. - - - `requestCert`: A boolean indicating whether a server should request a - certificate from a connecting client. Only applies to server connections. - - - `rejectUnauthorized`: A boolean indicating whether a server should - automatically reject clients with invalid certificates. Only applies to - servers with `requestCert` enabled. - - - `options`: An object with common SSL options. See [`tls.TLSSocket`][]. - -`tls.createSecurePair()` returns a SecurePair object with `cleartext` and -`encrypted` stream properties. - -NOTE: `cleartext` has the same API as [`tls.TLSSocket`][] - -## tls.createServer(options[, secureConnectionListener]) - -Creates a new [tls.Server][]. The `connectionListener` argument is -automatically set as a listener for the [`'secureConnection'`][] event. The -`options` object may contain the following fields: - - - `pfx`: A string or `Buffer` containing the private key, certificate and - CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with - the `key`, `cert`, and `ca` options.) - - - `key`: A string or `Buffer` containing the private key of the server in - PEM format. To support multiple keys using different algorithms an array - can be provided. It can either be a plain array of keys or an array of - objects in the format `{pem: key, passphrase: passphrase}`. (Required) - - - `passphrase`: A string containing the passphrase for the private key or pfx. - - - `cert`: A string, `Buffer`, array of strings, or array of `Buffer`s - containing the certificate key of the server in PEM format. (Required) - - - `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted - certificates in PEM format. If this is omitted several well known "root" - CAs (like VeriSign) will be used. These are used to authorize connections. - - - `crl` : Either a string or array of strings of PEM encoded CRLs (Certificate - Revocation List). - - - `ciphers`: A string describing the ciphers to use or exclude, separated by - `:`. The default cipher suite is: - - ```js - ECDHE-RSA-AES128-GCM-SHA256: - ECDHE-ECDSA-AES128-GCM-SHA256: - ECDHE-RSA-AES256-GCM-SHA384: - ECDHE-ECDSA-AES256-GCM-SHA384: - DHE-RSA-AES128-GCM-SHA256: - ECDHE-RSA-AES128-SHA256: - DHE-RSA-AES128-SHA256: - ECDHE-RSA-AES256-SHA384: - DHE-RSA-AES256-SHA384: - ECDHE-RSA-AES256-SHA256: - DHE-RSA-AES256-SHA256: - HIGH: - !aNULL: - !eNULL: - !EXPORT: - !DES: - !RC4: - !MD5: - !PSK: - !SRP: - !CAMELLIA - ``` - - The default cipher suite prefers GCM ciphers for [Chrome's 'modern - cryptography' setting] and also prefers ECDHE and DHE ciphers for Perfect - Forward Secrecy, while offering *some* backward compatibility. - - 128 bit AES is preferred over 192 and 256 bit AES in light of [specific - attacks affecting larger AES key sizes]. - - Old clients that rely on insecure and deprecated RC4 or DES-based ciphers - (like Internet Explorer 6) cannot complete the handshaking process with - the default configuration. If these clients _must_ be supported, the - [TLS recommendations] may offer a compatible cipher suite. For more details - on the format, see the [OpenSSL cipher list format documentation]. - - - `ecdhCurve`: A string describing a named curve to use for ECDH key agreement - or false to disable ECDH. - - Defaults to `prime256v1` (NIST P-256). Use [`crypto.getCurves()`][] to - obtain a list of available curve names. On recent releases, - `openssl ecparam -list_curves` will also display the name and description of - each available elliptic curve. - - - `dhparam`: A string or `Buffer` containing Diffie Hellman parameters, - required for Perfect Forward Secrecy. Use `openssl dhparam` to create it. - Its key length should be greater than or equal to 1024 bits, otherwise - it throws an error. It is strongly recommended to use 2048 bits or - larger for stronger security. If omitted or invalid, it is silently - discarded and DHE ciphers won't be available. - - - `handshakeTimeout`: Abort the connection if the SSL/TLS handshake does not - finish in the specified number of milliseconds. The default is 120 seconds. - - A `'clientError'` is emitted on the `tls.Server` object whenever a handshake - times out. - - - `honorCipherOrder` : When choosing a cipher, use the server's preferences - instead of the client preferences. Default: `true`. - - - `requestCert`: If `true` the server will request a certificate from - clients that connect and attempt to verify that certificate. Default: - `false`. - - - `rejectUnauthorized`: If `true` the server will reject any connection - which is not authorized with the list of supplied CAs. This option only - has an effect if `requestCert` is `true`. Default: `false`. - - - `NPNProtocols`: An array or `Buffer` of possible NPN protocols. (Protocols - should be ordered by their priority.) - - - `ALPNProtocols`: An array or `Buffer` of possible ALPN - protocols. (Protocols should be ordered by their priority.) When - the server receives both NPN and ALPN extensions from the client, - ALPN takes precedence over NPN and the server does not send an NPN - extension to the client. - - - `SNICallback(servername, cb)`: A function that will be called if the client - supports SNI TLS extension. Two arguments will be passed to it: - `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, where - `ctx` is a SecureContext instance. (`tls.createSecureContext(...)` can be - used to get a proper SecureContext.) If `SNICallback` wasn't provided the - default callback with high-level API will be used (see below). - - - `sessionTimeout`: An integer specifying the number of seconds after which - the TLS session identifiers and TLS session tickets created by the server - will time out. See [SSL_CTX_set_timeout] for more details. - - - `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, - a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS - session tickets on multiple instances of the TLS server. - - NOTE: Automatically shared between `cluster` module workers. - - - `sessionIdContext`: A string containing an opaque identifier for session - resumption. If `requestCert` is `true`, the default is a MD5 hash value - generated from the command-line. (In FIPS mode a truncated SHA1 hash is - used instead.) Otherwise, a default is not provided. - - - `secureProtocol`: The SSL method to use, e.g., `SSLv3_method` to force - SSL version 3. The possible values depend on the version of OpenSSL - installed in the environment and are defined in the constant [SSL_METHODS][]. - -Here is a simple example echo server: - -```js -const tls = require('tls'); -const fs = require('fs'); - -const options = { - key: fs.readFileSync('server-key.pem'), - cert: fs.readFileSync('server-cert.pem'), - - // This is necessary only if using the client certificate authentication. - requestCert: true, - - // This is necessary only if the client uses the self-signed certificate. - ca: [ fs.readFileSync('client-cert.pem') ] -}; - -var server = tls.createServer(options, (socket) => { - console.log('server connected', - socket.authorized ? 'authorized' : 'unauthorized'); - socket.write('welcome!\n'); - socket.setEncoding('utf8'); - socket.pipe(socket); -}); -server.listen(8000, () => { - console.log('server bound'); -}); -``` - -Or - -```js -const tls = require('tls'); -const fs = require('fs'); - -const options = { - pfx: fs.readFileSync('server.pfx'), - - // This is necessary only if using the client certificate authentication. - requestCert: true, - -}; - -var server = tls.createServer(options, (socket) => { - console.log('server connected', - socket.authorized ? 'authorized' : 'unauthorized'); - socket.write('welcome!\n'); - socket.setEncoding('utf8'); - socket.pipe(socket); -}); -server.listen(8000, () => { - console.log('server bound'); -}); -``` - -You can test this server by connecting to it with `openssl s_client`: - -``` -openssl s_client -connect 127.0.0.1:8000 -``` - -## tls.getCiphers() - -Returns an array with the names of the supported SSL ciphers. - -Example: - -```js -var ciphers = tls.getCiphers(); -console.log(ciphers); // ['AES128-SHA', 'AES256-SHA', ...] -``` - - -[OpenSSL cipher list format documentation]: https://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT -[Chrome's 'modern cryptography' setting]: https://www.chromium.org/Home/chromium-security/education/tls#TOC-Deprecation-of-TLS-Features-Algorithms-in-Chrome -[specific attacks affecting larger AES key sizes]: https://www.schneier.com/blog/archives/2009/07/another_new_aes.html -[BEAST attacks]: https://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html -[`crypto.getCurves()`]: crypto.html#crypto_crypto_getcurves -[`tls.createServer()`]: #tls_tls_createserver_options_secureconnectionlistener -[`tls.createSecurePair()`]: #tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options -[`tls.TLSSocket`]: #tls_class_tls_tlssocket -[`net.Server`]: net.html#net_class_net_server -[`net.Socket`]: net.html#net_class_net_socket -[`net.Server.address()`]: net.html#net_server_address -[`'secureConnect'`]: #tls_event_secureconnect -[`'secureConnection'`]: #tls_event_secureconnection -[Perfect Forward Secrecy]: #tls_perfect_forward_secrecy -[Stream]: stream.html#stream_stream -[SSL_METHODS]: https://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS -[tls.Server]: #tls_class_tls_server -[SSL_CTX_set_timeout]: https://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html -[RFC 4492]: https://www.rfc-editor.org/rfc/rfc4492.txt -[Forward secrecy]: https://en.wikipedia.org/wiki/Perfect_forward_secrecy -[DHE]: https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange -[ECDHE]: https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman -[asn1.js]: https://npmjs.org/package/asn1.js -[OCSP request]: https://en.wikipedia.org/wiki/OCSP_stapling -[TLS recommendations]: https://wiki.mozilla.org/Security/Server_Side_TLS -[TLS Session Tickets]: https://www.ietf.org/rfc/rfc5077.txt -[`tls.TLSSocket.getPeerCertificate()`]: #tls_tlssocket_getpeercertificate_detailed -[`tls.createSecureContext()`]: #tls_tls_createsecurecontext_details -[`tls.connect()`]: #tls_tls_connect_options_callback diff --git a/doc/api/tls.md b/doc/api/tls.md new file mode 100644 index 00000000000000..0b210d114d6899 --- /dev/null +++ b/doc/api/tls.md @@ -0,0 +1,1008 @@ +# TLS (SSL) + + Stability: 2 - Stable + +Use `require('tls')` to access this module. + +The `tls` module uses OpenSSL to provide Transport Layer Security and/or +Secure Socket Layer: encrypted stream communication. + +TLS/SSL is a public/private key infrastructure. Each client and each +server must have a private key. A private key is created like this: + +``` +openssl genrsa -out ryans-key.pem 2048 +``` + +All servers and some clients need to have a certificate. Certificates are public +keys signed by a Certificate Authority or self-signed. The first step to +getting a certificate is to create a "Certificate Signing Request" (CSR) +file. This is done with: + +``` +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +To create a self-signed certificate with the CSR, do this: + +``` +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Alternatively you can send the CSR to a Certificate Authority for signing. + +For Perfect Forward Secrecy, it is required to generate Diffie-Hellman +parameters: + +``` +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +To create a .pfx or .p12, do this: + +``` +openssl pkcs12 -export -in agent5-cert.pem -inkey agent5-key.pem \ + -certfile ca-cert.pem -out agent5.pfx +``` + + - `in`: certificate + - `inkey`: private key + - `certfile`: all CA certs concatenated in one file like + `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +## ALPN, NPN and SNI + + + +ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next +Protocol Negotiation) and, SNI (Server Name Indication) are TLS +handshake extensions: + + * ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP, + SPDY, HTTP/2) + * SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +## Client-initiated renegotiation attack mitigation + + + +The TLS protocol lets the client renegotiate certain aspects of the TLS session. +Unfortunately, session renegotiation requires a disproportionate amount of +server-side resources, which makes it a potential vector for denial-of-service +attacks. + +To mitigate this, renegotiation is limited to three times every 10 minutes. An +error is emitted on the [`tls.TLSSocket`][] instance when the threshold is +exceeded. These limits are configurable: + + - `tls.CLIENT_RENEG_LIMIT`: renegotiation limit, default is 3. + + - `tls.CLIENT_RENEG_WINDOW`: renegotiation window in seconds, default is + 10 minutes. + +Do not change the defaults without a full understanding of the implications. + +To test the server, connect to it with `openssl s_client -connect address:port` +and tap `R` (i.e., the letter `R` followed by a carriage return) a few +times. + +## Modifying the Default TLS Cipher suite + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +``` +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be overriden entirely using the `--tls-cipher-list` command +line switch. For instance, the following makes +`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: + +``` +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +``` + +Note that the default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch should by used only if +absolutely necessary. + +## Perfect Forward Secrecy + + + +The term "[Forward Secrecy]" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. Practically it means that even if +the private key of a server is compromised, communication can only be +decrypted by eavesdroppers if they manage to obtain the key-pair specifically +generated for each session. + +This is achieved by randomly generating a key pair for key-agreement on every +handshake (in contrast to using the same key for all sessions). Methods +implementing this technique, thus offering Perfect Forward Secrecy, are +called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + + * [DHE] - An ephemeral version of the Diffie Hellman key-agreement protocol. + * [ECDHE] - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +## Class: CryptoStream + + Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. + +This is an encrypted stream. + +### cryptoStream.bytesWritten + +A proxy to the underlying socket's bytesWritten accessor, this will return +the total bytes written to the socket, *including the TLS overhead*. + +## Class: SecurePair + +Returned by tls.createSecurePair. + +### Event: 'secure' + +This event is emitted from the SecurePair once the pair has successfully +established a secure connection. + +As with checking for the server [`secureConnection`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +## Class: tls.Server + +This class is a subclass of `net.Server` and has the same methods on it. +Instead of accepting only raw TCP connections, this accepts encrypted +connections using TLS or SSL. + +### Event: 'clientError' + +`function (exception, tlsSocket) { }` + +When a client connection emits an `'error'` event before a secure connection is +established it will be forwarded here. + +`tlsSocket` is the [`tls.TLSSocket`][] that the error originated from. + +### Event: 'newSession' + +`function (sessionId, sessionData, callback) { }` + +Emitted on creation of a TLS session. May be used to store sessions in external +storage. `callback` must be invoked eventually, otherwise no data will be +sent or received from the secure connection. + +NOTE: adding this event listener will only have an effect on connections +established after the addition of the event listener. + +### Event: 'OCSPRequest' + +`function (certificate, issuer, callback) { }` + +Emitted when the client sends a certificate status request. The server's +current certificate can be parsed to obtain the OCSP URL and certificate ID; +after obtaining an OCSP response `callback(null, resp)` is then invoked, where +`resp` is a `Buffer` instance. Both `certificate` and `issuer` are `Buffer` +DER-representations of the primary and issuer's certificates. They can be used +to obtain the OCSP certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, meaning that there was no +OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +Typical flow: + +1. Client connects to the server and sends an `'OCSPRequest'` to it (via status + info extension in ClientHello). +2. Server receives the request and invokes the `'OCSPRequest'` event listener + if present. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request] to the CA. +4. Server receives `OCSPResponse` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +NOTE: `issuer` could be `null` if the certificate is self-signed or if the +issuer is not in the root certificates list. (An issuer may be provided via the +`ca` option.) + +NOTE: adding this event listener will only have an effect on connections +established after the addition of the event listener. + +NOTE: An npm module like [asn1.js] may be used to parse the certificates. + +### Event: 'resumeSession' + +`function (sessionId, callback) { }` + +Emitted when the client wants to resume the previous TLS session. The event +listener may perform a lookup in external storage using the given `sessionId` +and invoke `callback(null, sessionData)` once finished. If the session can't be +resumed (i.e., doesn't exist in storage) one may call `callback(null, null)`. +Calling `callback(err)` will terminate incoming connection and destroy the +socket. + +NOTE: adding this event listener will only have an effect on connections +established after the addition of the event listener. + +Here's an example for using TLS session resumption: + +```js +var tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection' + +`function (tlsSocket) {}` + +This event is emitted after the handshaking process for a new connection has +successfully completed. The argument is an instance of [`tls.TLSSocket`][] and +has all the common stream methods and events. + +`socket.authorized` is a boolean value which indicates if the +client has been verified by one of the supplied certificate authorities for the +server. If `socket.authorized` is false, then `socket.authorizationError` is +set to describe how authorization failed. Implied but worth mentioning: +depending on the settings of the TLS server, unauthorized connections may +be accepted. + +`socket.npnProtocol` is a string containing the selected NPN protocol +and `socket.alpnProtocol` is a string containing the selected ALPN +protocol. When both NPN and ALPN extensions are received, ALPN takes +precedence over NPN and the next protocol is selected by ALPN. When +ALPN has no selected protocol, this returns false. + +`socket.servername` is a string containing the server name requested with +SNI. + +### server.addContext(hostname, context) + +Add secure context that will be used if the client request's SNI hostname +matches the supplied `hostname` (wildcards can be used). `context` can contain +`key`, `cert`, `ca` or any other properties from +[`tls.createSecureContext()`][] `options` argument. + +### server.address() + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`][] for +more information. + +### server.close([callback]) + +Stops the server from accepting new connections. This function is +asynchronous, the server is finally closed when the server emits a `'close'` +event. Optionally, you can pass a callback to listen for the `'close'` event. + +### server.connections + +The number of concurrent connections on the server. + +### server.getTicketKeys() + +Returns a `Buffer` instance holding the keys currently used for +encryption/decryption of the [TLS Session Tickets][] + +### server.listen(port[, hostname][, callback]) + +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. + +This function is asynchronous. The last parameter `callback` will be called +when the server has been bound. + +See `net.Server` for more information. + +### server.setTicketKeys(keys) + +Updates the keys for encryption/decryption of the [TLS Session Tickets][]. + +NOTE: the buffer should be 48 bytes long. See `ticketKeys` option in +[tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) for +more information on how it is used. + +NOTE: the change is effective only for future server connections. Existing +or currently pending server connections will use the previous keys. + +### server.maxConnections + +Set this property to reject connections when the server's connection count +exceeds the specified threshold. + + +## Class: tls.TLSSocket + +This is a wrapped version of [`net.Socket`][] that does transparent encryption +of written data and all required TLS negotiation. + +This instance implements the duplex [Stream][] interface. It has all the +common stream methods and events. + +Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`][] will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options]) + +Construct a new TLSSocket object from an existing TCP socket. + +`socket` is an instance of [`net.Socket`][] + +`options` is an optional object that might contain following properties: + + - `secureContext`: An optional TLS context object from + [`tls.createSecureContext()`][] + + - `isServer`: If `true` the TLS socket will be instantiated in server-mode. + Default: `false` + + - `server`: An optional [`net.Server`][] instance + + - `requestCert`: Optional, see [`tls.createSecurePair()`][] + + - `rejectUnauthorized`: Optional, see [`tls.createSecurePair()`][] + + - `NPNProtocols`: Optional, see [`tls.createServer()`][] + + - `ALPNProtocols`: Optional, see [`tls.createServer()`][] + + - `SNICallback`: Optional, see [`tls.createServer()`][] + + - `session`: Optional, a `Buffer` instance, containing a TLS session + + - `requestOCSP`: Optional, if `true` the OCSP status request extension will + be added to the client hello and an `'OCSPResponse'` event will be emitted + on the socket before establishing a secure communication + +### Event: 'OCSPResponse' + +`function (response) { }` + +This event will be emitted if the `requestOCSP` option was set. `response` is a +`Buffer` containing the server's OCSP response. + +Traditionally, the `response` is a signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect' + +This event is emitted after the handshaking process for a new connection has +successfully completed. The listener will be called regardless of whether or not +the server's certificate has been authorized. It is the user's responsibility to +test `tlsSocket.authorized` to see if the server certificate was signed by one +of the specified CAs. If `tlsSocket.authorized === false` then the error can be +found in `tlsSocket.authorizationError`. Also, if either ALPN or NPN was used +`tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` can be checked for the +negotiated protocol. + +### tlsSocket.address() + +Returns the bound address, the address family name, and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g., +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.authorized + +A boolean that is `true` if the peer certificate was signed by one of the +specified CAs, otherwise `false`. + +### tlsSocket.authorizationError + +The reason why the peer's certificate has not been verified. This property +becomes available only when `tlsSocket.authorized === false`. + +### tlsSocket.encrypted + +Static boolean value, always `true`. May be used to distinguish TLS sockets +from regular ones. + +### tlsSocket.getCipher() + +Returns an object representing the cipher name and the SSL/TLS protocol version +that first defined the cipher. + +Example: +`{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` + +See SSL_CIPHER_get_name() and SSL_CIPHER_get_version() in +https://www.openssl.org/docs/manmaster/ssl/SSL_CIPHER_get_name.html for more +information. + +### tlsSocket.getEphemeralKeyInfo() + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy][] on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket, it returns `null` +if called on a server socket. The supported types are 'DH' and 'ECDH'. The +`name` property is only available in 'ECDH'. + +Example: + + { type: 'ECDH', name: 'prime256v1', size: 256 } + +### tlsSocket.getPeerCertificate([ detailed ]) + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the fields of the certificate. If the +`detailed` argument is `true` the full chain with the `issuer` property will be +returned, if `false` only the top certificate without the `issuer` property. + +Example: + +``` +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerInfo: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { ... another certificate ... }, + raw: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, it returns `null` or an empty +object. + +### tlsSocket.getProtocol() + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. `'unknown'` will be returned for connected sockets that have +not completed the handshaking process. `null` will be returned for server +sockets or disconnected client sockets. + +Examples: +``` +'SSLv3' +'TLSv1' +'TLSv1.1' +'TLSv1.2' +'unknown' +``` + +See https://www.openssl.org/docs/manmaster/ssl/SSL_get_version.html for more +information. + +### tlsSocket.getSession() + +Returns the ASN.1 encoded TLS session or `undefined` if none was negotiated. +Could be used to speed up handshake establishment when reconnecting to the +server. + +### tlsSocket.getTLSTicket() + +NOTE: Works only with client TLS sockets. Useful only for debugging, for +session reuse provide `session` option to [`tls.connect()`][]. + +Returns the TLS session ticket or `undefined` if none was negotiated. + +### tlsSocket.localAddress + +The string representation of the local IP address. + +### tlsSocket.localPort + +The numeric representation of the local port. + +### tlsSocket.remoteAddress + +The string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily + +The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort + +The numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback) + +Initiate TLS renegotiation process. The `options` object may contain the +following fields: `rejectUnauthorized`, `requestCert`. (See [`tls.createServer +()`][] for details.) `callback(err)` will be executed with `null` as `err`, +once the renegotiation is successfully completed. + +NOTE: Can be used to request peer's certificate after the secure connection +has been established. + +ANOTHER NOTE: When running as the server, socket will be destroyed +with an error after `handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size) + +Set maximum TLS fragment size (default and maximum value is: `16384`, minimum +is: `512`). Returns `true` on success, `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + + +## tls.connect(options[, callback]) +## tls.connect(port[, host][, options][, callback]) + +Creates a new client connection to the given `port` and `host` (old API) or +`options.port` and `options.host`. (If `host` is omitted, it defaults to +`localhost`.) `options` should be an object which specifies: + + - `host`: Host the client should connect to. + + - `port`: Port the client should connect to. + + - `socket`: Establish secure connection on a given socket rather than + creating a new socket. If this option is specified, `host` and `port` + are ignored. + + - `path`: Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. + + - `pfx`: A string or `Buffer` containing the private key, certificate, and + CA certs of the client in PFX or PKCS12 format. + + - `key`: A string, `Buffer`, array of strings, or array of `Buffer`s + containing the private key of the client in PEM format. + + - `passphrase`: A string containing the passphrase for the private key or pfx. + + - `cert`: A string, `Buffer`, array of strings, or array of `Buffer`s + containing the certificate key of the client in PEM format. + + - `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs (like VeriSign) will be used. These are used to authorize connections. + + - `ciphers`: A string describing the ciphers to use or exclude, separated by + `:`. Uses the same default cipher suite as [`tls.createServer()`][]. + + - `rejectUnauthorized`: If `true`, the server certificate is verified against + the list of supplied CAs. An `'error'` event is emitted if verification + fails; `err.code` contains the OpenSSL error code. Default: `true`. + + - `NPNProtocols`: An array of strings or `Buffer`s containing supported NPN + protocols. `Buffer`s should have the following format: + `0x05hello0x05world`, where the first byte is the next protocol name's + length. (Passing an array is usually be much simpler: `['hello', 'world']`.) + + - `ALPNProtocols`: An array of strings or `Buffer`s containing the + supported ALPN protocols. `Buffer`s should have following format: + `0x05hello0x05world`, where the first byte is the next protocol + name's length. (Passing an array is usually be much simpler: + `['hello', 'world']`.) + + - `servername`: Server name for the SNI (Server Name Indication) TLS + extension. + + - `checkServerIdentity(servername, cert)`: Provide an override for checking + the server's hostname against the certificate. Should return an error if + verification fails. Returns `undefined` if passing. + + - `secureProtocol`: The SSL method to use, e.g., `SSLv3_method` to force + SSL version 3. The possible values depend on the version of OpenSSL + installed in the environment and are defined in the constant + [SSL_METHODS][]. + + - `secureContext`: An optional TLS context object from + `tls.createSecureContext( ... )`. It can be used for caching client + certificates, keys, and CA certificates. + + - `session`: A `Buffer` instance, containing TLS session. + + - `minDHSize`: Minimum size of the DH parameter in bits to accept a TLS + connection. When a server offers a DH parameter with a size less + than this, the TLS connection is destroyed and an error is thrown. Default: + 1024. + +The `callback` parameter will be added as a listener for the +[`'secureConnect'`][] event. + +`tls.connect()` returns a [`tls.TLSSocket`][] object. + +Here is an example of a client of echo server as described previously: + +```js +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // These are necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // This is necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +var socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +Or + +```js +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('client.pfx') +}; + +var socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + + +## tls.createSecureContext(options) + +Creates a credentials object; the `options` object may contain the following +fields: + +* `pfx` : A string or `Buffer` holding the PFX or PKCS12 encoded private + key, certificate, and CA certificates. +* `key`: A string or `Buffer` containing the private key of the server in + PEM format. To support multiple keys using different algorithms, an array + can be provided. It can either be a plain array of keys or an array of + objects in the format `{pem: key, passphrase: passphrase}`. (Required) +* `passphrase` : A string containing the passphrase for the private key or pfx. +* `cert` : A string containing the PEM encoded certificate +* `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs (like VeriSign) will be used. These are used to authorize connections. +* `crl` : Either a string or list of strings of PEM encoded CRLs + (Certificate Revocation List). +* `ciphers`: A string describing the ciphers to use or exclude. + Consult + + for details on the format. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. For further details see `tls` module + documentation. + +If no 'CA' details are given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options]) + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + + - `credentials`: A secure context object from `tls.createSecureContext( ... )`. + + - `isServer`: A boolean indicating whether this TLS connection should be + opened as a server or a client. + + - `requestCert`: A boolean indicating whether a server should request a + certificate from a connecting client. Only applies to server connections. + + - `rejectUnauthorized`: A boolean indicating whether a server should + automatically reject clients with invalid certificates. Only applies to + servers with `requestCert` enabled. + + - `options`: An object with common SSL options. See [`tls.TLSSocket`][]. + +`tls.createSecurePair()` returns a SecurePair object with `cleartext` and +`encrypted` stream properties. + +NOTE: `cleartext` has the same API as [`tls.TLSSocket`][] + +## tls.createServer(options[, secureConnectionListener]) + +Creates a new [tls.Server][]. The `connectionListener` argument is +automatically set as a listener for the [`'secureConnection'`][] event. The +`options` object may contain the following fields: + + - `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with + the `key`, `cert`, and `ca` options.) + + - `key`: A string or `Buffer` containing the private key of the server in + PEM format. To support multiple keys using different algorithms an array + can be provided. It can either be a plain array of keys or an array of + objects in the format `{pem: key, passphrase: passphrase}`. (Required) + + - `passphrase`: A string containing the passphrase for the private key or pfx. + + - `cert`: A string, `Buffer`, array of strings, or array of `Buffer`s + containing the certificate key of the server in PEM format. (Required) + + - `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs (like VeriSign) will be used. These are used to authorize connections. + + - `crl` : Either a string or array of strings of PEM encoded CRLs (Certificate + Revocation List). + + - `ciphers`: A string describing the ciphers to use or exclude, separated by + `:`. The default cipher suite is: + + ```js + ECDHE-RSA-AES128-GCM-SHA256: + ECDHE-ECDSA-AES128-GCM-SHA256: + ECDHE-RSA-AES256-GCM-SHA384: + ECDHE-ECDSA-AES256-GCM-SHA384: + DHE-RSA-AES128-GCM-SHA256: + ECDHE-RSA-AES128-SHA256: + DHE-RSA-AES128-SHA256: + ECDHE-RSA-AES256-SHA384: + DHE-RSA-AES256-SHA384: + ECDHE-RSA-AES256-SHA256: + DHE-RSA-AES256-SHA256: + HIGH: + !aNULL: + !eNULL: + !EXPORT: + !DES: + !RC4: + !MD5: + !PSK: + !SRP: + !CAMELLIA + ``` + + The default cipher suite prefers GCM ciphers for [Chrome's 'modern + cryptography' setting] and also prefers ECDHE and DHE ciphers for Perfect + Forward Secrecy, while offering *some* backward compatibility. + + 128 bit AES is preferred over 192 and 256 bit AES in light of [specific + attacks affecting larger AES key sizes]. + + Old clients that rely on insecure and deprecated RC4 or DES-based ciphers + (like Internet Explorer 6) cannot complete the handshaking process with + the default configuration. If these clients _must_ be supported, the + [TLS recommendations] may offer a compatible cipher suite. For more details + on the format, see the [OpenSSL cipher list format documentation]. + + - `ecdhCurve`: A string describing a named curve to use for ECDH key agreement + or false to disable ECDH. + + Defaults to `prime256v1` (NIST P-256). Use [`crypto.getCurves()`][] to + obtain a list of available curve names. On recent releases, + `openssl ecparam -list_curves` will also display the name and description of + each available elliptic curve. + + - `dhparam`: A string or `Buffer` containing Diffie Hellman parameters, + required for Perfect Forward Secrecy. Use `openssl dhparam` to create it. + Its key length should be greater than or equal to 1024 bits, otherwise + it throws an error. It is strongly recommended to use 2048 bits or + larger for stronger security. If omitted or invalid, it is silently + discarded and DHE ciphers won't be available. + + - `handshakeTimeout`: Abort the connection if the SSL/TLS handshake does not + finish in the specified number of milliseconds. The default is 120 seconds. + + A `'clientError'` is emitted on the `tls.Server` object whenever a handshake + times out. + + - `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. Default: `true`. + + - `requestCert`: If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Default: + `false`. + + - `rejectUnauthorized`: If `true` the server will reject any connection + which is not authorized with the list of supplied CAs. This option only + has an effect if `requestCert` is `true`. Default: `false`. + + - `NPNProtocols`: An array or `Buffer` of possible NPN protocols. (Protocols + should be ordered by their priority.) + + - `ALPNProtocols`: An array or `Buffer` of possible ALPN + protocols. (Protocols should be ordered by their priority.) When + the server receives both NPN and ALPN extensions from the client, + ALPN takes precedence over NPN and the server does not send an NPN + extension to the client. + + - `SNICallback(servername, cb)`: A function that will be called if the client + supports SNI TLS extension. Two arguments will be passed to it: + `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, where + `ctx` is a SecureContext instance. (`tls.createSecureContext(...)` can be + used to get a proper SecureContext.) If `SNICallback` wasn't provided the + default callback with high-level API will be used (see below). + + - `sessionTimeout`: An integer specifying the number of seconds after which + the TLS session identifiers and TLS session tickets created by the server + will time out. See [SSL_CTX_set_timeout] for more details. + + - `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, + a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS + session tickets on multiple instances of the TLS server. + + NOTE: Automatically shared between `cluster` module workers. + + - `sessionIdContext`: A string containing an opaque identifier for session + resumption. If `requestCert` is `true`, the default is a MD5 hash value + generated from the command-line. (In FIPS mode a truncated SHA1 hash is + used instead.) Otherwise, a default is not provided. + + - `secureProtocol`: The SSL method to use, e.g., `SSLv3_method` to force + SSL version 3. The possible values depend on the version of OpenSSL + installed in the environment and are defined in the constant [SSL_METHODS][]. + +Here is a simple example echo server: + +```js +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +var server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +Or + +```js +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +var server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +You can test this server by connecting to it with `openssl s_client`: + +``` +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.getCiphers() + +Returns an array with the names of the supported SSL ciphers. + +Example: + +```js +var ciphers = tls.getCiphers(); +console.log(ciphers); // ['AES128-SHA', 'AES256-SHA', ...] +``` + + +[OpenSSL cipher list format documentation]: https://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT +[Chrome's 'modern cryptography' setting]: https://www.chromium.org/Home/chromium-security/education/tls#TOC-Deprecation-of-TLS-Features-Algorithms-in-Chrome +[specific attacks affecting larger AES key sizes]: https://www.schneier.com/blog/archives/2009/07/another_new_aes.html +[BEAST attacks]: https://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html +[`crypto.getCurves()`]: crypto.html#crypto_crypto_getcurves +[`tls.createServer()`]: #tls_tls_createserver_options_secureconnectionlistener +[`tls.createSecurePair()`]: #tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options +[`tls.TLSSocket`]: #tls_class_tls_tlssocket +[`net.Server`]: net.html#net_class_net_server +[`net.Socket`]: net.html#net_class_net_socket +[`net.Server.address()`]: net.html#net_server_address +[`'secureConnect'`]: #tls_event_secureconnect +[`'secureConnection'`]: #tls_event_secureconnection +[Perfect Forward Secrecy]: #tls_perfect_forward_secrecy +[Stream]: stream.html#stream_stream +[SSL_METHODS]: https://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS +[tls.Server]: #tls_class_tls_server +[SSL_CTX_set_timeout]: https://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html +[RFC 4492]: https://www.rfc-editor.org/rfc/rfc4492.txt +[Forward secrecy]: https://en.wikipedia.org/wiki/Perfect_forward_secrecy +[DHE]: https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange +[ECDHE]: https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman +[asn1.js]: https://npmjs.org/package/asn1.js +[OCSP request]: https://en.wikipedia.org/wiki/OCSP_stapling +[TLS recommendations]: https://wiki.mozilla.org/Security/Server_Side_TLS +[TLS Session Tickets]: https://www.ietf.org/rfc/rfc5077.txt +[`tls.TLSSocket.getPeerCertificate()`]: #tls_tlssocket_getpeercertificate_detailed +[`tls.createSecureContext()`]: #tls_tls_createsecurecontext_options +[`tls.connect()`]: #tls_tls_connect_options_callback diff --git a/doc/api/tty.markdown b/doc/api/tty.md similarity index 100% rename from doc/api/tty.markdown rename to doc/api/tty.md diff --git a/doc/api/url.markdown b/doc/api/url.md similarity index 100% rename from doc/api/url.markdown rename to doc/api/url.md diff --git a/doc/api/util.markdown b/doc/api/util.md similarity index 100% rename from doc/api/util.markdown rename to doc/api/util.md diff --git a/doc/api/v8.markdown b/doc/api/v8.md similarity index 100% rename from doc/api/v8.markdown rename to doc/api/v8.md diff --git a/doc/api/vm.markdown b/doc/api/vm.markdown deleted file mode 100644 index 674c76d6a13bff..00000000000000 --- a/doc/api/vm.markdown +++ /dev/null @@ -1,316 +0,0 @@ -# Executing JavaScript - - Stability: 2 - Stable - - - -You can access this module with: - -```js -const vm = require('vm'); -``` - -JavaScript code can be compiled and run immediately or compiled, saved, and run -later. - -## Class: Script - -A class for holding precompiled scripts, and running them in specific sandboxes. - -### new vm.Script(code, options) - -Creating a new `Script` compiles `code` but does not run it. Instead, the -created `vm.Script` object represents this compiled code. This script can be run -later many times using methods below. The returned script is not bound to any -global object. It is bound before each run, just for that run. - -The options when creating a script are: - -- `filename`: allows you to control the filename that shows up in any stack - traces produced from this script. -- `lineOffset`: allows you to add an offset to the line number that is - displayed in stack traces -- `columnOffset`: allows you to add an offset to the column number that is - displayed in stack traces -- `displayErrors`: whether or not to print any errors to stderr, with the - line of code that caused them highlighted, before throwing an exception. - Applies only to syntax errors compiling the code; errors while running the - code are controlled by the options to the script's methods. -- `timeout`: a number of milliseconds to execute `code` before terminating - execution. If execution is terminated, an [`Error`][] will be thrown. -- `cachedData`: an optional `Buffer` with V8's code cache data for the supplied - source. When supplied `cachedDataRejected` value will be set to either - `true` or `false` depending on acceptance of the data by V8. -- `produceCachedData`: if `true` and no `cachedData` is present - V8 tries to - produce code cache data for `code`. Upon success, a `Buffer` with V8's code - cache data will be produced and stored in `cachedData` property of the - returned `vm.Script` instance. `cachedDataProduced` value will be set to - either `true` or `false` depending on whether code cache data is produced - successfully. - -### script.runInContext(contextifiedSandbox[, options]) - -Similar to [`vm.runInContext()`][] but a method of a precompiled `Script` -object. `script.runInContext()` runs `script`'s compiled code in -`contextifiedSandbox` and returns the result. Running code does not have access -to local scope. - -`script.runInContext()` takes the same options as -[`script.runInThisContext()`][]. - -Example: compile code that increments a global variable and sets one, then -execute the code multiple times. These globals are contained in the sandbox. - -```js -const util = require('util'); -const vm = require('vm'); - -var sandbox = { - animal: 'cat', - count: 2 -}; - -var context = new vm.createContext(sandbox); -var script = new vm.Script('count += 1; name = "kitty"'); - -for (var i = 0; i < 10; ++i) { - script.runInContext(context); -} - -console.log(util.inspect(sandbox)); - -// { animal: 'cat', count: 12, name: 'kitty' } -``` - -Note that running untrusted code is a tricky business requiring great care. -`script.runInContext()` is quite useful, but safely running untrusted code -requires a separate process. - -### script.runInNewContext([sandbox][, options]) - -Similar to [`vm.runInNewContext()`][] but a method of a precompiled `Script` -object. `script.runInNewContext()` contextifies `sandbox` if passed or creates a -new contextified sandbox if it's omitted, and then runs `script`'s compiled code -with the sandbox as the global object and returns the result. Running code does -not have access to local scope. - -`script.runInNewContext()` takes the same options as -[`script.runInThisContext()`][]. - -Example: compile code that sets a global variable, then execute the code -multiple times in different contexts. These globals are set on and contained in -the sandboxes. - -```js -const util = require('util'); -const vm = require('vm'); - -const sandboxes = [{}, {}, {}]; - -const script = new vm.Script('globalVar = "set"'); - -sandboxes.forEach((sandbox) => { - script.runInNewContext(sandbox); -}); - -console.log(util.inspect(sandboxes)); - -// [{ globalVar: 'set' }, { globalVar: 'set' }, { globalVar: 'set' }] -``` - -Note that running untrusted code is a tricky business requiring great care. -`script.runInNewContext()` is quite useful, but safely running untrusted code -requires a separate process. - -### script.runInThisContext([options]) - -Similar to [`vm.runInThisContext()`]() but a method of a precompiled `Script` -object. `script.runInThisContext()` runs `script`'s compiled code and returns -the result. Running code does not have access to local scope, but does have -access to the current `global` object. - -Example of using `script.runInThisContext()` to compile code once and run it -multiple times: - -```js -const vm = require('vm'); - -global.globalVar = 0; - -const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' }); - -for (var i = 0; i < 1000; ++i) { - script.runInThisContext(); -} - -console.log(globalVar); - -// 1000 -``` - -The options for running a script are: - -- `filename`: allows you to control the filename that shows up in any stack - traces produced. -- `lineOffset`: allows you to add an offset to the line number that is - displayed in stack traces -- `columnOffset`: allows you to add an offset to the column number that is - displayed in stack traces -- `displayErrors`: whether or not to print any errors to stderr, with the - line of code that caused them highlighted, before throwing an exception. - Applies only to runtime errors executing the code; it is impossible to create - a `Script` instance with syntax errors, as the constructor will throw. -- `timeout`: a number of milliseconds to execute the script before terminating - execution. If execution is terminated, an [`Error`][] will be thrown. - -## vm.createContext([sandbox]) - -If given a `sandbox` object, will "contextify" that sandbox so that it can be -used in calls to [`vm.runInContext()`][] or [`script.runInContext()`][]. Inside -scripts run as such, `sandbox` will be the global object, retaining all its -existing properties but also having the built-in objects and functions any -standard [global object][] has. Outside of scripts run by the vm module, -`sandbox` will be unchanged. - -If not given a sandbox object, returns a new, empty contextified sandbox object -you can use. - -This function is useful for creating a sandbox that can be used to run multiple -scripts, e.g. if you were emulating a web browser it could be used to create a -single sandbox representing a window's global object, then run all ` + +``` + +--- + +To use iMurmurHash in Node.js, install the module using NPM: + +```bash +npm install imurmurhash +``` + +Then simply include it in your scripts: + +```javascript +MurmurHash3 = require('imurmurhash'); +``` + +Quick Example +------------- + +```javascript +// Create the initial hash +var hashState = MurmurHash3('string'); + +// Incrementally add text +hashState.hash('more strings'); +hashState.hash('even more strings'); + +// All calls can be chained if desired +hashState.hash('and').hash('some').hash('more'); + +// Get a result +hashState.result(); +// returns 0xe4ccfe6b +``` + +Functions +--------- + +### MurmurHash3 ([string], [seed]) +Get a hash state object, optionally initialized with the given _string_ and _seed_. _Seed_ must be a positive integer if provided. Calling this function without the `new` keyword will return a cached state object that has been reset. This is safe to use as long as the object is only used from a single thread and no other hashes are created while operating on this one. If this constraint cannot be met, you can use `new` to create a new state object. For example: + +```javascript +// Use the cached object, calling the function again will return the same +// object (but reset, so the current state would be lost) +hashState = MurmurHash3(); +... + +// Create a new object that can be safely used however you wish. Calling the +// function again will simply return a new state object, and no state loss +// will occur, at the cost of creating more objects. +hashState = new MurmurHash3(); +``` + +Both methods can be mixed however you like if you have different use cases. + +--- + +### MurmurHash3.prototype.hash (string) +Incrementally add _string_ to the hash. This can be called as many times as you want for the hash state object, including after a call to `result()`. Returns `this` so calls can be chained. + +--- + +### MurmurHash3.prototype.result () +Get the result of the hash as a 32-bit positive integer. This performs the tail and finalizer portions of the algorithm, but does not store the result in the state object. This means that it is perfectly safe to get results and then continue adding strings via `hash`. + +```javascript +// Do the whole string at once +MurmurHash3('this is a test string').result(); +// 0x70529328 + +// Do part of the string, get a result, then the other part +var m = MurmurHash3('this is a'); +m.result(); +// 0xbfc4f834 +m.hash(' test string').result(); +// 0x70529328 (same as above) +``` + +--- + +### MurmurHash3.prototype.reset ([seed]) +Reset the state object for reuse, optionally using the given _seed_ (defaults to 0 like the constructor). Returns `this` so calls can be chained. + +--- + +License (MIT) +------------- +Copyright (c) 2013 Gary Court, Jens Taylor + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/imurmurhash/imurmurhash.js b/tools/eslint/node_modules/imurmurhash/imurmurhash.js new file mode 100644 index 00000000000000..05347a2536fce2 --- /dev/null +++ b/tools/eslint/node_modules/imurmurhash/imurmurhash.js @@ -0,0 +1,138 @@ +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +(function(){ + var cache; + + // Call this function without `new` to use the cached object (good for + // single-threaded environments), or with `new` to create a new object. + // + // @param {string} key A UTF-16 or ASCII string + // @param {number} seed An optional positive integer + // @return {object} A MurmurHash3 object for incremental hashing + function MurmurHash3(key, seed) { + var m = this instanceof MurmurHash3 ? this : cache; + m.reset(seed) + if (typeof key === 'string' && key.length > 0) { + m.hash(key); + } + + if (m !== this) { + return m; + } + }; + + // Incrementally add a string to this hash + // + // @param {string} key A UTF-16 or ASCII string + // @return {object} this + MurmurHash3.prototype.hash = function(key) { + var h1, k1, i, top, len; + + len = key.length; + this.len += len; + + k1 = this.k1; + i = 0; + switch (this.rem) { + case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; + case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; + case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; + case 3: + k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; + k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; + } + + this.rem = (len + this.rem) & 3; // & 3 is same as % 4 + len -= this.rem; + if (len > 0) { + h1 = this.h1; + while (1) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + + h1 ^= k1; + h1 = (h1 << 13) | (h1 >>> 19); + h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; + + if (i >= len) { + break; + } + + k1 = ((key.charCodeAt(i++) & 0xffff)) ^ + ((key.charCodeAt(i++) & 0xffff) << 8) ^ + ((key.charCodeAt(i++) & 0xffff) << 16); + top = key.charCodeAt(i++); + k1 ^= ((top & 0xff) << 24) ^ + ((top & 0xff00) >> 8); + } + + k1 = 0; + switch (this.rem) { + case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; + case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; + case 1: k1 ^= (key.charCodeAt(i) & 0xffff); + } + + this.h1 = h1; + } + + this.k1 = k1; + return this; + }; + + // Get the result of this hash + // + // @return {number} The 32-bit hash + MurmurHash3.prototype.result = function() { + var k1, h1; + + k1 = this.k1; + h1 = this.h1; + + if (k1 > 0) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + h1 ^= k1; + } + + h1 ^= this.len; + + h1 ^= h1 >>> 16; + h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; + h1 ^= h1 >>> 13; + h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; + h1 ^= h1 >>> 16; + + return h1 >>> 0; + }; + + // Reset the hash object for reuse + // + // @param {number} seed An optional positive integer + MurmurHash3.prototype.reset = function(seed) { + this.h1 = typeof seed === 'number' ? seed : 0; + this.rem = this.k1 = this.len = 0; + return this; + }; + + // A cached object to use. This can be safely used if you're in a single- + // threaded environment, otherwise you need to create new hashes to use. + cache = new MurmurHash3(); + + if (typeof(module) != 'undefined') { + module.exports = MurmurHash3; + } else { + this.MurmurHash3 = MurmurHash3; + } +}()); diff --git a/tools/eslint/node_modules/imurmurhash/imurmurhash.min.js b/tools/eslint/node_modules/imurmurhash/imurmurhash.min.js new file mode 100644 index 00000000000000..dc0ee88d6b69c9 --- /dev/null +++ b/tools/eslint/node_modules/imurmurhash/imurmurhash.min.js @@ -0,0 +1,12 @@ +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +!function(){function t(h,r){var s=this instanceof t?this:e;return s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this?s:void 0}var e;t.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=3&i+this.rem,i-=this.rem,i>0){for(e=this.h1;;){if(h=4294967295&11601*h+3432906752*(65535&h),h=h<<15|h>>>17,h=4294967295&13715*h+461832192*(65535&h),e^=h,e=e<<13|e>>>19,e=4294967295&5*e+3864292196,r>=i)break;h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,s=t.charCodeAt(r++),h^=(255&s)<<24^(65280&s)>>8}switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},t.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(t=4294967295&11601*t+3432906752*(65535&t),t=t<<15|t>>>17,t=4294967295&13715*t+461832192*(65535&t),e^=t),e^=this.len,e^=e>>>16,e=4294967295&51819*e+2246770688*(65535&e),e^=e>>>13,e=4294967295&44597*e+3266445312*(65535&e),e^=e>>>16,e>>>0},t.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},e=new t,"undefined"!=typeof module?module.exports=t:this.MurmurHash3=t}(); \ No newline at end of file diff --git a/tools/eslint/node_modules/imurmurhash/package.json b/tools/eslint/node_modules/imurmurhash/package.json new file mode 100644 index 00000000000000..a260b301258a4d --- /dev/null +++ b/tools/eslint/node_modules/imurmurhash/package.json @@ -0,0 +1,85 @@ +{ + "_args": [ + [ + "imurmurhash@^0.1.4", + "/Users/silverwind/git/node/tools/package/package" + ] + ], + "_from": "imurmurhash@>=0.1.4 <0.2.0", + "_id": "imurmurhash@0.1.4", + "_inCache": true, + "_installable": true, + "_location": "/imurmurhash", + "_npmUser": { + "email": "jensyt@gmail.com", + "name": "jensyt" + }, + "_npmVersion": "1.3.2", + "_phantomChildren": {}, + "_requested": { + "name": "imurmurhash", + "raw": "imurmurhash@^0.1.4", + "rawSpec": "^0.1.4", + "scope": null, + "spec": ">=0.1.4 <0.2.0", + "type": "range" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "_shasum": "9218b9b2b928a238b13dc4fb6b6d576f231453ea", + "_shrinkwrap": null, + "_spec": "imurmurhash@^0.1.4", + "_where": "/Users/silverwind/git/node/tools/package/package", + "author": { + "email": "jensyt@gmail.com", + "name": "Jens Taylor", + "url": "https://github.com/homebrewing" + }, + "bugs": { + "url": "https://github.com/jensyt/imurmurhash-js/issues" + }, + "dependencies": {}, + "description": "An incremental implementation of MurmurHash3", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "9218b9b2b928a238b13dc4fb6b6d576f231453ea", + "tarball": "http://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" + }, + "engines": { + "node": ">=0.8.19" + }, + "files": [ + "README.md", + "imurmurhash.js", + "imurmurhash.min.js", + "package.json" + ], + "homepage": "https://github.com/jensyt/imurmurhash-js", + "keywords": [ + "hash", + "incremental", + "murmur", + "murmurhash", + "murmurhash3" + ], + "license": "MIT", + "main": "imurmurhash.js", + "maintainers": [ + { + "name": "jensyt", + "email": "jensyt@gmail.com" + } + ], + "name": "imurmurhash", + "optionalDependencies": {}, + "readme": "iMurmurHash.js\n==============\n\nAn incremental implementation of the MurmurHash3 (32-bit) hashing algorithm for JavaScript based on [Gary Court's implementation](https://github.com/garycourt/murmurhash-js) with [kazuyukitanimura's modifications](https://github.com/kazuyukitanimura/murmurhash-js).\n\nThis version works significantly faster than the non-incremental version if you need to hash many small strings into a single hash, since string concatenation (to build the single string to pass the non-incremental version) is fairly costly. In one case tested, using the incremental version was about 50% faster than concatenating 5-10 strings and then hashing.\n\nInstallation\n------------\n\nTo use iMurmurHash in the browser, [download the latest version](https://raw.github.com/jensyt/imurmurhash-js/master/imurmurhash.min.js) and include it as a script on your site.\n\n```html\n\n\n```\n\n---\n\nTo use iMurmurHash in Node.js, install the module using NPM:\n\n```bash\nnpm install imurmurhash\n```\n\nThen simply include it in your scripts:\n\n```javascript\nMurmurHash3 = require('imurmurhash');\n```\n\nQuick Example\n-------------\n\n```javascript\n// Create the initial hash\nvar hashState = MurmurHash3('string');\n\n// Incrementally add text\nhashState.hash('more strings');\nhashState.hash('even more strings');\n\n// All calls can be chained if desired\nhashState.hash('and').hash('some').hash('more');\n\n// Get a result\nhashState.result();\n// returns 0xe4ccfe6b\n```\n\nFunctions\n---------\n\n### MurmurHash3 ([string], [seed])\nGet a hash state object, optionally initialized with the given _string_ and _seed_. _Seed_ must be a positive integer if provided. Calling this function without the `new` keyword will return a cached state object that has been reset. This is safe to use as long as the object is only used from a single thread and no other hashes are created while operating on this one. If this constraint cannot be met, you can use `new` to create a new state object. For example:\n\n```javascript\n// Use the cached object, calling the function again will return the same\n// object (but reset, so the current state would be lost)\nhashState = MurmurHash3();\n...\n\n// Create a new object that can be safely used however you wish. Calling the\n// function again will simply return a new state object, and no state loss\n// will occur, at the cost of creating more objects.\nhashState = new MurmurHash3();\n```\n\nBoth methods can be mixed however you like if you have different use cases.\n\n---\n\n### MurmurHash3.prototype.hash (string)\nIncrementally add _string_ to the hash. This can be called as many times as you want for the hash state object, including after a call to `result()`. Returns `this` so calls can be chained.\n\n---\n\n### MurmurHash3.prototype.result ()\nGet the result of the hash as a 32-bit positive integer. This performs the tail and finalizer portions of the algorithm, but does not store the result in the state object. This means that it is perfectly safe to get results and then continue adding strings via `hash`.\n\n```javascript\n// Do the whole string at once\nMurmurHash3('this is a test string').result();\n// 0x70529328\n\n// Do part of the string, get a result, then the other part\nvar m = MurmurHash3('this is a');\nm.result();\n// 0xbfc4f834\nm.hash(' test string').result();\n// 0x70529328 (same as above)\n```\n\n---\n\n### MurmurHash3.prototype.reset ([seed])\nReset the state object for reuse, optionally using the given _seed_ (defaults to 0 like the constructor). Returns `this` so calls can be chained.\n\n---\n\nLicense (MIT)\n-------------\nCopyright (c) 2013 Gary Court, Jens Taylor\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/jensyt/imurmurhash-js.git" + }, + "version": "0.1.4" +} diff --git a/tools/eslint/node_modules/inflight/.eslintrc b/tools/eslint/node_modules/inflight/.eslintrc deleted file mode 100644 index b7a1550efc2b2c..00000000000000 --- a/tools/eslint/node_modules/inflight/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "env" : { - "node" : true - }, - "rules" : { - "semi": [2, "never"], - "strict": 0, - "quotes": [1, "single", "avoid-escape"], - "no-use-before-define": 0, - "curly": 0, - "no-underscore-dangle": 0, - "no-lonely-if": 1, - "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], - "no-mixed-requires": 0, - "space-infix-ops": 0 - } -} diff --git a/tools/eslint/node_modules/inflight/package.json b/tools/eslint/node_modules/inflight/package.json index 7db3e9ddab6b30..e9d4f97951b132 100644 --- a/tools/eslint/node_modules/inflight/package.json +++ b/tools/eslint/node_modules/inflight/package.json @@ -2,14 +2,14 @@ "_args": [ [ "inflight@^1.0.4", - "/Users/trott/test/node_modules/eslint/node_modules/glob" + "/Users/silverwind/git/node/tools/package/package/node_modules/globby/node_modules/glob" ] ], "_from": "inflight@>=1.0.4 <2.0.0", "_id": "inflight@1.0.4", "_inCache": true, "_installable": true, - "_location": "/eslint/inflight", + "_location": "/inflight", "_nodeVersion": "0.10.32", "_npmUser": { "email": "ogd@aoaioxxysz.net", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/glob", - "/eslint/rimraf/glob" + "/glob", + "/globby/glob" ], "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", "_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", "_shrinkwrap": null, "_spec": "inflight@^1.0.4", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/glob", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/globby/node_modules/glob", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -61,16 +61,16 @@ "main": "inflight.js", "maintainers": [ { - "email": "i@izs.me", - "name": "isaacs" + "name": "isaacs", + "email": "i@izs.me" }, { - "email": "ogd@aoaioxxysz.net", - "name": "othiym23" + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" }, { - "email": "me@re-becca.org", - "name": "iarna" + "name": "iarna", + "email": "me@re-becca.org" } ], "name": "inflight", diff --git a/tools/eslint/node_modules/inflight/test.js b/tools/eslint/node_modules/inflight/test.js deleted file mode 100644 index 2bb75b38814a60..00000000000000 --- a/tools/eslint/node_modules/inflight/test.js +++ /dev/null @@ -1,97 +0,0 @@ -var test = require('tap').test -var inf = require('./inflight.js') - - -function req (key, cb) { - cb = inf(key, cb) - if (cb) setTimeout(function () { - cb(key) - cb(key) - }) - return cb -} - -test('basic', function (t) { - var calleda = false - var a = req('key', function (k) { - t.notOk(calleda) - calleda = true - t.equal(k, 'key') - if (calledb) t.end() - }) - t.ok(a, 'first returned cb function') - - var calledb = false - var b = req('key', function (k) { - t.notOk(calledb) - calledb = true - t.equal(k, 'key') - if (calleda) t.end() - }) - - t.notOk(b, 'second should get falsey inflight response') -}) - -test('timing', function (t) { - var expect = [ - 'method one', - 'start one', - 'end one', - 'two', - 'tick', - 'three' - ] - var i = 0 - - function log (m) { - t.equal(m, expect[i], m + ' === ' + expect[i]) - ++i - if (i === expect.length) - t.end() - } - - function method (name, cb) { - log('method ' + name) - process.nextTick(cb) - } - - var one = inf('foo', function () { - log('start one') - var three = inf('foo', function () { - log('three') - }) - if (three) method('three', three) - log('end one') - }) - - method('one', one) - - var two = inf('foo', function () { - log('two') - }) - if (two) method('one', two) - - process.nextTick(log.bind(null, 'tick')) -}) - -test('parameters', function (t) { - t.plan(8) - - var a = inf('key', function (first, second, third) { - t.equal(first, 1) - t.equal(second, 2) - t.equal(third, 3) - }) - t.ok(a, 'first returned cb function') - - var b = inf('key', function (first, second, third) { - t.equal(first, 1) - t.equal(second, 2) - t.equal(third, 3) - }) - t.notOk(b, 'second should get falsey inflight response') - - setTimeout(function () { - a(1, 2, 3) - }) -}) diff --git a/tools/eslint/node_modules/inherits/package.json b/tools/eslint/node_modules/inherits/package.json index 57448988915c7b..d121220ba659ba 100644 --- a/tools/eslint/node_modules/inherits/package.json +++ b/tools/eslint/node_modules/inherits/package.json @@ -2,14 +2,14 @@ "_args": [ [ "inherits@~2.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/concat-stream" + "/Users/silverwind/git/node/tools/package/package/node_modules/concat-stream" ] ], "_from": "inherits@>=2.0.1 <2.1.0", "_id": "inherits@2.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/inherits", + "_location": "/inherits", "_npmUser": { "email": "i@izs.me", "name": "isaacs" @@ -25,16 +25,16 @@ "type": "range" }, "_requiredBy": [ - "/eslint/concat-stream", - "/eslint/glob", - "/eslint/readable-stream", - "/eslint/rimraf/glob" + "/concat-stream", + "/glob", + "/globby/glob", + "/readable-stream" ], "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", "_shrinkwrap": null, "_spec": "inherits@~2.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/concat-stream", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/concat-stream", "browser": "./inherits_browser.js", "bugs": { "url": "https://github.com/isaacs/inherits/issues" @@ -45,25 +45,25 @@ "directories": {}, "dist": { "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + "tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, "homepage": "https://github.com/isaacs/inherits#readme", "keywords": [ - "inheritance", + "browser", + "browserify", "class", + "inheritance", + "inherits", "klass", - "oop", "object-oriented", - "inherits", - "browser", - "browserify" + "oop" ], "license": "ISC", "main": "./inherits.js", "maintainers": [ { - "email": "i@izs.me", - "name": "isaacs" + "name": "isaacs", + "email": "i@izs.me" } ], "name": "inherits", diff --git a/tools/eslint/node_modules/inherits/test.js b/tools/eslint/node_modules/inherits/test.js deleted file mode 100644 index fc53012d31c0cd..00000000000000 --- a/tools/eslint/node_modules/inherits/test.js +++ /dev/null @@ -1,25 +0,0 @@ -var inherits = require('./inherits.js') -var assert = require('assert') - -function test(c) { - assert(c.constructor === Child) - assert(c.constructor.super_ === Parent) - assert(Object.getPrototypeOf(c) === Child.prototype) - assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) - assert(c instanceof Child) - assert(c instanceof Parent) -} - -function Child() { - Parent.call(this) - test(this) -} - -function Parent() {} - -inherits(Child, Parent) - -var c = new Child -test(c) - -console.log('ok') diff --git a/tools/eslint/node_modules/inquirer/package.json b/tools/eslint/node_modules/inquirer/package.json index 654a767f7e5fad..529ff5cbd87574 100644 --- a/tools/eslint/node_modules/inquirer/package.json +++ b/tools/eslint/node_modules/inquirer/package.json @@ -2,14 +2,14 @@ "_args": [ [ "inquirer@^0.12.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "inquirer@>=0.12.0 <0.13.0", "_id": "inquirer@0.12.0", "_inCache": true, "_installable": true, - "_location": "/eslint/inquirer", + "_location": "/inquirer", "_nodeVersion": "5.2.0", "_npmOperationalInternal": { "host": "packages-9-west.internal.npmjs.com", @@ -30,13 +30,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", "_shasum": "1ef2bfd63504df0bc75785fff8c2c41df12f077e", "_shrinkwrap": null, "_spec": "inquirer@^0.12.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "admin@simonboudrias.com", "name": "Simon Boudrias" @@ -74,7 +74,7 @@ "directories": {}, "dist": { "shasum": "1ef2bfd63504df0bc75785fff8c2c41df12f077e", - "tarball": "http://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz" + "tarball": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz" }, "files": [ "lib" @@ -82,19 +82,19 @@ "gitHead": "a0c2d4d2bcd2818f27c8a2e96477d65f0f386944", "homepage": "https://github.com/sboudrias/Inquirer.js#readme", "keywords": [ + "cli", "command", + "menu", "prompt", "stdin", - "cli", - "tty", - "menu" + "tty" ], "license": "MIT", "main": "lib/inquirer.js", "maintainers": [ { - "email": "admin@simonboudrias.com", - "name": "sboudrias" + "name": "sboudrias", + "email": "admin@simonboudrias.com" } ], "name": "inquirer", diff --git a/tools/eslint/node_modules/is-fullwidth-code-point/package.json b/tools/eslint/node_modules/is-fullwidth-code-point/package.json index f2869d6d675099..05ef35459e7e20 100644 --- a/tools/eslint/node_modules/is-fullwidth-code-point/package.json +++ b/tools/eslint/node_modules/is-fullwidth-code-point/package.json @@ -2,14 +2,14 @@ "_args": [ [ "is-fullwidth-code-point@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/readline2" + "/Users/silverwind/git/node/tools/package/package/node_modules/readline2" ] ], "_from": "is-fullwidth-code-point@>=1.0.0 <2.0.0", "_id": "is-fullwidth-code-point@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/is-fullwidth-code-point", + "_location": "/is-fullwidth-code-point", "_nodeVersion": "0.12.5", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/readline2", - "/eslint/string-width" + "/readline2", + "/string-width" ], "_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "_shasum": "ef9e31386f031a7f0d643af82fde50c457ef00cb", "_shrinkwrap": null, "_spec": "is-fullwidth-code-point@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/readline2", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/readline2", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -64,27 +64,27 @@ "gitHead": "f2152d357f41f82785436d428e4f8ede143b7548", "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point", "keywords": [ - "fullwidth", - "full-width", - "full", - "width", - "unicode", - "character", "char", - "string", - "str", - "codepoint", + "character", + "check", "code", - "point", - "is", + "codepoint", "detect", - "check" + "full", + "full-width", + "fullwidth", + "is", + "point", + "str", + "string", + "unicode", + "width" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "is-fullwidth-code-point", diff --git a/tools/eslint/node_modules/is-my-json-valid/.npmignore b/tools/eslint/node_modules/is-my-json-valid/.npmignore deleted file mode 100644 index dbb0721ce547c1..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -cosmicrealms.com diff --git a/tools/eslint/node_modules/is-my-json-valid/.travis.yml b/tools/eslint/node_modules/is-my-json-valid/.travis.yml deleted file mode 100644 index 6e5919de39a312..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - "0.10" diff --git a/tools/eslint/node_modules/is-my-json-valid/README.md b/tools/eslint/node_modules/is-my-json-valid/README.md index cbf2b20d336045..104a425ad204ed 100644 --- a/tools/eslint/node_modules/is-my-json-valid/README.md +++ b/tools/eslint/node_modules/is-my-json-valid/README.md @@ -40,7 +40,7 @@ console.log(validate.errors) You can also pass the schema as a string ``` js -var validate = validate('{"type": ... }') +var validate = validator('{"type": ... }') ``` Optionally you can use the require submodule to load a schema from `__dirname` @@ -128,7 +128,7 @@ var validate = validator({ }) validate({hello: 100}); -console.log(validate.errors) // {field: 'data.hello', message: 'is the wrong type', value: 100} +console.log(validate.errors) // {field: 'data.hello', message: 'is the wrong type', value: 100, type: 'string'} ``` ## Greedy mode tries to validate as much as possible diff --git a/tools/eslint/node_modules/is-my-json-valid/index.js b/tools/eslint/node_modules/is-my-json-valid/index.js index f24db9b1c9062b..f929bb75394944 100644 --- a/tools/eslint/node_modules/is-my-json-valid/index.js +++ b/tools/eslint/node_modules/is-my-json-valid/index.js @@ -5,7 +5,6 @@ var xtend = require('xtend') var formats = require('./formats') var get = function(obj, additionalSchemas, ptr) { - if (/^https?:\/\//.test(ptr)) return null var visit = function(sub) { if (sub && sub.id === ptr) return sub @@ -98,13 +97,25 @@ var unique = function(array) { return true } +var isMultipleOf = function(name, multipleOf) { + var res; + var factor = ((multipleOf | 0) !== multipleOf) ? Math.pow(10, multipleOf.toString().split('.').pop().length) : 1 + if (factor > 1) { + var factorName = ((name | 0) !== name) ? Math.pow(10, name.toString().split('.').pop().length) : 1 + if (factorName > factor) res = true + else res = Math.round(factor * name) % (factor * multipleOf) + } + else res = name % multipleOf; + return !res; +} + var toType = function(node) { return node.type } var compile = function(schema, cache, root, reporter, opts) { var fmts = opts ? xtend(formats, opts.formats) : formats - var scope = {unique:unique, formats:fmts} + var scope = {unique:unique, formats:fmts, isMultipleOf:isMultipleOf} var verbose = opts ? !!opts.verbose : false; var greedy = opts && opts.greedy !== undefined ? opts.greedy : false; @@ -150,7 +161,7 @@ var compile = function(schema, cache, root, reporter, opts) { if (reporter === true) { validate('if (validate.errors === null) validate.errors = []') if (verbose) { - validate('validate.errors.push({field:%s,message:%s,value:%s})', formatName(prop || name), JSON.stringify(msg), value || name) + validate('validate.errors.push({field:%s,message:%s,value:%s,type:%s})', formatName(prop || name), JSON.stringify(msg), value || name, JSON.stringify(type)) } else { validate('validate.errors.push({field:%s,message:%s})', formatName(prop || name), JSON.stringify(msg)) } @@ -434,9 +445,7 @@ var compile = function(schema, cache, root, reporter, opts) { if (node.multipleOf !== undefined) { if (type !== 'number' && type !== 'integer') validate('if (%s) {', types.number(name)) - var factor = ((node.multipleOf | 0) !== node.multipleOf) ? Math.pow(10, node.multipleOf.toString().split('.').pop().length) : 1 - if (factor > 1) validate('if ((%d*%s) % %d) {', factor, name, factor*node.multipleOf) - else validate('if (%s % %d) {', name, node.multipleOf) + validate('if (!isMultipleOf(%s, %d)) {', name, node.multipleOf) error('has a remainder') validate('}') diff --git a/tools/eslint/node_modules/is-my-json-valid/package.json b/tools/eslint/node_modules/is-my-json-valid/package.json index 929ada2ba28d34..62cd6f7c5f5af2 100644 --- a/tools/eslint/node_modules/is-my-json-valid/package.json +++ b/tools/eslint/node_modules/is-my-json-valid/package.json @@ -2,15 +2,19 @@ "_args": [ [ "is-my-json-valid@^2.10.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "is-my-json-valid@>=2.10.0 <3.0.0", - "_id": "is-my-json-valid@2.12.4", + "_id": "is-my-json-valid@2.13.1", "_inCache": true, "_installable": true, - "_location": "/eslint/is-my-json-valid", + "_location": "/is-my-json-valid", "_nodeVersion": "4.2.3", + "_npmOperationalInternal": { + "host": "packages-5-east.internal.npmjs.com", + "tmp": "tmp/is-my-json-valid-2.13.1.tgz_1456180270224_0.17748022079467773" + }, "_npmUser": { "email": "mathiasbuus@gmail.com", "name": "mafintosh" @@ -26,13 +30,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], - "_resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.4.tgz", - "_shasum": "d4ed2bc1d7f88daf8d0f763b3e3e39a69bd37880", + "_resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.13.1.tgz", + "_shasum": "d55778a82feb6b0963ff4be111d5d1684e890707", "_shrinkwrap": null, "_spec": "is-my-json-valid@^2.10.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "name": "Mathias Buus" }, @@ -51,35 +55,35 @@ }, "directories": {}, "dist": { - "shasum": "d4ed2bc1d7f88daf8d0f763b3e3e39a69bd37880", - "tarball": "http://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.4.tgz" + "shasum": "d55778a82feb6b0963ff4be111d5d1684e890707", + "tarball": "http://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.13.1.tgz" }, - "gitHead": "8978aa8f40eef4ac47a5d18270c13abd48927ddb", + "gitHead": "5bacc71441750bc6e79829abcfc21d4f2f0c4396", "homepage": "https://github.com/mafintosh/is-my-json-valid", "keywords": [ "json", - "schema", + "jsonschema", "orderly", - "jsonschema" + "schema" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "freeall@gmail.com", - "name": "freeall" + "name": "freeall", + "email": "freeall@gmail.com" }, { - "email": "mathiasbuus@gmail.com", - "name": "mafintosh" + "name": "mafintosh", + "email": "mathiasbuus@gmail.com" }, { - "email": "w@tson.dk", - "name": "watson" + "name": "watson", + "email": "w@tson.dk" }, { - "email": "i@yoshuawuyts.com", - "name": "yoshuawuyts" + "name": "yoshuawuyts", + "email": "i@yoshuawuyts.com" } ], "name": "is-my-json-valid", @@ -92,5 +96,5 @@ "scripts": { "test": "tape test/*.js" }, - "version": "2.12.4" + "version": "2.13.1" } diff --git a/tools/eslint/node_modules/is-my-json-valid/test/fixtures/cosmic.js b/tools/eslint/node_modules/is-my-json-valid/test/fixtures/cosmic.js deleted file mode 100644 index 4e0a34b210c52b..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/fixtures/cosmic.js +++ /dev/null @@ -1,84 +0,0 @@ -exports.valid = { - fullName : "John Doe", - age : 47, - state : "Massachusetts", - city : "Boston", - zip : 16417, - married : false, - dozen : 12, - dozenOrBakersDozen : 13, - favoriteEvenNumber : 14, - topThreeFavoriteColors : [ "red", "blue", "green" ], - favoriteSingleDigitWholeNumbers : [ 7 ], - favoriteFiveLetterWord : "coder", - emailAddresses : - [ - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@letters-in-local.org", - "01234567890@numbers-in-local.net", - "&'*+-./=?^_{}~@other-valid-characters-in-local.net", - "mixed-1234-in-{+^}-local@sld.net", - "a@single-character-in-local.org", - "\"quoted\"@sld.com", - "\"\\e\\s\\c\\a\\p\\e\\d\"@sld.com", - "\"quoted-at-sign@sld.org\"@sld.com", - "\"escaped\\\"quote\"@sld.com", - "\"back\\slash\"@sld.com", - "one-character-third-level@a.example.com", - "single-character-in-sld@x.org", - "local@dash-in-sld.com", - "letters-in-sld@123.com", - "one-letter-sld@x.org", - "uncommon-tld@sld.museum", - "uncommon-tld@sld.travel", - "uncommon-tld@sld.mobi", - "country-code-tld@sld.uk", - "country-code-tld@sld.rw", - "local@sld.newTLD", - "the-total-length@of-an-entire-address.cannot-be-longer-than-two-hundred-and-fifty-four-characters.and-this-address-is-254-characters-exactly.so-it-should-be-valid.and-im-going-to-add-some-more-words-here.to-increase-the-lenght-blah-blah-blah-blah-bla.org", - "the-character-limit@for-each-part.of-the-domain.is-sixty-three-characters.this-is-exactly-sixty-three-characters-so-it-is-valid-blah-blah.com", - "local@sub.domains.com" - ], - ipAddresses : [ "127.0.0.1", "24.48.64.2", "192.168.1.1", "209.68.44.3", "2.2.2.2" ] -} - -exports.invalid = { - fullName : null, - age : -1, - state : 47, - city : false, - zip : [null], - married : "yes", - dozen : 50, - dozenOrBakersDozen : "over 9000", - favoriteEvenNumber : 15, - topThreeFavoriteColors : [ "red", 5 ], - favoriteSingleDigitWholeNumbers : [ 78, 2, 999 ], - favoriteFiveLetterWord : "codernaut", - emailAddresses : [], - ipAddresses : [ "999.0.099.1", "294.48.64.2346", false, "2221409.64214128.42414.235233", "124124.12412412" ] -} - -exports.schema = { // from cosmic thingy - name : "test", - type : "object", - additionalProperties : false, - required : ["fullName", "age", "zip", "married", "dozen", "dozenOrBakersDozen", "favoriteEvenNumber", "topThreeFavoriteColors", "favoriteSingleDigitWholeNumbers", "favoriteFiveLetterWord", "emailAddresses", "ipAddresses"], - properties : - { - fullName : { type : "string" }, - age : { type : "integer", minimum : 0 }, - optionalItem : { type : "string" }, - state : { type : "string" }, - city : { type : "string" }, - zip : { type : "integer", minimum : 0, maximum : 99999 }, - married : { type : "boolean" }, - dozen : { type : "integer", minimum : 12, maximum : 12 }, - dozenOrBakersDozen : { type : "integer", minimum : 12, maximum : 13 }, - favoriteEvenNumber : { type : "integer", multipleOf : 2 }, - topThreeFavoriteColors : { type : "array", minItems : 3, maxItems : 3, uniqueItems : true, items : { type : "string" }}, - favoriteSingleDigitWholeNumbers : { type : "array", minItems : 1, maxItems : 10, uniqueItems : true, items : { type : "integer", minimum : 0, maximum : 9 }}, - favoriteFiveLetterWord : { type : "string", minLength : 5, maxLength : 5 }, - emailAddresses : { type : "array", minItems : 1, uniqueItems : true, items : { type : "string", format : "email" }}, - ipAddresses : { type : "array", uniqueItems : true, items : { type : "string", format : "ipv4" }}, - } - } \ No newline at end of file diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/additionalItems.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/additionalItems.json deleted file mode 100644 index 521745c8d6ed50..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/additionalItems.json +++ /dev/null @@ -1,82 +0,0 @@ -[ - { - "description": "additionalItems as schema", - "schema": { - "items": [{}], - "additionalItems": {"type": "integer"} - }, - "tests": [ - { - "description": "additional items match schema", - "data": [ null, 2, 3, 4 ], - "valid": true - }, - { - "description": "additional items do not match schema", - "data": [ null, 2, 3, "foo" ], - "valid": false - } - ] - }, - { - "description": "items is schema, no additionalItems", - "schema": { - "items": {}, - "additionalItems": false - }, - "tests": [ - { - "description": "all items match schema", - "data": [ 1, 2, 3, 4, 5 ], - "valid": true - } - ] - }, - { - "description": "array of items with no additionalItems", - "schema": { - "items": [{}, {}, {}], - "additionalItems": false - }, - "tests": [ - { - "description": "no additional items present", - "data": [ 1, 2, 3 ], - "valid": true - }, - { - "description": "additional items are not permitted", - "data": [ 1, 2, 3, 4 ], - "valid": false - } - ] - }, - { - "description": "additionalItems as false without items", - "schema": {"additionalItems": false}, - "tests": [ - { - "description": - "items defaults to empty schema so everything is valid", - "data": [ 1, 2, 3, 4, 5 ], - "valid": true - }, - { - "description": "ignores non-arrays", - "data": {"foo" : "bar"}, - "valid": true - } - ] - }, - { - "description": "additionalItems are allowed by default", - "schema": {"items": [{"type": "integer"}]}, - "tests": [ - { - "description": "only the first item is validated", - "data": [1, "foo", false], - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/additionalProperties.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/additionalProperties.json deleted file mode 100644 index 40831f9e9aa135..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/additionalProperties.json +++ /dev/null @@ -1,88 +0,0 @@ -[ - { - "description": - "additionalProperties being false does not allow other properties", - "schema": { - "properties": {"foo": {}, "bar": {}}, - "patternProperties": { "^v": {} }, - "additionalProperties": false - }, - "tests": [ - { - "description": "no additional properties is valid", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "an additional property is invalid", - "data": {"foo" : 1, "bar" : 2, "quux" : "boom"}, - "valid": false - }, - { - "description": "ignores non-objects", - "data": [1, 2, 3], - "valid": true - }, - { - "description": "patternProperties are not additional properties", - "data": {"foo":1, "vroom": 2}, - "valid": true - } - ] - }, - { - "description": - "additionalProperties allows a schema which should validate", - "schema": { - "properties": {"foo": {}, "bar": {}}, - "additionalProperties": {"type": "boolean"} - }, - "tests": [ - { - "description": "no additional properties is valid", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "an additional valid property is valid", - "data": {"foo" : 1, "bar" : 2, "quux" : true}, - "valid": true - }, - { - "description": "an additional invalid property is invalid", - "data": {"foo" : 1, "bar" : 2, "quux" : 12}, - "valid": false - } - ] - }, - { - "description": - "additionalProperties can exist by itself", - "schema": { - "additionalProperties": {"type": "boolean"} - }, - "tests": [ - { - "description": "an additional valid property is valid", - "data": {"foo" : true}, - "valid": true - }, - { - "description": "an additional invalid property is invalid", - "data": {"foo" : 1}, - "valid": false - } - ] - }, - { - "description": "additionalProperties are allowed by default", - "schema": {"properties": {"foo": {}, "bar": {}}}, - "tests": [ - { - "description": "additional properties are allowed", - "data": {"foo": 1, "bar": 2, "quux": true}, - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/allOf.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/allOf.json deleted file mode 100644 index bbb5f89e4bc5e1..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/allOf.json +++ /dev/null @@ -1,112 +0,0 @@ -[ - { - "description": "allOf", - "schema": { - "allOf": [ - { - "properties": { - "bar": {"type": "integer"} - }, - "required": ["bar"] - }, - { - "properties": { - "foo": {"type": "string"} - }, - "required": ["foo"] - } - ] - }, - "tests": [ - { - "description": "allOf", - "data": {"foo": "baz", "bar": 2}, - "valid": true - }, - { - "description": "mismatch second", - "data": {"foo": "baz"}, - "valid": false - }, - { - "description": "mismatch first", - "data": {"bar": 2}, - "valid": false - }, - { - "description": "wrong type", - "data": {"foo": "baz", "bar": "quux"}, - "valid": false - } - ] - }, - { - "description": "allOf with base schema", - "schema": { - "properties": {"bar": {"type": "integer"}}, - "required": ["bar"], - "allOf" : [ - { - "properties": { - "foo": {"type": "string"} - }, - "required": ["foo"] - }, - { - "properties": { - "baz": {"type": "null"} - }, - "required": ["baz"] - } - ] - }, - "tests": [ - { - "description": "valid", - "data": {"foo": "quux", "bar": 2, "baz": null}, - "valid": true - }, - { - "description": "mismatch base schema", - "data": {"foo": "quux", "baz": null}, - "valid": false - }, - { - "description": "mismatch first allOf", - "data": {"bar": 2, "baz": null}, - "valid": false - }, - { - "description": "mismatch second allOf", - "data": {"foo": "quux", "bar": 2}, - "valid": false - }, - { - "description": "mismatch both", - "data": {"bar": 2}, - "valid": false - } - ] - }, - { - "description": "allOf simple types", - "schema": { - "allOf": [ - {"maximum": 30}, - {"minimum": 20} - ] - }, - "tests": [ - { - "description": "valid", - "data": 25, - "valid": true - }, - { - "description": "mismatch one", - "data": 35, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/anyOf.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/anyOf.json deleted file mode 100644 index a58714afd89277..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/anyOf.json +++ /dev/null @@ -1,68 +0,0 @@ -[ - { - "description": "anyOf", - "schema": { - "anyOf": [ - { - "type": "integer" - }, - { - "minimum": 2 - } - ] - }, - "tests": [ - { - "description": "first anyOf valid", - "data": 1, - "valid": true - }, - { - "description": "second anyOf valid", - "data": 2.5, - "valid": true - }, - { - "description": "both anyOf valid", - "data": 3, - "valid": true - }, - { - "description": "neither anyOf valid", - "data": 1.5, - "valid": false - } - ] - }, - { - "description": "anyOf with base schema", - "schema": { - "type": "string", - "anyOf" : [ - { - "maxLength": 2 - }, - { - "minLength": 4 - } - ] - }, - "tests": [ - { - "description": "mismatch base schema", - "data": 3, - "valid": false - }, - { - "description": "one anyOf valid", - "data": "foobar", - "valid": true - }, - { - "description": "both anyOf invalid", - "data": "foo", - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/bignum.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/bignum.json deleted file mode 100644 index ccc7c17fe8d504..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/bignum.json +++ /dev/null @@ -1,107 +0,0 @@ -[ - { - "description": "integer", - "schema": {"type": "integer"}, - "tests": [ - { - "description": "a bignum is an integer", - "data": 12345678910111213141516171819202122232425262728293031, - "valid": true - } - ] - }, - { - "description": "number", - "schema": {"type": "number"}, - "tests": [ - { - "description": "a bignum is a number", - "data": 98249283749234923498293171823948729348710298301928331, - "valid": true - } - ] - }, - { - "description": "integer", - "schema": {"type": "integer"}, - "tests": [ - { - "description": "a negative bignum is an integer", - "data": -12345678910111213141516171819202122232425262728293031, - "valid": true - } - ] - }, - { - "description": "number", - "schema": {"type": "number"}, - "tests": [ - { - "description": "a negative bignum is a number", - "data": -98249283749234923498293171823948729348710298301928331, - "valid": true - } - ] - }, - { - "description": "string", - "schema": {"type": "string"}, - "tests": [ - { - "description": "a bignum is not a string", - "data": 98249283749234923498293171823948729348710298301928331, - "valid": false - } - ] - }, - { - "description": "integer comparison", - "schema": {"maximum": 18446744073709551615}, - "tests": [ - { - "description": "comparison works for high numbers", - "data": 18446744073709551600, - "valid": true - } - ] - }, - { - "description": "float comparison with high precision", - "schema": { - "maximum": 972783798187987123879878123.18878137, - "exclusiveMaximum": true - }, - "tests": [ - { - "description": "comparison works for high numbers", - "data": 972783798187987123879878123.188781371, - "valid": false - } - ] - }, - { - "description": "integer comparison", - "schema": {"minimum": -18446744073709551615}, - "tests": [ - { - "description": "comparison works for very negative numbers", - "data": -18446744073709551600, - "valid": true - } - ] - }, - { - "description": "float comparison with high precision on negative numbers", - "schema": { - "minimum": -972783798187987123879878123.18878137, - "exclusiveMinimum": true - }, - "tests": [ - { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/default.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/default.json deleted file mode 100644 index 17629779fbeabe..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/default.json +++ /dev/null @@ -1,49 +0,0 @@ -[ - { - "description": "invalid type for default", - "schema": { - "properties": { - "foo": { - "type": "integer", - "default": [] - } - } - }, - "tests": [ - { - "description": "valid when property is specified", - "data": {"foo": 13}, - "valid": true - }, - { - "description": "still valid when the invalid default is used", - "data": {}, - "valid": true - } - ] - }, - { - "description": "invalid string value for default", - "schema": { - "properties": { - "bar": { - "type": "string", - "minLength": 4, - "default": "bad" - } - } - }, - "tests": [ - { - "description": "valid when property is specified", - "data": {"bar": "good"}, - "valid": true - }, - { - "description": "still valid when the invalid default is used", - "data": {}, - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/definitions.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/definitions.json deleted file mode 100644 index cf935a321532a6..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/definitions.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "description": "valid definition", - "schema": {"$ref": "http://json-schema.org/draft-04/schema#"}, - "tests": [ - { - "description": "valid definition schema", - "data": { - "definitions": { - "foo": {"type": "integer"} - } - }, - "valid": true - } - ] - }, - { - "description": "invalid definition", - "schema": {"$ref": "http://json-schema.org/draft-04/schema#"}, - "tests": [ - { - "description": "invalid definition schema", - "data": { - "definitions": { - "foo": {"type": 1} - } - }, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/dependencies.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/dependencies.json deleted file mode 100644 index 7b9b16a7e125ff..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/dependencies.json +++ /dev/null @@ -1,113 +0,0 @@ -[ - { - "description": "dependencies", - "schema": { - "dependencies": {"bar": ["foo"]} - }, - "tests": [ - { - "description": "neither", - "data": {}, - "valid": true - }, - { - "description": "nondependant", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "with dependency", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "missing dependency", - "data": {"bar": 2}, - "valid": false - }, - { - "description": "ignores non-objects", - "data": "foo", - "valid": true - } - ] - }, - { - "description": "multiple dependencies", - "schema": { - "dependencies": {"quux": ["foo", "bar"]} - }, - "tests": [ - { - "description": "neither", - "data": {}, - "valid": true - }, - { - "description": "nondependants", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "with dependencies", - "data": {"foo": 1, "bar": 2, "quux": 3}, - "valid": true - }, - { - "description": "missing dependency", - "data": {"foo": 1, "quux": 2}, - "valid": false - }, - { - "description": "missing other dependency", - "data": {"bar": 1, "quux": 2}, - "valid": false - }, - { - "description": "missing both dependencies", - "data": {"quux": 1}, - "valid": false - } - ] - }, - { - "description": "multiple dependencies subschema", - "schema": { - "dependencies": { - "bar": { - "properties": { - "foo": {"type": "integer"}, - "bar": {"type": "integer"} - } - } - } - }, - "tests": [ - { - "description": "valid", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "no dependency", - "data": {"foo": "quux"}, - "valid": true - }, - { - "description": "wrong type", - "data": {"foo": "quux", "bar": 2}, - "valid": false - }, - { - "description": "wrong type other", - "data": {"foo": 2, "bar": "quux"}, - "valid": false - }, - { - "description": "wrong type both", - "data": {"foo": "quux", "bar": "quux"}, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/enum.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/enum.json deleted file mode 100644 index f124436a7d9040..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/enum.json +++ /dev/null @@ -1,72 +0,0 @@ -[ - { - "description": "simple enum validation", - "schema": {"enum": [1, 2, 3]}, - "tests": [ - { - "description": "one of the enum is valid", - "data": 1, - "valid": true - }, - { - "description": "something else is invalid", - "data": 4, - "valid": false - } - ] - }, - { - "description": "heterogeneous enum validation", - "schema": {"enum": [6, "foo", [], true, {"foo": 12}]}, - "tests": [ - { - "description": "one of the enum is valid", - "data": [], - "valid": true - }, - { - "description": "something else is invalid", - "data": null, - "valid": false - }, - { - "description": "objects are deep compared", - "data": {"foo": false}, - "valid": false - } - ] - }, - { - "description": "enums in properties", - "schema": { - "type":"object", - "properties": { - "foo": {"enum":["foo"]}, - "bar": {"enum":["bar"]} - }, - "required": ["bar"] - }, - "tests": [ - { - "description": "both properties are valid", - "data": {"foo":"foo", "bar":"bar"}, - "valid": true - }, - { - "description": "missing optional property is valid", - "data": {"bar":"bar"}, - "valid": true - }, - { - "description": "missing required property is invalid", - "data": {"foo":"foo"}, - "valid": false - }, - { - "description": "missing all properties is invalid", - "data": {}, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/format.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/format.json deleted file mode 100644 index 53c5d2519056c6..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/format.json +++ /dev/null @@ -1,143 +0,0 @@ -[ - { - "description": "validation of date-time strings", - "schema": {"format": "date-time"}, - "tests": [ - { - "description": "a valid date-time string", - "data": "1963-06-19T08:30:06.283185Z", - "valid": true - }, - { - "description": "an invalid date-time string", - "data": "06/19/1963 08:30:06 PST", - "valid": false - }, - { - "description": "only RFC3339 not all of ISO 8601 are valid", - "data": "2013-350T01:01:01", - "valid": false - } - ] - }, - { - "description": "validation of URIs", - "schema": {"format": "uri"}, - "tests": [ - { - "description": "a valid URI", - "data": "http://foo.bar/?baz=qux#quux", - "valid": true - }, - { - "description": "an invalid URI", - "data": "\\\\WINDOWS\\fileshare", - "valid": false - }, - { - "description": "an invalid URI though valid URI reference", - "data": "abc", - "valid": false - } - ] - }, - { - "description": "validation of e-mail addresses", - "schema": {"format": "email"}, - "tests": [ - { - "description": "a valid e-mail address", - "data": "joe.bloggs@example.com", - "valid": true - }, - { - "description": "an invalid e-mail address", - "data": "2962", - "valid": false - } - ] - }, - { - "description": "validation of IP addresses", - "schema": {"format": "ipv4"}, - "tests": [ - { - "description": "a valid IP address", - "data": "192.168.0.1", - "valid": true - }, - { - "description": "an IP address with too many components", - "data": "127.0.0.0.1", - "valid": false - }, - { - "description": "an IP address with out-of-range values", - "data": "256.256.256.256", - "valid": false - }, - { - "description": "an IP address without 4 components", - "data": "127.0", - "valid": false - }, - { - "description": "an IP address as an integer", - "data": "0x7f000001", - "valid": false - } - ] - }, - { - "description": "validation of IPv6 addresses", - "schema": {"format": "ipv6"}, - "tests": [ - { - "description": "a valid IPv6 address", - "data": "::1", - "valid": true - }, - { - "description": "an IPv6 address with out-of-range values", - "data": "12345::", - "valid": false - }, - { - "description": "an IPv6 address with too many components", - "data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1", - "valid": false - }, - { - "description": "an IPv6 address containing illegal characters", - "data": "::laptop", - "valid": false - } - ] - }, - { - "description": "validation of host names", - "schema": {"format": "hostname"}, - "tests": [ - { - "description": "a valid host name", - "data": "www.example.com", - "valid": true - }, - { - "description": "a host name starting with an illegal character", - "data": "-a-host-name-that-starts-with--", - "valid": false - }, - { - "description": "a host name containing illegal characters", - "data": "not_a_valid_host_name", - "valid": false - }, - { - "description": "a host name with a component too long", - "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component", - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/items.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/items.json deleted file mode 100644 index f5e18a13848f71..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/items.json +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "description": "a schema given for items", - "schema": { - "items": {"type": "integer"} - }, - "tests": [ - { - "description": "valid items", - "data": [ 1, 2, 3 ], - "valid": true - }, - { - "description": "wrong type of items", - "data": [1, "x"], - "valid": false - }, - { - "description": "ignores non-arrays", - "data": {"foo" : "bar"}, - "valid": true - } - ] - }, - { - "description": "an array of schemas for items", - "schema": { - "items": [ - {"type": "integer"}, - {"type": "string"} - ] - }, - "tests": [ - { - "description": "correct types", - "data": [ 1, "foo" ], - "valid": true - }, - { - "description": "wrong types", - "data": [ "foo", 1 ], - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxItems.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxItems.json deleted file mode 100644 index 3b53a6b371a7b6..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxItems.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "description": "maxItems validation", - "schema": {"maxItems": 2}, - "tests": [ - { - "description": "shorter is valid", - "data": [1], - "valid": true - }, - { - "description": "exact length is valid", - "data": [1, 2], - "valid": true - }, - { - "description": "too long is invalid", - "data": [1, 2, 3], - "valid": false - }, - { - "description": "ignores non-arrays", - "data": "foobar", - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxLength.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxLength.json deleted file mode 100644 index 48eb1296d2e420..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxLength.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "description": "maxLength validation", - "schema": {"maxLength": 2}, - "tests": [ - { - "description": "shorter is valid", - "data": "f", - "valid": true - }, - { - "description": "exact length is valid", - "data": "fo", - "valid": true - }, - { - "description": "too long is invalid", - "data": "foo", - "valid": false - }, - { - "description": "ignores non-strings", - "data": 100, - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxProperties.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxProperties.json deleted file mode 100644 index d282446ad6978d..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maxProperties.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "description": "maxProperties validation", - "schema": {"maxProperties": 2}, - "tests": [ - { - "description": "shorter is valid", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "exact length is valid", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "too long is invalid", - "data": {"foo": 1, "bar": 2, "baz": 3}, - "valid": false - }, - { - "description": "ignores non-objects", - "data": "foobar", - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maximum.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maximum.json deleted file mode 100644 index 86c7b89c9a9047..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/maximum.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "description": "maximum validation", - "schema": {"maximum": 3.0}, - "tests": [ - { - "description": "below the maximum is valid", - "data": 2.6, - "valid": true - }, - { - "description": "above the maximum is invalid", - "data": 3.5, - "valid": false - }, - { - "description": "ignores non-numbers", - "data": "x", - "valid": true - } - ] - }, - { - "description": "exclusiveMaximum validation", - "schema": { - "maximum": 3.0, - "exclusiveMaximum": true - }, - "tests": [ - { - "description": "below the maximum is still valid", - "data": 2.2, - "valid": true - }, - { - "description": "boundary point is invalid", - "data": 3.0, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minItems.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minItems.json deleted file mode 100644 index ed5118815ee933..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minItems.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "description": "minItems validation", - "schema": {"minItems": 1}, - "tests": [ - { - "description": "longer is valid", - "data": [1, 2], - "valid": true - }, - { - "description": "exact length is valid", - "data": [1], - "valid": true - }, - { - "description": "too short is invalid", - "data": [], - "valid": false - }, - { - "description": "ignores non-arrays", - "data": "", - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minLength.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minLength.json deleted file mode 100644 index e9c14b1723efd9..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minLength.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "description": "minLength validation", - "schema": {"minLength": 2}, - "tests": [ - { - "description": "longer is valid", - "data": "foo", - "valid": true - }, - { - "description": "exact length is valid", - "data": "fo", - "valid": true - }, - { - "description": "too short is invalid", - "data": "f", - "valid": false - }, - { - "description": "ignores non-strings", - "data": 1, - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minProperties.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minProperties.json deleted file mode 100644 index a72c7d293e6c3e..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minProperties.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "description": "minProperties validation", - "schema": {"minProperties": 1}, - "tests": [ - { - "description": "longer is valid", - "data": {"foo": 1, "bar": 2}, - "valid": true - }, - { - "description": "exact length is valid", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "too short is invalid", - "data": {}, - "valid": false - }, - { - "description": "ignores non-objects", - "data": "", - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minimum.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minimum.json deleted file mode 100644 index d5bf000bcc66f8..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/minimum.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "description": "minimum validation", - "schema": {"minimum": 1.1}, - "tests": [ - { - "description": "above the minimum is valid", - "data": 2.6, - "valid": true - }, - { - "description": "below the minimum is invalid", - "data": 0.6, - "valid": false - }, - { - "description": "ignores non-numbers", - "data": "x", - "valid": true - } - ] - }, - { - "description": "exclusiveMinimum validation", - "schema": { - "minimum": 1.1, - "exclusiveMinimum": true - }, - "tests": [ - { - "description": "above the minimum is still valid", - "data": 1.2, - "valid": true - }, - { - "description": "boundary point is invalid", - "data": 1.1, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/multipleOf.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/multipleOf.json deleted file mode 100644 index ca3b7618053f49..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/multipleOf.json +++ /dev/null @@ -1,60 +0,0 @@ -[ - { - "description": "by int", - "schema": {"multipleOf": 2}, - "tests": [ - { - "description": "int by int", - "data": 10, - "valid": true - }, - { - "description": "int by int fail", - "data": 7, - "valid": false - }, - { - "description": "ignores non-numbers", - "data": "foo", - "valid": true - } - ] - }, - { - "description": "by number", - "schema": {"multipleOf": 1.5}, - "tests": [ - { - "description": "zero is multiple of anything", - "data": 0, - "valid": true - }, - { - "description": "4.5 is multiple of 1.5", - "data": 4.5, - "valid": true - }, - { - "description": "35 is not multiple of 1.5", - "data": 35, - "valid": false - } - ] - }, - { - "description": "by small number", - "schema": {"multipleOf": 0.0001}, - "tests": [ - { - "description": "0.0075 is multiple of 0.0001", - "data": 0.0075, - "valid": true - }, - { - "description": "0.00751 is not multiple of 0.0001", - "data": 0.00751, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/not.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/not.json deleted file mode 100644 index f66690fe1bbff5..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/not.json +++ /dev/null @@ -1,96 +0,0 @@ -[ - { - "description": "not", - "schema": { - "not": {"type": "integer"} - }, - "tests": [ - { - "description": "allowed", - "data": "foo", - "valid": true - }, - { - "description": "disallowed", - "data": 1, - "valid": false - } - ] - }, - { - "description": "not multiple types", - "schema": { - "not": {"type": ["integer", "boolean"]} - }, - "tests": [ - { - "description": "valid", - "data": "foo", - "valid": true - }, - { - "description": "mismatch", - "data": 1, - "valid": false - }, - { - "description": "other mismatch", - "data": true, - "valid": false - } - ] - }, - { - "description": "not more complex schema", - "schema": { - "not": { - "type": "object", - "properties": { - "foo": { - "type": "string" - } - } - } - }, - "tests": [ - { - "description": "match", - "data": 1, - "valid": true - }, - { - "description": "other match", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "mismatch", - "data": {"foo": "bar"}, - "valid": false - } - ] - }, - { - "description": "forbidden property", - "schema": { - "properties": { - "foo": { - "not": {} - } - } - }, - "tests": [ - { - "description": "property present", - "data": {"foo": 1, "bar": 2}, - "valid": false - }, - { - "description": "property absent", - "data": {"bar": 1, "baz": 2}, - "valid": true - } - ] - } - -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndFormat.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndFormat.json deleted file mode 100644 index d7fce9f50907a0..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndFormat.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "description": "validation of null and format", - "schema": {"type": ["null", "string"], "format": "date-time"}, - "tests": [ - { - "description": "a valid date-time string", - "data": "1963-06-19T08:30:06.283185Z", - "valid": true - }, - { - "description": "allow null", - "data": null, - "valid": true - } - ] - } -] \ No newline at end of file diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndObject.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndObject.json deleted file mode 100644 index c65c02c36f9706..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndObject.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "description": "multiple types of null and object containing properties", - "schema": { - "type": ["null", "object"], - "properties": { - "foo": {} - } - }, - "tests": [ - { - "description": "null is valid", - "data": null, - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/oneOf.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/oneOf.json deleted file mode 100644 index 1eaa4e47949dc3..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/oneOf.json +++ /dev/null @@ -1,68 +0,0 @@ -[ - { - "description": "oneOf", - "schema": { - "oneOf": [ - { - "type": "integer" - }, - { - "minimum": 2 - } - ] - }, - "tests": [ - { - "description": "first oneOf valid", - "data": 1, - "valid": true - }, - { - "description": "second oneOf valid", - "data": 2.5, - "valid": true - }, - { - "description": "both oneOf valid", - "data": 3, - "valid": false - }, - { - "description": "neither oneOf valid", - "data": 1.5, - "valid": false - } - ] - }, - { - "description": "oneOf with base schema", - "schema": { - "type": "string", - "oneOf" : [ - { - "minLength": 2 - }, - { - "maxLength": 4 - } - ] - }, - "tests": [ - { - "description": "mismatch base schema", - "data": 3, - "valid": false - }, - { - "description": "one oneOf valid", - "data": "foobar", - "valid": true - }, - { - "description": "both oneOf valid", - "data": "foo", - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/pattern.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/pattern.json deleted file mode 100644 index befc4b560f7c33..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/pattern.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "description": "pattern validation", - "schema": {"pattern": "^a*$"}, - "tests": [ - { - "description": "a matching pattern is valid", - "data": "aaa", - "valid": true - }, - { - "description": "a non-matching pattern is invalid", - "data": "abc", - "valid": false - }, - { - "description": "ignores non-strings", - "data": true, - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/patternProperties.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/patternProperties.json deleted file mode 100644 index 18586e5daba602..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/patternProperties.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "description": - "patternProperties validates properties matching a regex", - "schema": { - "patternProperties": { - "f.*o": {"type": "integer"} - } - }, - "tests": [ - { - "description": "a single valid match is valid", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "multiple valid matches is valid", - "data": {"foo": 1, "foooooo" : 2}, - "valid": true - }, - { - "description": "a single invalid match is invalid", - "data": {"foo": "bar", "fooooo": 2}, - "valid": false - }, - { - "description": "multiple invalid matches is invalid", - "data": {"foo": "bar", "foooooo" : "baz"}, - "valid": false - }, - { - "description": "ignores non-objects", - "data": 12, - "valid": true - } - ] - }, - { - "description": "multiple simultaneous patternProperties are validated", - "schema": { - "patternProperties": { - "a*": {"type": "integer"}, - "aaa*": {"maximum": 20} - } - }, - "tests": [ - { - "description": "a single valid match is valid", - "data": {"a": 21}, - "valid": true - }, - { - "description": "a simultaneous match is valid", - "data": {"aaaa": 18}, - "valid": true - }, - { - "description": "multiple matches is valid", - "data": {"a": 21, "aaaa": 18}, - "valid": true - }, - { - "description": "an invalid due to one is invalid", - "data": {"a": "bar"}, - "valid": false - }, - { - "description": "an invalid due to the other is invalid", - "data": {"aaaa": 31}, - "valid": false - }, - { - "description": "an invalid due to both is invalid", - "data": {"aaa": "foo", "aaaa": 31}, - "valid": false - } - ] - }, - { - "description": "regexes are not anchored by default and are case sensitive", - "schema": { - "patternProperties": { - "[0-9]{2,}": { "type": "boolean" }, - "X_": { "type": "string" } - } - }, - "tests": [ - { - "description": "non recognized members are ignored", - "data": { "answer 1": "42" }, - "valid": true - }, - { - "description": "recognized members are accounted for", - "data": { "a31b": null }, - "valid": false - }, - { - "description": "regexes are case sensitive", - "data": { "a_x_3": 3 }, - "valid": true - }, - { - "description": "regexes are case sensitive, 2", - "data": { "a_X_3": 3 }, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/properties.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/properties.json deleted file mode 100644 index cd1644dcd91fe0..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/properties.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "description": "object properties validation", - "schema": { - "properties": { - "foo": {"type": "integer"}, - "bar": {"type": "string"} - } - }, - "tests": [ - { - "description": "both properties present and valid is valid", - "data": {"foo": 1, "bar": "baz"}, - "valid": true - }, - { - "description": "one property invalid is invalid", - "data": {"foo": 1, "bar": {}}, - "valid": false - }, - { - "description": "both properties invalid is invalid", - "data": {"foo": [], "bar": {}}, - "valid": false - }, - { - "description": "doesn't invalidate other properties", - "data": {"quux": []}, - "valid": true - }, - { - "description": "ignores non-objects", - "data": [], - "valid": true - } - ] - }, - { - "description": - "properties, patternProperties, additionalProperties interaction", - "schema": { - "properties": { - "foo": {"type": "array", "maxItems": 3}, - "bar": {"type": "array"} - }, - "patternProperties": {"f.o": {"minItems": 2}}, - "additionalProperties": {"type": "integer"} - }, - "tests": [ - { - "description": "property validates property", - "data": {"foo": [1, 2]}, - "valid": true - }, - { - "description": "property invalidates property", - "data": {"foo": [1, 2, 3, 4]}, - "valid": false - }, - { - "description": "patternProperty invalidates property", - "data": {"foo": []}, - "valid": false - }, - { - "description": "patternProperty validates nonproperty", - "data": {"fxo": [1, 2]}, - "valid": true - }, - { - "description": "patternProperty invalidates nonproperty", - "data": {"fxo": []}, - "valid": false - }, - { - "description": "additionalProperty ignores property", - "data": {"bar": []}, - "valid": true - }, - { - "description": "additionalProperty validates others", - "data": {"quux": 3}, - "valid": true - }, - { - "description": "additionalProperty invalidates others", - "data": {"quux": "foo"}, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/ref.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/ref.json deleted file mode 100644 index d8214bc2b30c1f..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/ref.json +++ /dev/null @@ -1,128 +0,0 @@ -[ - { - "description": "root pointer ref", - "schema": { - "properties": { - "foo": {"$ref": "#"} - }, - "additionalProperties": false - }, - "tests": [ - { - "description": "match", - "data": {"foo": false}, - "valid": true - }, - { - "description": "recursive match", - "data": {"foo": {"foo": false}}, - "valid": true - }, - { - "description": "mismatch", - "data": {"bar": false}, - "valid": false - }, - { - "description": "recursive mismatch", - "data": {"foo": {"bar": false}}, - "valid": false - } - ] - }, - { - "description": "relative pointer ref to object", - "schema": { - "properties": { - "foo": {"type": "integer"}, - "bar": {"$ref": "#/properties/foo"} - } - }, - "tests": [ - { - "description": "match", - "data": {"bar": 3}, - "valid": true - }, - { - "description": "mismatch", - "data": {"bar": true}, - "valid": false - } - ] - }, - { - "description": "relative pointer ref to array", - "schema": { - "items": [ - {"type": "integer"}, - {"$ref": "#/items/0"} - ] - }, - "tests": [ - { - "description": "match array", - "data": [1, 2], - "valid": true - }, - { - "description": "mismatch array", - "data": [1, "foo"], - "valid": false - } - ] - }, - { - "description": "escaped pointer ref", - "schema": { - "tilda~field": {"type": "integer"}, - "slash/field": {"type": "integer"}, - "percent%field": {"type": "integer"}, - "properties": { - "tilda": {"$ref": "#/tilda~0field"}, - "slash": {"$ref": "#/slash~1field"}, - "percent": {"$ref": "#/percent%25field"} - } - }, - "tests": [ - { - "description": "slash", - "data": {"slash": "aoeu"}, - "valid": false - }, - { - "description": "tilda", - "data": {"tilda": "aoeu"}, - "valid": false - }, - { - "description": "percent", - "data": {"percent": "aoeu"}, - "valid": false - } - ] - }, - { - "description": "nested refs", - "schema": { - "definitions": { - "a": {"type": "integer"}, - "b": {"$ref": "#/definitions/a"}, - "c": {"$ref": "#/definitions/b"} - }, - "$ref": "#/definitions/c" - }, - "tests": [ - { - "description": "nested ref valid", - "data": 5, - "valid": true - }, - { - "description": "nested ref invalid", - "data": "a", - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/refRemote.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/refRemote.json deleted file mode 100644 index 4ca804732c9754..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/refRemote.json +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "description": "remote ref", - "schema": {"$ref": "http://localhost:1234/integer.json"}, - "tests": [ - { - "description": "remote ref valid", - "data": 1, - "valid": true - }, - { - "description": "remote ref invalid", - "data": "a", - "valid": false - } - ] - }, - { - "description": "fragment within remote ref", - "schema": {"$ref": "http://localhost:1234/subSchemas.json#/integer"}, - "tests": [ - { - "description": "remote fragment valid", - "data": 1, - "valid": true - }, - { - "description": "remote fragment invalid", - "data": "a", - "valid": false - } - ] - }, - { - "description": "ref within remote ref", - "schema": { - "$ref": "http://localhost:1234/subSchemas.json#/refToInteger" - }, - "tests": [ - { - "description": "ref within ref valid", - "data": 1, - "valid": true - }, - { - "description": "ref within ref invalid", - "data": "a", - "valid": false - } - ] - }, - { - "description": "change resolution scope", - "schema": { - "id": "http://localhost:1234/", - "items": { - "id": "folder/", - "items": {"$ref": "folderInteger.json"} - } - }, - "tests": [ - { - "description": "changed scope ref valid", - "data": [[1]], - "valid": true - }, - { - "description": "changed scope ref invalid", - "data": [["a"]], - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/required.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/required.json deleted file mode 100644 index 612f73f3472bc0..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/required.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "description": "required validation", - "schema": { - "properties": { - "foo": {}, - "bar": {} - }, - "required": ["foo"] - }, - "tests": [ - { - "description": "present required property is valid", - "data": {"foo": 1}, - "valid": true - }, - { - "description": "non-present required property is invalid", - "data": {"bar": 1}, - "valid": false - } - ] - }, - { - "description": "required default validation", - "schema": { - "properties": { - "foo": {} - } - }, - "tests": [ - { - "description": "not required by default", - "data": {}, - "valid": true - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/type.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/type.json deleted file mode 100644 index 257f05129279fa..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/type.json +++ /dev/null @@ -1,330 +0,0 @@ -[ - { - "description": "integer type matches integers", - "schema": {"type": "integer"}, - "tests": [ - { - "description": "an integer is an integer", - "data": 1, - "valid": true - }, - { - "description": "a float is not an integer", - "data": 1.1, - "valid": false - }, - { - "description": "a string is not an integer", - "data": "foo", - "valid": false - }, - { - "description": "an object is not an integer", - "data": {}, - "valid": false - }, - { - "description": "an array is not an integer", - "data": [], - "valid": false - }, - { - "description": "a boolean is not an integer", - "data": true, - "valid": false - }, - { - "description": "null is not an integer", - "data": null, - "valid": false - } - ] - }, - { - "description": "number type matches numbers", - "schema": {"type": "number"}, - "tests": [ - { - "description": "an integer is a number", - "data": 1, - "valid": true - }, - { - "description": "a float is a number", - "data": 1.1, - "valid": true - }, - { - "description": "a string is not a number", - "data": "foo", - "valid": false - }, - { - "description": "an object is not a number", - "data": {}, - "valid": false - }, - { - "description": "an array is not a number", - "data": [], - "valid": false - }, - { - "description": "a boolean is not a number", - "data": true, - "valid": false - }, - { - "description": "null is not a number", - "data": null, - "valid": false - } - ] - }, - { - "description": "string type matches strings", - "schema": {"type": "string"}, - "tests": [ - { - "description": "1 is not a string", - "data": 1, - "valid": false - }, - { - "description": "a float is not a string", - "data": 1.1, - "valid": false - }, - { - "description": "a string is a string", - "data": "foo", - "valid": true - }, - { - "description": "an object is not a string", - "data": {}, - "valid": false - }, - { - "description": "an array is not a string", - "data": [], - "valid": false - }, - { - "description": "a boolean is not a string", - "data": true, - "valid": false - }, - { - "description": "null is not a string", - "data": null, - "valid": false - } - ] - }, - { - "description": "object type matches objects", - "schema": {"type": "object"}, - "tests": [ - { - "description": "an integer is not an object", - "data": 1, - "valid": false - }, - { - "description": "a float is not an object", - "data": 1.1, - "valid": false - }, - { - "description": "a string is not an object", - "data": "foo", - "valid": false - }, - { - "description": "an object is an object", - "data": {}, - "valid": true - }, - { - "description": "an array is not an object", - "data": [], - "valid": false - }, - { - "description": "a boolean is not an object", - "data": true, - "valid": false - }, - { - "description": "null is not an object", - "data": null, - "valid": false - } - ] - }, - { - "description": "array type matches arrays", - "schema": {"type": "array"}, - "tests": [ - { - "description": "an integer is not an array", - "data": 1, - "valid": false - }, - { - "description": "a float is not an array", - "data": 1.1, - "valid": false - }, - { - "description": "a string is not an array", - "data": "foo", - "valid": false - }, - { - "description": "an object is not an array", - "data": {}, - "valid": false - }, - { - "description": "an array is not an array", - "data": [], - "valid": true - }, - { - "description": "a boolean is not an array", - "data": true, - "valid": false - }, - { - "description": "null is not an array", - "data": null, - "valid": false - } - ] - }, - { - "description": "boolean type matches booleans", - "schema": {"type": "boolean"}, - "tests": [ - { - "description": "an integer is not a boolean", - "data": 1, - "valid": false - }, - { - "description": "a float is not a boolean", - "data": 1.1, - "valid": false - }, - { - "description": "a string is not a boolean", - "data": "foo", - "valid": false - }, - { - "description": "an object is not a boolean", - "data": {}, - "valid": false - }, - { - "description": "an array is not a boolean", - "data": [], - "valid": false - }, - { - "description": "a boolean is not a boolean", - "data": true, - "valid": true - }, - { - "description": "null is not a boolean", - "data": null, - "valid": false - } - ] - }, - { - "description": "null type matches only the null object", - "schema": {"type": "null"}, - "tests": [ - { - "description": "an integer is not null", - "data": 1, - "valid": false - }, - { - "description": "a float is not null", - "data": 1.1, - "valid": false - }, - { - "description": "a string is not null", - "data": "foo", - "valid": false - }, - { - "description": "an object is not null", - "data": {}, - "valid": false - }, - { - "description": "an array is not null", - "data": [], - "valid": false - }, - { - "description": "a boolean is not null", - "data": true, - "valid": false - }, - { - "description": "null is null", - "data": null, - "valid": true - } - ] - }, - { - "description": "multiple types can be specified in an array", - "schema": {"type": ["integer", "string"]}, - "tests": [ - { - "description": "an integer is valid", - "data": 1, - "valid": true - }, - { - "description": "a string is valid", - "data": "foo", - "valid": true - }, - { - "description": "a float is invalid", - "data": 1.1, - "valid": false - }, - { - "description": "an object is invalid", - "data": {}, - "valid": false - }, - { - "description": "an array is invalid", - "data": [], - "valid": false - }, - { - "description": "a boolean is invalid", - "data": true, - "valid": false - }, - { - "description": "null is invalid", - "data": null, - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/uniqueItems.json b/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/uniqueItems.json deleted file mode 100644 index c1f4ab99c9a485..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema-draft4/uniqueItems.json +++ /dev/null @@ -1,79 +0,0 @@ -[ - { - "description": "uniqueItems validation", - "schema": {"uniqueItems": true}, - "tests": [ - { - "description": "unique array of integers is valid", - "data": [1, 2], - "valid": true - }, - { - "description": "non-unique array of integers is invalid", - "data": [1, 1], - "valid": false - }, - { - "description": "numbers are unique if mathematically unequal", - "data": [1.0, 1.00, 1], - "valid": false - }, - { - "description": "unique array of objects is valid", - "data": [{"foo": "bar"}, {"foo": "baz"}], - "valid": true - }, - { - "description": "non-unique array of objects is invalid", - "data": [{"foo": "bar"}, {"foo": "bar"}], - "valid": false - }, - { - "description": "unique array of nested objects is valid", - "data": [ - {"foo": {"bar" : {"baz" : true}}}, - {"foo": {"bar" : {"baz" : false}}} - ], - "valid": true - }, - { - "description": "non-unique array of nested objects is invalid", - "data": [ - {"foo": {"bar" : {"baz" : true}}}, - {"foo": {"bar" : {"baz" : true}}} - ], - "valid": false - }, - { - "description": "unique array of arrays is valid", - "data": [["foo"], ["bar"]], - "valid": true - }, - { - "description": "non-unique array of arrays is invalid", - "data": [["foo"], ["foo"]], - "valid": false - }, - { - "description": "1 and true are unique", - "data": [1, true], - "valid": true - }, - { - "description": "0 and false are unique", - "data": [0, false], - "valid": true - }, - { - "description": "unique heterogeneous types are valid", - "data": [{}, [1], true, null, 1], - "valid": true - }, - { - "description": "non-unique heterogeneous types are invalid", - "data": [{}, [1], true, null, {}, 1], - "valid": false - } - ] - } -] diff --git a/tools/eslint/node_modules/is-my-json-valid/test/json-schema.js b/tools/eslint/node_modules/is-my-json-valid/test/json-schema.js deleted file mode 100644 index e68a263a279218..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/json-schema.js +++ /dev/null @@ -1,23 +0,0 @@ -var tape = require('tape') -var fs = require('fs') -var validator = require('../') - -var files = fs.readdirSync(__dirname+'/json-schema-draft4') - .map(function(file) { - if (file === 'definitions.json') return null - if (file === 'refRemote.json') return null - return require('./json-schema-draft4/'+file) - }) - .filter(Boolean) - -files.forEach(function(file) { - file.forEach(function(f) { - tape('json-schema-test-suite '+f.description, function(t) { - var validate = validator(f.schema) - f.tests.forEach(function(test) { - t.same(validate(test.data), test.valid, test.description) - }) - t.end() - }) - }) -}) diff --git a/tools/eslint/node_modules/is-my-json-valid/test/misc.js b/tools/eslint/node_modules/is-my-json-valid/test/misc.js deleted file mode 100644 index b5109e576f26b9..00000000000000 --- a/tools/eslint/node_modules/is-my-json-valid/test/misc.js +++ /dev/null @@ -1,429 +0,0 @@ -var tape = require('tape') -var cosmic = require('./fixtures/cosmic') -var validator = require('../') -var validatorRequire = require('../require') - -tape('simple', function(t) { - var schema = { - required: true, - type: 'object', - properties: { - hello: {type:'string', required:true} - } - } - - var validate = validator(schema) - - t.ok(validate({hello: 'world'}), 'should be valid') - t.notOk(validate(), 'should be invalid') - t.notOk(validate({}), 'should be invalid') - t.end() -}) - -tape('advanced', function(t) { - var validate = validator(cosmic.schema) - - t.ok(validate(cosmic.valid), 'should be valid') - t.notOk(validate(cosmic.invalid), 'should be invalid') - t.end() -}) - -tape('greedy/false', function(t) { - var validate = validator({ - type: 'object', - properties: { - x: { - type: 'number' - } - }, - required: ['x', 'y'] - }); - t.notOk(validate({}), 'should be invalid') - t.strictEqual(validate.errors.length, 2); - t.strictEqual(validate.errors[0].field, 'data.x') - t.strictEqual(validate.errors[0].message, 'is required') - t.strictEqual(validate.errors[1].field, 'data.y') - t.strictEqual(validate.errors[1].message, 'is required') - t.notOk(validate({x: 'string'}), 'should be invalid') - t.strictEqual(validate.errors.length, 1); - t.strictEqual(validate.errors[0].field, 'data.y') - t.strictEqual(validate.errors[0].message, 'is required') - t.notOk(validate({x: 'string', y: 'value'}), 'should be invalid') - t.strictEqual(validate.errors.length, 1); - t.strictEqual(validate.errors[0].field, 'data.x') - t.strictEqual(validate.errors[0].message, 'is the wrong type') - t.end(); -}); - -tape('greedy/true', function(t) { - var validate = validator({ - type: 'object', - properties: { - x: { - type: 'number' - } - }, - required: ['x', 'y'] - }, { - greedy: true - }); - t.notOk(validate({}), 'should be invalid') - t.strictEqual(validate.errors.length, 2); - t.strictEqual(validate.errors[0].field, 'data.x') - t.strictEqual(validate.errors[0].message, 'is required') - t.strictEqual(validate.errors[1].field, 'data.y') - t.strictEqual(validate.errors[1].message, 'is required') - t.notOk(validate({x: 'string'}), 'should be invalid') - t.strictEqual(validate.errors.length, 2); - t.strictEqual(validate.errors[0].field, 'data.y') - t.strictEqual(validate.errors[0].message, 'is required') - t.strictEqual(validate.errors[1].field, 'data.x') - t.strictEqual(validate.errors[1].message, 'is the wrong type') - t.notOk(validate({x: 'string', y: 'value'}), 'should be invalid') - t.strictEqual(validate.errors.length, 1); - t.strictEqual(validate.errors[0].field, 'data.x') - t.strictEqual(validate.errors[0].message, 'is the wrong type') - t.ok(validate({x: 1, y: 'value'}), 'should be invalid') - t.end(); -}); - -tape('additional props', function(t) { - var validate = validator({ - type: 'object', - additionalProperties: false - }, { - verbose: true - }) - - t.ok(validate({})) - t.notOk(validate({foo:'bar'})) - t.ok(validate.errors[0].value === 'data.foo', 'should output the property not allowed in verbose mode') - t.end() -}) - -tape('array', function(t) { - var validate = validator({ - type: 'array', - required: true, - items: { - type: 'string' - } - }) - - t.notOk(validate({}), 'wrong type') - t.notOk(validate(), 'is required') - t.ok(validate(['test'])) - t.end() -}) - -tape('nested array', function(t) { - var validate = validator({ - type: 'object', - properties: { - list: { - type: 'array', - required: true, - items: { - type: 'string' - } - } - } - }) - - t.notOk(validate({}), 'is required') - t.ok(validate({list:['test']})) - t.notOk(validate({list:[1]})) - t.end() -}) - -tape('enum', function(t) { - var validate = validator({ - type: 'object', - properties: { - foo: { - type: 'number', - required: true, - enum: [42] - } - } - }) - - t.notOk(validate({}), 'is required') - t.ok(validate({foo:42})) - t.notOk(validate({foo:43})) - t.end() -}) - -tape('minimum/maximum', function(t) { - var validate = validator({ - type: 'object', - properties: { - foo: { - type: 'number', - minimum: 0, - maximum: 0 - } - } - }) - - t.notOk(validate({foo:-42})) - t.ok(validate({foo:0})) - t.notOk(validate({foo:42})) - t.end() -}) - -tape('exclusiveMinimum/exclusiveMaximum', function(t) { - var validate = validator({ - type: 'object', - properties: { - foo: { - type: 'number', - minimum: 10, - maximum: 20, - exclusiveMinimum: true, - exclusiveMaximum: true - } - } - }) - - t.notOk(validate({foo:10})) - t.ok(validate({foo:11})) - t.notOk(validate({foo:20})) - t.ok(validate({foo:19})) - t.end() -}) - -tape('custom format', function(t) { - var validate = validator({ - type: 'object', - properties: { - foo: { - type: 'string', - format: 'as' - } - } - }, {formats: {as:/^a+$/}}) - - t.notOk(validate({foo:''}), 'not as') - t.notOk(validate({foo:'b'}), 'not as') - t.notOk(validate({foo:'aaab'}), 'not as') - t.ok(validate({foo:'a'}), 'as') - t.ok(validate({foo:'aaaaaa'}), 'as') - t.end() -}) - -tape('custom format function', function(t) { - var validate = validator({ - type: 'object', - properties: { - foo: { - type: 'string', - format: 'as' - } - } - }, {formats: {as:function(s) { return /^a+$/.test(s) } }}) - - t.notOk(validate({foo:''}), 'not as') - t.notOk(validate({foo:'b'}), 'not as') - t.notOk(validate({foo:'aaab'}), 'not as') - t.ok(validate({foo:'a'}), 'as') - t.ok(validate({foo:'aaaaaa'}), 'as') - t.end() -}) - -tape('do not mutate schema', function(t) { - var sch = { - items: [ - {} - ], - additionalItems: { - type: 'integer' - } - } - - var copy = JSON.parse(JSON.stringify(sch)) - - validator(sch) - - t.same(sch, copy, 'did not mutate') - t.end() -}) - -tape('#toJSON()', function(t) { - var schema = { - required: true, - type: 'object', - properties: { - hello: {type:'string', required:true} - } - } - - var validate = validator(schema) - - t.deepEqual(validate.toJSON(), schema, 'should return original schema') - t.end() -}) - -tape('external schemas', function(t) { - var ext = {type: 'string'} - var schema = { - required: true, - $ref: '#ext' - } - - var validate = validator(schema, {schemas: {ext:ext}}) - - t.ok(validate('hello string'), 'is a string') - t.notOk(validate(42), 'not a string') - t.end() -}) - -tape('top-level external schema', function(t) { - var defs = { - "string": { - type: "string" - }, - "sex": { - type: "string", - enum: ["male", "female", "other"] - } - } - var schema = { - type: "object", - properties: { - "name": { $ref: "definitions.json#/string" }, - "sex": { $ref: "definitions.json#/sex" } - }, - required: ["name", "sex"] - } - - var validate = validator(schema, { - schemas: { - "definitions.json": defs - } - }) - t.ok(validate({name:"alice", sex:"female"}), 'is an object') - t.notOk(validate({name:"alice", sex: "bob"}), 'recognizes external schema') - t.notOk(validate({name:2, sex: "female"}), 'recognizes external schema') - t.end() -}) - -tape('nested required array decl', function(t) { - var schema = { - properties: { - x: { - type: 'object', - properties: { - y: { - type: 'object', - properties: { - z: { - type: 'string' - } - }, - required: ['z'] - } - } - } - }, - required: ['x'] - } - - var validate = validator(schema) - - t.ok(validate({x: {}}), 'should be valid') - t.notOk(validate({}), 'should not be valid') - t.strictEqual(validate.errors[0].field, 'data.x', 'should output the missing field') - t.end() -}) - -tape('verbose mode', function(t) { - var schema = { - required: true, - type: 'object', - properties: { - hello: { - required: true, - type: 'string' - } - } - }; - - var validate = validator(schema, {verbose: true}) - - t.ok(validate({hello: 'string'}), 'should be valid') - t.notOk(validate({hello: 100}), 'should not be valid') - t.strictEqual(validate.errors[0].value, 100, 'error object should contain the invalid value') - t.end() -}) - -tape('additional props in verbose mode', function(t) { - var schema = { - type: 'object', - required: true, - additionalProperties: false, - properties: { - foo: { - type: 'string' - }, - 'hello world': { - type: 'object', - required: true, - additionalProperties: false, - properties: { - foo: { - type: 'string' - } - } - } - } - }; - - var validate = validator(schema, {verbose: true}) - - validate({'hello world': {bar: 'string'}}); - - t.strictEqual(validate.errors[0].value, 'data["hello world"].bar', 'should output the path to the additional prop in the error') - t.end() -}) - -tape('Date.now() is an integer', function(t) { - var schema = {type: 'integer'} - var validate = validator(schema) - - t.ok(validate(Date.now()), 'is integer') - t.end() -}) - -tape('field shows item index in arrays', function(t) { - var schema = { - type: 'array', - items: { - type: 'array', - items: { - properties: { - foo: { - type: 'string', - required: true - } - } - } - } - } - - var validate = validator(schema) - - validate([ - [ - { foo: 'test' }, - { foo: 'test' } - ], - [ - { foo: 'test' }, - { baz: 'test' } - ] - ]) - - t.strictEqual(validate.errors[0].field, 'data.1.1.foo', 'should output the field with specific index of failing item in the error') - t.end() -}) diff --git a/tools/eslint/node_modules/is-path-cwd/package.json b/tools/eslint/node_modules/is-path-cwd/package.json index e3a6a3c7b1152d..53311c57f7941f 100644 --- a/tools/eslint/node_modules/is-path-cwd/package.json +++ b/tools/eslint/node_modules/is-path-cwd/package.json @@ -2,14 +2,14 @@ "_args": [ [ "is-path-cwd@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/del" + "/Users/silverwind/git/node/tools/package/package/node_modules/del" ] ], "_from": "is-path-cwd@>=1.0.0 <2.0.0", "_id": "is-path-cwd@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/is-path-cwd", + "_location": "/is-path-cwd", "_npmUser": { "email": "sindresorhus@gmail.com", "name": "sindresorhus" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/del" + "/del" ], "_resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", "_shasum": "d225ec23132e89edd38fda767472e62e65f1106d", "_shrinkwrap": null, "_spec": "is-path-cwd@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/del", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/del", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -59,19 +59,19 @@ "gitHead": "f71d4ecaa43bfe23c9cb35af6bf31e6b5b3f04eb", "homepage": "https://github.com/sindresorhus/is-path-cwd", "keywords": [ - "path", - "cwd", - "pwd", "check", - "filepath", + "cwd", "file", - "folder" + "filepath", + "folder", + "path", + "pwd" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "is-path-cwd", diff --git a/tools/eslint/node_modules/is-path-in-cwd/package.json b/tools/eslint/node_modules/is-path-in-cwd/package.json index 25884ed6bcc8f4..bae1a3afb4450c 100644 --- a/tools/eslint/node_modules/is-path-in-cwd/package.json +++ b/tools/eslint/node_modules/is-path-in-cwd/package.json @@ -2,14 +2,14 @@ "_args": [ [ "is-path-in-cwd@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/del" + "/Users/silverwind/git/node/tools/package/package/node_modules/del" ] ], "_from": "is-path-in-cwd@>=1.0.0 <2.0.0", "_id": "is-path-in-cwd@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/is-path-in-cwd", + "_location": "/is-path-in-cwd", "_npmUser": { "email": "sindresorhus@gmail.com", "name": "sindresorhus" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/del" + "/del" ], "_resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", "_shasum": "6477582b8214d602346094567003be8a9eac04dc", "_shrinkwrap": null, "_spec": "is-path-in-cwd@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/del", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/del", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -61,21 +61,21 @@ "gitHead": "a5a2a7c967eae3f6faee9ab5e40abca6127d55de", "homepage": "https://github.com/sindresorhus/is-path-in-cwd", "keywords": [ - "path", - "cwd", - "pwd", "check", - "filepath", + "cwd", "file", + "filepath", "folder", "in", - "inside" + "inside", + "path", + "pwd" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "is-path-in-cwd", diff --git a/tools/eslint/node_modules/is-path-inside/package.json b/tools/eslint/node_modules/is-path-inside/package.json index fe03962cdd3ef1..03e9e6f8db05c8 100644 --- a/tools/eslint/node_modules/is-path-inside/package.json +++ b/tools/eslint/node_modules/is-path-inside/package.json @@ -2,14 +2,14 @@ "_args": [ [ "is-path-inside@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/is-path-in-cwd" + "/Users/silverwind/git/node/tools/package/package/node_modules/is-path-in-cwd" ] ], "_from": "is-path-inside@>=1.0.0 <2.0.0", "_id": "is-path-inside@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/is-path-inside", + "_location": "/is-path-inside", "_npmUser": { "email": "sindresorhus@gmail.com", "name": "sindresorhus" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/is-path-in-cwd" + "/is-path-in-cwd" ], "_resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", "_shasum": "fc06e5a1683fbda13de667aff717bbc10a48f37f", "_shrinkwrap": null, "_spec": "is-path-inside@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/is-path-in-cwd", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/is-path-in-cwd", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -61,19 +61,19 @@ "gitHead": "b507035b66a539b7c12ba8b6b486377aa02aef9f", "homepage": "https://github.com/sindresorhus/is-path-inside", "keywords": [ - "path", - "inside", - "folder", - "directory", "dir", + "directory", "file", + "folder", + "inside", + "path", "resolve" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "is-path-inside", diff --git a/tools/eslint/node_modules/is-property/.npmignore b/tools/eslint/node_modules/is-property/.npmignore deleted file mode 100644 index 8ecfa25a868d83..00000000000000 --- a/tools/eslint/node_modules/is-property/.npmignore +++ /dev/null @@ -1,17 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -npm-debug.log -node_modules/* -*.DS_Store -test/* \ No newline at end of file diff --git a/tools/eslint/node_modules/is-property/package.json b/tools/eslint/node_modules/is-property/package.json index 586bd1571f5d06..e1e26c85335343 100644 --- a/tools/eslint/node_modules/is-property/package.json +++ b/tools/eslint/node_modules/is-property/package.json @@ -2,14 +2,14 @@ "_args": [ [ "is-property@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/generate-object-property" + "/Users/silverwind/git/node/tools/package/package/node_modules/generate-object-property" ] ], "_from": "is-property@>=1.0.0 <2.0.0", "_id": "is-property@1.0.2", "_inCache": true, "_installable": true, - "_location": "/eslint/is-property", + "_location": "/is-property", "_nodeVersion": "0.10.26", "_npmUser": { "email": "mikolalysenko@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/generate-object-property" + "/generate-object-property" ], "_resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "_shasum": "57fe1c4e48474edd65b09911f26b1cd4095dda84", "_shrinkwrap": null, "_spec": "is-property@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/generate-object-property", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/generate-object-property", "author": { "name": "Mikola Lysenko" }, @@ -54,20 +54,20 @@ "gitHead": "0a85ea5b6b1264ea1cdecc6e5cf186adbb3ffc50", "homepage": "https://github.com/mikolalysenko/is-property", "keywords": [ + ".", + "[]", + "bracket", + "dot", "is", - "property", "json", - "dot", - "bracket", - ".", - "[]" + "property" ], "license": "MIT", "main": "is-property.js", "maintainers": [ { - "email": "mikolalysenko@gmail.com", - "name": "mikolalysenko" + "name": "mikolalysenko", + "email": "mikolalysenko@gmail.com" } ], "name": "is-property", diff --git a/tools/eslint/node_modules/is-resolvable/package.json b/tools/eslint/node_modules/is-resolvable/package.json index 3e53ca97816675..3bbdd3ad3d1c8a 100644 --- a/tools/eslint/node_modules/is-resolvable/package.json +++ b/tools/eslint/node_modules/is-resolvable/package.json @@ -2,14 +2,14 @@ "_args": [ [ "is-resolvable@^1.0.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "is-resolvable@>=1.0.0 <2.0.0", "_id": "is-resolvable@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/is-resolvable", + "_location": "/is-resolvable", "_nodeVersion": "2.4.0", "_npmUser": { "email": "snnskwtnb@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", "_shasum": "8df57c61ea2e3c501408d100fb013cf8d6e0cc62", "_shrinkwrap": null, "_spec": "is-resolvable@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "name": "Shinnosuke Watanabe", "url": "https://github.com/shinnn" @@ -61,23 +61,23 @@ "gitHead": "e68ea1b3affa382cbd31b4bae1e1421040249a73", "homepage": "https://github.com/shinnn/is-resolvable#readme", "keywords": [ - "read", + "cmap", + "code-point", + "data", "file", "font", "glyph", - "code-point", - "unicode", + "metadata", "parse", - "cmap", + "read", "table", - "data", - "metadata" + "unicode" ], "license": "MIT", "maintainers": [ { - "email": "snnskwtnb@gmail.com", - "name": "shinnn" + "name": "shinnn", + "email": "snnskwtnb@gmail.com" } ], "name": "is-resolvable", diff --git a/tools/eslint/node_modules/isarray/Makefile b/tools/eslint/node_modules/isarray/Makefile new file mode 100644 index 00000000000000..0ecc29c402c243 --- /dev/null +++ b/tools/eslint/node_modules/isarray/Makefile @@ -0,0 +1,5 @@ + +test: + @node_modules/.bin/tape test.js + +.PHONY: test diff --git a/tools/eslint/node_modules/isarray/README.md b/tools/eslint/node_modules/isarray/README.md index 052a62b8d7b7ae..16d2c59c6195f9 100644 --- a/tools/eslint/node_modules/isarray/README.md +++ b/tools/eslint/node_modules/isarray/README.md @@ -3,6 +3,12 @@ `Array#isArray` for older browsers. +[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) +[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) + +[![browser support](https://ci.testling.com/juliangruber/isarray.png) +](https://ci.testling.com/juliangruber/isarray) + ## Usage ```js diff --git a/tools/eslint/node_modules/isarray/build/build.js b/tools/eslint/node_modules/isarray/build/build.js deleted file mode 100644 index e1856ef0943728..00000000000000 --- a/tools/eslint/node_modules/isarray/build/build.js +++ /dev/null @@ -1,208 +0,0 @@ - -/** - * Require the given path. - * - * @param {String} path - * @return {Object} exports - * @api public - */ - -function require(path, parent, orig) { - var resolved = require.resolve(path); - - // lookup failed - if (null == resolved) { - orig = orig || path; - parent = parent || 'root'; - var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); - err.path = orig; - err.parent = parent; - err.require = true; - throw err; - } - - var module = require.modules[resolved]; - - // perform real require() - // by invoking the module's - // registered function - if (!module.exports) { - module.exports = {}; - module.client = module.component = true; - module.call(this, module.exports, require.relative(resolved), module); - } - - return module.exports; -} - -/** - * Registered modules. - */ - -require.modules = {}; - -/** - * Registered aliases. - */ - -require.aliases = {}; - -/** - * Resolve `path`. - * - * Lookup: - * - * - PATH/index.js - * - PATH.js - * - PATH - * - * @param {String} path - * @return {String} path or null - * @api private - */ - -require.resolve = function(path) { - if (path.charAt(0) === '/') path = path.slice(1); - var index = path + '/index.js'; - - var paths = [ - path, - path + '.js', - path + '.json', - path + '/index.js', - path + '/index.json' - ]; - - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; - if (require.modules.hasOwnProperty(path)) return path; - } - - if (require.aliases.hasOwnProperty(index)) { - return require.aliases[index]; - } -}; - -/** - * Normalize `path` relative to the current path. - * - * @param {String} curr - * @param {String} path - * @return {String} - * @api private - */ - -require.normalize = function(curr, path) { - var segs = []; - - if ('.' != path.charAt(0)) return path; - - curr = curr.split('/'); - path = path.split('/'); - - for (var i = 0; i < path.length; ++i) { - if ('..' == path[i]) { - curr.pop(); - } else if ('.' != path[i] && '' != path[i]) { - segs.push(path[i]); - } - } - - return curr.concat(segs).join('/'); -}; - -/** - * Register module at `path` with callback `definition`. - * - * @param {String} path - * @param {Function} definition - * @api private - */ - -require.register = function(path, definition) { - require.modules[path] = definition; -}; - -/** - * Alias a module definition. - * - * @param {String} from - * @param {String} to - * @api private - */ - -require.alias = function(from, to) { - if (!require.modules.hasOwnProperty(from)) { - throw new Error('Failed to alias "' + from + '", it does not exist'); - } - require.aliases[to] = from; -}; - -/** - * Return a require function relative to the `parent` path. - * - * @param {String} parent - * @return {Function} - * @api private - */ - -require.relative = function(parent) { - var p = require.normalize(parent, '..'); - - /** - * lastIndexOf helper. - */ - - function lastIndexOf(arr, obj) { - var i = arr.length; - while (i--) { - if (arr[i] === obj) return i; - } - return -1; - } - - /** - * The relative require() itself. - */ - - function localRequire(path) { - var resolved = localRequire.resolve(path); - return require(resolved, parent, path); - } - - /** - * Resolve relative to the parent. - */ - - localRequire.resolve = function(path) { - var c = path.charAt(0); - if ('/' == c) return path.slice(1); - if ('.' == c) return require.normalize(p, path); - - // resolve deps by returning - // the dep in the nearest "deps" - // directory - var segs = parent.split('/'); - var i = lastIndexOf(segs, 'deps') + 1; - if (!i) i = 0; - path = segs.slice(0, i + 1).join('/') + '/deps/' + path; - return path; - }; - - /** - * Check if module is defined at `path`. - */ - - localRequire.exists = function(path) { - return require.modules.hasOwnProperty(localRequire.resolve(path)); - }; - - return localRequire; -}; -require.register("isarray/index.js", function(exports, require, module){ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - -}); -require.alias("isarray/index.js", "isarray/index.js"); diff --git a/tools/eslint/node_modules/isarray/component.json b/tools/eslint/node_modules/isarray/component.json deleted file mode 100644 index 9e31b683889015..00000000000000 --- a/tools/eslint/node_modules/isarray/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name" : "isarray", - "description" : "Array#isArray for older browsers", - "version" : "0.0.1", - "repository" : "juliangruber/isarray", - "homepage": "https://github.com/juliangruber/isarray", - "main" : "index.js", - "scripts" : [ - "index.js" - ], - "dependencies" : {}, - "keywords": ["browser","isarray","array"], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT" -} diff --git a/tools/eslint/node_modules/isarray/index.js b/tools/eslint/node_modules/isarray/index.js index 5f5ad45d46dda9..a57f63495943a0 100644 --- a/tools/eslint/node_modules/isarray/index.js +++ b/tools/eslint/node_modules/isarray/index.js @@ -1,3 +1,5 @@ +var toString = {}.toString; + module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; + return toString.call(arr) == '[object Array]'; }; diff --git a/tools/eslint/node_modules/isarray/package.json b/tools/eslint/node_modules/isarray/package.json index 699ef751cc8680..7f00f694edc02d 100644 --- a/tools/eslint/node_modules/isarray/package.json +++ b/tools/eslint/node_modules/isarray/package.json @@ -1,38 +1,39 @@ { "_args": [ [ - "isarray@0.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/readable-stream" + "isarray@~1.0.0", + "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream" ] ], - "_from": "isarray@0.0.1", - "_id": "isarray@0.0.1", + "_from": "isarray@>=1.0.0 <1.1.0", + "_id": "isarray@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/isarray", + "_location": "/isarray", + "_nodeVersion": "5.1.0", "_npmUser": { "email": "julian@juliangruber.com", "name": "juliangruber" }, - "_npmVersion": "1.2.18", + "_npmVersion": "3.3.12", "_phantomChildren": {}, "_requested": { "name": "isarray", - "raw": "isarray@0.0.1", - "rawSpec": "0.0.1", + "raw": "isarray@~1.0.0", + "rawSpec": "~1.0.0", "scope": null, - "spec": "0.0.1", - "type": "version" + "spec": ">=1.0.0 <1.1.0", + "type": "range" }, "_requiredBy": [ - "/eslint/doctrine", - "/eslint/readable-stream" + "/doctrine", + "/readable-stream" ], - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "_shasum": "bb935d48582cba168c06834957a54a3e07124f11", "_shrinkwrap": null, - "_spec": "isarray@0.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/readable-stream", + "_spec": "isarray@~1.0.0", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream", "author": { "email": "mail@juliangruber.com", "name": "Julian Gruber", @@ -44,25 +45,26 @@ "dependencies": {}, "description": "Array#isArray for older browsers", "devDependencies": { - "tap": "*" + "tape": "~2.13.4" }, "directories": {}, "dist": { - "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + "shasum": "bb935d48582cba168c06834957a54a3e07124f11", + "tarball": "http://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" }, + "gitHead": "2a23a281f369e9ae06394c0fb4d2381355a6ba33", "homepage": "https://github.com/juliangruber/isarray", "keywords": [ + "array", "browser", - "isarray", - "array" + "isarray" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "julian@juliangruber.com", - "name": "juliangruber" + "name": "juliangruber", + "email": "julian@juliangruber.com" } ], "name": "isarray", @@ -73,7 +75,23 @@ "url": "git://github.com/juliangruber/isarray.git" }, "scripts": { - "test": "tap test/*.js" + "test": "tape test.js" }, - "version": "0.0.1" + "testling": { + "browsers": [ + "android-browser/4.2..latest", + "chrome/22..latest", + "chrome/canary", + "firefox/17..latest", + "firefox/nightly", + "ie/8..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "opera/12..latest", + "opera/next", + "safari/5.1..latest" + ], + "files": "test.js" + }, + "version": "1.0.0" } diff --git a/tools/eslint/node_modules/js-yaml/CHANGELOG.md b/tools/eslint/node_modules/js-yaml/CHANGELOG.md deleted file mode 100644 index e7ff17185e53b8..00000000000000 --- a/tools/eslint/node_modules/js-yaml/CHANGELOG.md +++ /dev/null @@ -1,376 +0,0 @@ -3.5.3 / 2016-02-11 ------------------- - -- Maintenance release. - - -3.5.2 / 2016-01-11 ------------------- - -- Maintenance: missed comma in bower config. - - -3.5.1 / 2016-01-11 ------------------- - -- Removed `inherit` dependency, #239. -- Better browserify workaround for esprima load. -- Demo rewrite. - - -3.5.0 / 2016-01-10 ------------------- - -- Dumper. Fold strings only, #217. -- Dumper. `norefs` option, to clone linked objects, #229. -- Loader. Throw a warning for duplicate keys, #166. -- Improved browserify support (mark `esprima` & `Buffer` excluded). - - -3.4.6 / 2015-11-26 ------------------- - -- Use standalone `inherit` to keep browserified files clear. - - -3.4.5 / 2015-11-23 ------------------- - -- Added `lineWidth` option to dumper. - - -3.4.4 / 2015-11-21 ------------------- - -- Fixed floats dump (missed dot for scientific format), #220. -- Allow non-printable characters inside quoted scalars, #192. - - -3.4.3 / 2015-10-10 ------------------- - -- Maintenance release - deps bump (esprima, argparse). - - -3.4.2 / 2015-09-09 ------------------- - -- Fixed serialization of duplicated entries in sequences, #205. - Thanks to @vogelsgesang. - - -3.4.1 / 2015-09-05 ------------------- - -- Fixed stacktrace handling in generated errors, for browsers (FF/IE). - - -3.4.0 / 2015-08-23 ------------------- - -- Fixed multiline keys dump, #197. Thanks to @tcr. -- Don't throw on warnongs anymore. Use `onWarning` option to catch. -- Throw error on unknown tags (was warning before). -- Fixed heading line breaks in some scalars (regression). -- Reworked internals of error class. - - -3.3.1 / 2015-05-13 ------------------- - -- Added `.sortKeys` dumper option, thanks to @rjmunro. -- Fixed astral characters support, #191. - - -3.3.0 / 2015-04-26 ------------------- - -- Significantly improved long strings formatting in dumper, thanks to @isaacs. -- Strip BOM if exists. - - -3.2.7 / 2015-02-19 ------------------- - -- Maintenance release. -- Updated dependencies. -- HISTORY.md -> CHANGELOG.md - - -3.2.6 / 2015-02-07 ------------------- - -- Fixed encoding of UTF-16 surrogate pairs. (e.g. "\U0001F431" CAT FACE). -- Fixed demo dates dump (#113, thanks to @Hypercubed). - - -3.2.5 / 2014-12-28 ------------------- - -- Fixed resolving of all built-in types on empty nodes. -- Fixed invalid warning on empty lines within quoted scalars and flow collections. -- Fixed bug: Tag on an empty node didn't resolve in some cases. - - -3.2.4 / 2014-12-19 ------------------- - -- Fixed resolving of !!null tag on an empty node. - - -3.2.3 / 2014-11-08 ------------------- - -- Implemented dumping of objects with circular and cross references. -- Partially fixed aliasing of constructed objects. (see issue #141 for details) - - -3.2.2 / 2014-09-07 ------------------- - -- Fixed infinite loop on unindented block scalars. -- Rewritten base64 encode/decode in binary type, to keep code licence clear. - - -3.2.1 / 2014-08-24 ------------------- - -- Nothig new. Just fix npm publish error. - - -3.2.0 / 2014-08-24 ------------------- - -- Added input piping support to CLI. -- Fixed typo, that could cause hand on initial indent (#139). - - -3.1.0 / 2014-07-07 ------------------- - -- 1.5x-2x speed boost. -- Removed deprecated `require('xxx.yml')` support. -- Significant code cleanup and refactoring. -- Internal API changed. If you used custom types - see updated examples. - Others are not affected. -- Even if the input string has no trailing line break character, - it will be parsed as if it has one. -- Added benchmark scripts. -- Moved bower files to /dist folder -- Bugfixes. - - -3.0.2 / 2014-02-27 ------------------- - -- Fixed bug: "constructor" string parsed as `null`. - - -3.0.1 / 2013-12-22 ------------------- - -- Fixed parsing of literal scalars. (issue #108) -- Prevented adding unnecessary spaces in object dumps. (issue #68) -- Fixed dumping of objects with very long (> 1024 in length) keys. - - -3.0.0 / 2013-12-16 ------------------- - -- Refactored code. Changed API for custom types. -- Removed output colors in CLI, dump json by default. -- Removed big dependencies from browser version (esprima, buffer) - - load `esprima` manually, if !!js/function needed - - !!bin now returns Array in browser -- AMD support. -- Don't quote dumped strings because of `-` & `?` (if not first char). -- __Deprecated__ loading yaml files via `require()`, as not recommended - behaviour for node. - - -2.1.3 / 2013-10-16 ------------------- - -- Fix wrong loading of empty block scalars. - - -2.1.2 / 2013-10-07 ------------------- - -- Fix unwanted line breaks in folded scalars. - - -2.1.1 / 2013-10-02 ------------------- - -- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1 -- Fixed reader bug in JSON-like sequences/mappings. - - -2.1.0 / 2013-06-05 ------------------- - -- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`), - JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`). -- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA` - and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`. -- Bug fix: export `NIL` constant from the public interface. -- Add `skipInvalid` dumper option. -- Use `safeLoad` for `require` extension. - - -2.0.5 / 2013-04-26 ------------------- - -- Close security issue in !!js/function constructor. - Big thanks to @nealpoole for security audit. - - -2.0.4 / 2013-04-08 ------------------- - -- Updated .npmignore to reduce package size - - -2.0.3 / 2013-02-26 ------------------- - -- Fixed dumping of empty arrays ans objects. ([] and {} instead of null) - - -2.0.2 / 2013-02-15 ------------------- - -- Fixed input validation: tabs are printable characters. - - -2.0.1 / 2013-02-09 ------------------- - -- Fixed error, when options not passed to function cass - - -2.0.0 / 2013-02-09 ------------------- - -- Full rewrite. New architecture. Fast one-stage parsing. -- Changed custom types API. -- Added YAML dumper. - - -1.0.3 / 2012-11-05 ------------------- - -- Fixed utf-8 files loading. - - -1.0.2 / 2012-08-02 ------------------- - -- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44. -- Fix timstamps incorectly parsed in local time when no time part specified. - - -1.0.1 / 2012-07-07 ------------------- - -- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong. -- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46. - - -1.0.0 / 2012-07-01 ------------------- - -- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore. - Fixes #42. -- `require(filename)` now returns a single document and throws an Error if - file contains more than one document. -- CLI was merged back from js-yaml.bin - - -0.3.7 / 2012-02-28 ------------------- - -- Fix export of `addConstructor()`. Closes #39. - - -0.3.6 / 2012-02-22 ------------------- - -- Removed AMD parts - too buggy to use. Need help to rewrite from scratch -- Removed YUI compressor warning (renamed `double` variable). Closes #40. - - -0.3.5 / 2012-01-10 ------------------- - -- Workagound for .npmignore fuckup under windows. Thanks to airportyh. - - -0.3.4 / 2011-12-24 ------------------- - -- Fixes str[] for oldIEs support. -- Adds better has change support for browserified demo. -- improves compact output of Error. Closes #33. - - -0.3.3 / 2011-12-20 ------------------- - -- jsyaml executable moved to separate module. -- adds `compact` stringification of Errors. - - -0.3.2 / 2011-12-16 ------------------- - -- Fixes ug with block style scalars. Closes #26. -- All sources are passing JSLint now. -- Fixes bug in Safari. Closes #28. -- Fixes bug in Opers. Closes #29. -- Improves browser support. Closes #20. -- Added jsyaml executable. -- Added !!js/function support. Closes #12. - - -0.3.1 / 2011-11-18 ------------------- - -- Added AMD support for browserified version. -- Wrapped browserified js-yaml into closure. -- Fixed the resolvement of non-specific tags. Closes #17. -- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol. -- Added !!js/regexp and !!js/undefined types. Partially solves #12. -- Fixed !!set mapping. -- Fixed month parse in dates. Closes #19. - - -0.3.0 / 2011-11-09 ------------------- - -- Removed JS.Class dependency. Closes #3. -- Added browserified version. Closes #13. -- Added live demo of browserified version. -- Ported some of the PyYAML tests. See #14. -- Fixed timestamp bug when fraction was given. - - -0.2.2 / 2011-11-06 ------------------- - -- Fixed crash on docs without ---. Closes #8. -- Fixed miltiline string parse -- Fixed tests/comments for using array as key - - -0.2.1 / 2011-11-02 ------------------- - -- Fixed short file read (<4k). Closes #9. - - -0.2.0 / 2011-11-02 ------------------- - -- First public release diff --git a/tools/eslint/node_modules/js-yaml/README.md b/tools/eslint/node_modules/js-yaml/README.md index 2a595ef2327cf2..45c35020ce2998 100644 --- a/tools/eslint/node_modules/js-yaml/README.md +++ b/tools/eslint/node_modules/js-yaml/README.md @@ -180,6 +180,8 @@ options: function, use the function to sort the keys. - `lineWidth` _(default: `80`)_ - set max line width. - `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references +- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older + yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 styles: diff --git a/tools/eslint/node_modules/js-yaml/dist/js-yaml.js b/tools/eslint/node_modules/js-yaml/dist/js-yaml.js index 87a0c994e05ce8..5f20e9b5d9c382 100644 --- a/tools/eslint/node_modules/js-yaml/dist/js-yaml.js +++ b/tools/eslint/node_modules/js-yaml/dist/js-yaml.js @@ -1,4 +1,4 @@ -/* js-yaml 3.5.3 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;on;n+=1)r=o[n],e[r]=t[r];return e}function s(e,t){var n,i="";for(n=0;t>n;n+=1)i+=e;return i}function c(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e}t.exports.isNothing=i,t.exports.isObject=r,t.exports.toArray=o,t.exports.repeat=s,t.exports.isNegativeZero=c,t.exports.extend=a},{}],3:[function(e,t,n){"use strict";function i(e,t){var n,i,r,o,a,s,c;if(null===t)return{};for(n={},i=Object.keys(t),r=0,o=i.length;o>r;r+=1)a=i[r],s=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),c=e.compiledTypeMap[a],c&&F.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[a]=s;return n}function r(e){var t,n,i;if(t=e.toString(16).toUpperCase(),255>=e)n="x",i=2;else if(65535>=e)n="u",i=4;else{if(!(4294967295>=e))throw new I("code point within a string may not be greater than 0xFFFFFFFF");n="U",i=8}return"\\"+n+j.repeat("0",i-t.length)+t}function o(e){this.schema=e.schema||S,this.indent=Math.max(1,e.indent||2),this.skipInvalid=e.skipInvalid||!1,this.flowLevel=j.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=i(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function a(e,t){for(var n,i=j.repeat(" ",t),r=0,o=-1,a="",s=e.length;s>r;)o=e.indexOf("\n",r),-1===o?(n=e.slice(r),r=s):(n=e.slice(r,o+1),r=o+1),n.length&&"\n"!==n&&(a+=i),a+=n;return a}function s(e,t){return"\n"+j.repeat(" ",e.indent*t)}function c(e,t){var n,i,r;for(n=0,i=e.implicitTypes.length;i>n;n+=1)if(r=e.implicitTypes[n],r.resolve(t))return!0;return!1}function u(e){this.source=e,this.result="",this.checkpoint=0}function l(e,t,n,i){var r,o,s,l,f,m,g,y,x,v,A,b,w,k,C,j,I,S,E,O,F;if(0===t.length)return void(e.dump="''");if(-1!==te.indexOf(t))return void(e.dump="'"+t+"'");for(r=!0,o=t.length?t.charCodeAt(0):0,s=L===o||L===t.charCodeAt(t.length-1),($===o||W===o||G===o||z===o)&&(r=!1),s||e.flowLevel>-1&&e.flowLevel<=n?(s&&(r=!1),l=!1,f=!1):(l=!i,f=!i),m=!0,g=new u(t),y=!1,x=0,v=0,A=e.indent*n,b=e.lineWidth,-1===b&&(b=9007199254740991),40>A?b-=A:b=40,k=0;k0&&(I=t.charCodeAt(k-1),I===L&&(f=!1,l=!1)),l&&(S=k-x,x=k,S>v&&(v=S))),w!==D&&(m=!1),g.takeUpTo(k),g.escapeChar())}if(r&&c(e,t)&&(r=!1),E="",(l||f)&&(O=0,t.charCodeAt(t.length-1)===T&&(O+=1,t.charCodeAt(t.length-2)===T&&(O+=1)),0===O?E="-":2===O&&(E="+")),(f&&b>v||null!==e.tag)&&(l=!1),y||(f=!1),r)e.dump=t;else if(m)e.dump="'"+t+"'";else if(l)F=p(t,b),e.dump=">"+E+"\n"+a(F,A);else if(f)E||(t=t.replace(/\n$/,"")),e.dump="|"+E+"\n"+a(t,A);else{if(!g)throw new Error("Failed to dump scalar value");g.finish(),e.dump='"'+g.result+'"'}}function p(e,t){var n,i="",r=0,o=e.length,a=/\n+$/.exec(e);for(a&&(o=a.index+1);o>r;)n=e.indexOf("\n",r),n>o||-1===n?(i&&(i+="\n\n"),i+=f(e.slice(r,o),t),r=o):(i&&(i+="\n\n"),i+=f(e.slice(r,n),t),r=n+1);return a&&"\n"!==a[0]&&(i+=a[0]),i}function f(e,t){if(""===e)return e;for(var n,i,r,o=/[^\s] [^\s]/g,a="",s=0,c=0,u=o.exec(e);u;)n=u.index,n-c>t&&(i=s!==c?s:n,a&&(a+="\n"),r=e.slice(c,i),a+=r,c=i+1),s=n+1,u=o.exec(e);return a&&(a+="\n"),a+=c!==s&&e.length-c>t?e.slice(c,s)+"\n"+e.slice(s+1):e.slice(c)}function h(e){return N!==e&&T!==e&&_!==e&&P!==e&&V!==e&&Z!==e&&J!==e&&X!==e&&U!==e&&Y!==e&&B!==e&&M!==e&&Q!==e&&H!==e&&R!==e&&D!==e&&q!==e&&K!==e&&!ee[e]&&!d(e)}function d(e){return!(e>=32&&126>=e||133===e||e>=160&&55295>=e||e>=57344&&65533>=e||e>=65536&&1114111>=e)}function m(e,t,n){var i,r,o="",a=e.tag;for(i=0,r=n.length;r>i;i+=1)A(e,t,n[i],!1,!1)&&(0!==i&&(o+=", "),o+=e.dump);e.tag=a,e.dump="["+o+"]"}function g(e,t,n,i){var r,o,a="",c=e.tag;for(r=0,o=n.length;o>r;r+=1)A(e,t+1,n[r],!0,!0)&&(i&&0===r||(a+=s(e,t)),a+="- "+e.dump);e.tag=c,e.dump=a||"[]"}function y(e,t,n){var i,r,o,a,s,c="",u=e.tag,l=Object.keys(n);for(i=0,r=l.length;r>i;i+=1)s="",0!==i&&(s+=", "),o=l[i],a=n[o],A(e,t,o,!1,!1)&&(e.dump.length>1024&&(s+="? "),s+=e.dump+": ",A(e,t,a,!1,!1)&&(s+=e.dump,c+=s));e.tag=u,e.dump="{"+c+"}"}function x(e,t,n,i){var r,o,a,c,u,l,p="",f=e.tag,h=Object.keys(n);if(e.sortKeys===!0)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new I("sortKeys must be a boolean or a function");for(r=0,o=h.length;o>r;r+=1)l="",i&&0===r||(l+=s(e,t)),a=h[r],c=n[a],A(e,t+1,a,!0,!0,!0)&&(u=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024,u&&(l+=e.dump&&T===e.dump.charCodeAt(0)?"?":"? "),l+=e.dump,u&&(l+=s(e,t)),A(e,t+1,c,!0,u)&&(l+=e.dump&&T===e.dump.charCodeAt(0)?":":": ",l+=e.dump,p+=l));e.tag=f,e.dump=p||"{}"}function v(e,t,n){var i,r,o,a,s,c;for(r=n?e.explicitTypes:e.implicitTypes,o=0,a=r.length;a>o;o+=1)if(s=r[o],(s.instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(e.tag=n?s.tag:"?",s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===O.call(s.represent))i=s.represent(t,c);else{if(!F.call(s.represent,c))throw new I("!<"+s.tag+'> tag resolver accepts not "'+c+'" style');i=s.represent[c](t,c)}e.dump=i}return!0}return!1}function A(e,t,n,i,r,o){e.tag=null,e.dump=n,v(e,n,!1)||v(e,n,!0);var a=O.call(e.dump);i&&(i=e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(s=e.duplicates.indexOf(n),c=-1!==s),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(r=!1),c&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(u&&c&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)i&&0!==Object.keys(e.dump).length?(x(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(y(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a)i&&0!==e.dump.length?(g(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(m(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new I("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&l(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function b(e,t){var n,i,r=[],o=[];for(w(e,r,o),n=0,i=o.length;i>n;n+=1)t.duplicates.push(r[o[n]]);t.usedDuplicates=new Array(i)}function w(e,t,n){var i,r,o;if(null!==e&&"object"==typeof e)if(r=t.indexOf(e),-1!==r)-1===n.indexOf(r)&&n.push(r);else if(t.push(e),Array.isArray(e))for(r=0,o=e.length;o>r;r+=1)w(e[r],t,n);else for(i=Object.keys(e),r=0,o=i.length;o>r;r+=1)w(e[i[r]],t,n)}function k(e,t){t=t||{};var n=new o(t);return n.noRefs||b(e,n),A(n,0,e,!0,!0)?n.dump+"\n":""}function C(e,t){return k(e,j.extend({schema:E},t))}var j=e("./common"),I=e("./exception"),S=e("./schema/default_full"),E=e("./schema/default_safe"),O=Object.prototype.toString,F=Object.prototype.hasOwnProperty,N=9,T=10,_=13,L=32,M=33,D=34,U=35,q=37,Y=38,R=39,B=42,P=44,$=45,K=58,H=62,W=63,G=64,V=91,Z=93,z=96,J=123,Q=124,X=125,ee={};ee[0]="\\0",ee[7]="\\a",ee[8]="\\b",ee[9]="\\t",ee[10]="\\n",ee[11]="\\v",ee[12]="\\f",ee[13]="\\r",ee[27]="\\e",ee[34]='\\"',ee[92]="\\\\",ee[133]="\\N",ee[160]="\\_",ee[8232]="\\L",ee[8233]="\\P";var te=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];u.prototype.takeUpTo=function(e){var t;if(e checkpoint"),t.position=e,t.checkpoint=this.checkpoint,t;return this.result+=this.source.slice(this.checkpoint,e),this.checkpoint=e,this},u.prototype.escapeChar=function(){var e,t;return e=this.source.charCodeAt(this.checkpoint),t=ee[e]||r(e),this.result+=t,this.checkpoint+=1,this},u.prototype.finish=function(){this.source.length>this.checkpoint&&this.takeUpTo(this.source.length)},t.exports.dump=k,t.exports.safeDump=C},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(e,t,n){"use strict";function i(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},t.exports=i},{}],5:[function(e,t,n){"use strict";function i(e){return 10===e||13===e}function r(e){return 9===e||32===e}function o(e){return 9===e||32===e||10===e||13===e}function a(e){return 44===e||91===e||93===e||123===e||125===e}function s(e){var t;return e>=48&&57>=e?e-48:(t=32|e,t>=97&&102>=t?t-97+10:-1)}function c(e){return 120===e?2:117===e?4:85===e?8:0}function u(e){return e>=48&&57>=e?e-48:-1}function l(e){return 48===e?"\x00":97===e?"":98===e?"\b":116===e?" ":9===e?" ":110===e?"\n":118===e?"\x0B":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function p(e){return 65535>=e?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function f(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function h(e,t){return new B(t,new P(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function d(e,t){throw h(e,t)}function m(e,t){e.onWarning&&e.onWarning.call(null,h(e,t))}function g(e,t,n,i){var r,o,a,s;if(n>t){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;o>r;r+=1)a=s.charCodeAt(r),9===a||a>=32&&1114111>=a||d(e,"expected valid JSON character");else X.test(s)&&d(e,"the stream contains non-printable characters");e.result+=s}}function y(e,t,n,i){var r,o,a,s;for(R.isObject(n)||d(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(n),a=0,s=r.length;s>a;a+=1)o=r[a],H.call(t,o)||(t[o]=n[o],i[o]=!0)}function x(e,t,n,i,r,o){var a,s;if(r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(a=0,s=o.length;s>a;a+=1)y(e,t,o[a],n);else y(e,t,o,n);else e.json||H.call(n,r)||!H.call(t,r)||d(e,"duplicated mapping key"),t[r]=o,delete n[r];return t}function v(e){var t;t=e.input.charCodeAt(e.position),10===t?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):d(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function A(e,t,n){for(var o=0,a=e.input.charCodeAt(e.position);0!==a;){for(;r(a);)a=e.input.charCodeAt(++e.position);if(t&&35===a)do a=e.input.charCodeAt(++e.position);while(10!==a&&13!==a&&0!==a);if(!i(a))break;for(v(e),a=e.input.charCodeAt(e.position),o++,e.lineIndent=0;32===a;)e.lineIndent++,a=e.input.charCodeAt(++e.position)}return-1!==n&&0!==o&&e.lineIndent1&&(e.result+=R.repeat("\n",t-1))}function k(e,t,n){var s,c,u,l,p,f,h,d,m,y=e.kind,x=e.result;if(m=e.input.charCodeAt(e.position),o(m)||a(m)||35===m||38===m||42===m||33===m||124===m||62===m||39===m||34===m||37===m||64===m||96===m)return!1;if((63===m||45===m)&&(c=e.input.charCodeAt(e.position+1),o(c)||n&&a(c)))return!1;for(e.kind="scalar",e.result="",u=l=e.position,p=!1;0!==m;){if(58===m){if(c=e.input.charCodeAt(e.position+1),o(c)||n&&a(c))break}else if(35===m){if(s=e.input.charCodeAt(e.position-1),o(s))break}else{if(e.position===e.lineStart&&b(e)||n&&a(m))break;if(i(m)){if(f=e.line,h=e.lineStart,d=e.lineIndent,A(e,!1,-1),e.lineIndent>=t){p=!0,m=e.input.charCodeAt(e.position);continue}e.position=l,e.line=f,e.lineStart=h,e.lineIndent=d;break}}p&&(g(e,u,l,!1),w(e,e.line-f),u=l=e.position,p=!1),r(m)||(l=e.position+1),m=e.input.charCodeAt(++e.position)}return g(e,u,l,!1),e.result?!0:(e.kind=y,e.result=x,!1)}function C(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),39!==n)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(g(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),39!==n)return!0;r=o=e.position,e.position++}else i(n)?(g(e,r,o,!0),w(e,A(e,!1,t)),r=o=e.position):e.position===e.lineStart&&b(e)?d(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);d(e,"unexpected end of the stream within a single quoted scalar")}function j(e,t){var n,r,o,a,u,l;if(l=e.input.charCodeAt(e.position),34!==l)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;0!==(l=e.input.charCodeAt(e.position));){if(34===l)return g(e,n,e.position,!0),e.position++,!0;if(92===l){if(g(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),i(l))A(e,!1,t);else if(256>l&&re[l])e.result+=oe[l],e.position++;else if((u=c(l))>0){for(o=u,a=0;o>0;o--)l=e.input.charCodeAt(++e.position),(u=s(l))>=0?a=(a<<4)+u:d(e,"expected hexadecimal character");e.result+=p(a),e.position++}else d(e,"unknown escape sequence");n=r=e.position}else i(l)?(g(e,n,r,!0),w(e,A(e,!1,t)),n=r=e.position):e.position===e.lineStart&&b(e)?d(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}d(e,"unexpected end of the stream within a double quoted scalar")}function I(e,t){var n,i,r,a,s,c,u,l,p,f,h,m=!0,g=e.tag,y=e.anchor,v={};if(h=e.input.charCodeAt(e.position),91===h)a=93,u=!1,i=[];else{if(123!==h)return!1;a=125,u=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),h=e.input.charCodeAt(++e.position);0!==h;){if(A(e,!0,t),h=e.input.charCodeAt(e.position),h===a)return e.position++,e.tag=g,e.anchor=y,e.kind=u?"mapping":"sequence",e.result=i,!0;m||d(e,"missed comma between flow collection entries"),p=l=f=null,s=c=!1,63===h&&(r=e.input.charCodeAt(e.position+1),o(r)&&(s=c=!0,e.position++,A(e,!0,t))),n=e.line,_(e,t,W,!1,!0),p=e.tag,l=e.result,A(e,!0,t),h=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==h||(s=!0,h=e.input.charCodeAt(++e.position),A(e,!0,t),_(e,t,W,!1,!0),f=e.result),u?x(e,i,v,p,l,f):s?i.push(x(e,null,v,p,l,f)):i.push(l),A(e,!0,t),h=e.input.charCodeAt(e.position),44===h?(m=!0,h=e.input.charCodeAt(++e.position)):m=!1}d(e,"unexpected end of the stream within a flow collection")}function S(e,t){var n,o,a,s,c=z,l=!1,p=t,f=0,h=!1;if(s=e.input.charCodeAt(e.position),124===s)o=!1;else{if(62!==s)return!1;o=!0}for(e.kind="scalar",e.result="";0!==s;)if(s=e.input.charCodeAt(++e.position),43===s||45===s)z===c?c=43===s?Q:J:d(e,"repeat of a chomping mode identifier");else{if(!((a=u(s))>=0))break;0===a?d(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?d(e,"repeat of an indentation width identifier"):(p=t+a-1,l=!0)}if(r(s)){do s=e.input.charCodeAt(++e.position);while(r(s));if(35===s)do s=e.input.charCodeAt(++e.position);while(!i(s)&&0!==s)}for(;0!==s;){for(v(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!l||e.lineIndentp&&(p=e.lineIndent),i(s))f++;else{if(e.lineIndentt)&&0!==r)d(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(_(e,t,Z,!0,a)&&(y?m=e.result:g=e.result),y||(x(e,p,f,h,m,g),h=m=g=null),A(e,!0,-1),c=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==c)d(e,"bad indentation of a mapping entry");else if(e.lineIndentt?h=1:e.lineIndent===t?h=0:e.lineIndentt?h=1:e.lineIndent===t?h=0:e.lineIndentc;c+=1)if(l=e.implicitTypes[c],l.resolve(e.result)){e.result=l.construct(e.result),e.tag=l.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else H.call(e.typeMap,e.tag)?(l=e.typeMap[e.tag],null!==e.result&&l.kind!==e.kind&&d(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):d(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):d(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||g}function L(e){var t,n,a,s,c=e.position,u=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(s=e.input.charCodeAt(e.position))&&(A(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(u=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(t,e.position),a=[],n.length<1&&d(e,"directive name must not be less than one character in length");0!==s;){for(;r(s);)s=e.input.charCodeAt(++e.position);if(35===s){do s=e.input.charCodeAt(++e.position);while(0!==s&&!i(s));break}if(i(s))break;for(t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==s&&v(e),H.call(se,n)?se[n](e,n,a):m(e,'unknown document directive "'+n+'"')}return A(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,A(e,!0,-1)):u&&d(e,"directives end mark is expected"),_(e,e.lineIndent-1,Z,!1,!0),A(e,!0,-1),e.checkLineBreaks&&ee.test(e.input.slice(c,e.position))&&m(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&b(e)?void(46===e.input.charCodeAt(e.position)&&(e.position+=3,A(e,!0,-1))):void(e.positioni;i+=1)t(o[i])}function U(e,t){var n=M(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new B("expected a single document in the stream, but found more")}}function q(e,t,n){D(e,t,R.extend({schema:$},n))}function Y(e,t){return U(e,R.extend({schema:$},t))}for(var R=e("./common"),B=e("./exception"),P=e("./mark"),$=e("./schema/default_safe"),K=e("./schema/default_full"),H=Object.prototype.hasOwnProperty,W=1,G=2,V=3,Z=4,z=1,J=2,Q=3,X=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ee=/[\x85\u2028\u2029]/,te=/[,\[\]\{\}]/,ne=/^(?:!|!!|![a-z\-]+!)$/i,ie=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i,re=new Array(256),oe=new Array(256),ae=0;256>ae;ae++)re[ae]=l(ae)?1:0,oe[ae]=l(ae);var se={YAML:function(e,t,n){var i,r,o;null!==e.version&&d(e,"duplication of %YAML directive"),1!==n.length&&d(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),null===i&&d(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&d(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=2>o,1!==o&&2!==o&&m(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&d(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],ne.test(i)||d(e,"ill-formed tag handle (first argument) of the TAG directive"),H.call(e.tagMap,i)&&d(e,'there is a previously declared suffix for "'+i+'" tag handle'),ie.test(r)||d(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[i]=r}};t.exports.loadAll=D,t.exports.load=U,t.exports.safeLoadAll=q,t.exports.safeLoad=Y},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(e,t,n){"use strict";function i(e,t,n,i,r){this.name=e,this.buffer=t,this.position=n,this.line=i,this.column=r}var r=e("./common");i.prototype.getSnippet=function(e,t){var n,i,o,a,s;if(!this.buffer)return null;for(e=e||4,t=t||75,n="",i=this.position;i>0&&-1==="\x00\r\n…\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>t/2-1){n=" ... ",i+=5;break}for(o="",a=this.position;at/2-1){o=" ... ",a-=5;break}return s=this.buffer.slice(i,a),r.repeat(" ",e)+n+s+o+"\n"+r.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet(),t&&(n+=":\n"+t)),n},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";function i(e,t,n){var r=[];return e.include.forEach(function(e){n=i(e,t,n)}),e[t].forEach(function(e){n.forEach(function(t,n){t.tag===e.tag&&r.push(n)}),n.push(e)}),n.filter(function(e,t){return-1===r.indexOf(t)})}function r(){function e(e){i[e.tag]=e}var t,n,i={};for(t=0,n=arguments.length;n>t;t+=1)arguments[t].forEach(e);return i}function o(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=i(this,"implicit",[]),this.compiledExplicit=i(this,"explicit",[]),this.compiledTypeMap=r(this.compiledImplicit,this.compiledExplicit)}var a=e("./common"),s=e("./exception"),c=e("./type");o.DEFAULT=null,o.create=function(){var e,t;switch(arguments.length){case 1:e=o.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new s("Wrong number of arguments for Schema.create function")}if(e=a.toArray(e),t=a.toArray(t),!e.every(function(e){return e instanceof o}))throw new s("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every(function(e){return e instanceof c}))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new o({include:e,explicit:t})},t.exports=o},{"./common":2,"./exception":4,"./type":13}],8:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./json")]})},{"../schema":7,"./json":12}],9:[function(e,t,n){"use strict";var i=e("../schema");t.exports=i.DEFAULT=new i({include:[e("./default_safe")],explicit:[e("../type/js/undefined"),e("../type/js/regexp"),e("../type/js/function")]})},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./core")],implicit:[e("../type/timestamp"),e("../type/merge")],explicit:[e("../type/binary"),e("../type/omap"),e("../type/pairs"),e("../type/set")]})},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({explicit:[e("../type/str"),e("../type/seq"),e("../type/map")]})},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./failsafe")],implicit:[e("../type/null"),e("../type/bool"),e("../type/int"),e("../type/float")]})},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(e,t,n){"use strict";function i(e){var t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function r(e,t){if(t=t||{},Object.keys(t).forEach(function(t){if(-1===a.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=i(t.styleAliases||null),-1===s.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var o=e("./exception"),a=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],s=["scalar","sequence","mapping"];t.exports=r},{"./exception":4}],14:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=u;for(n=0;r>n;n++)if(t=o.indexOf(e.charAt(n)),!(t>64)){if(0>t)return!1;i+=6}return i%8===0}function r(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=u,a=0,c=[];for(t=0;r>t;t++)t%4===0&&t&&(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return n=r%4*6,0===n?(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)):18===n?(c.push(a>>10&255),c.push(a>>2&255)):12===n&&c.push(a>>4&255),s?new s(c):c}function o(e){var t,n,i="",r=0,o=e.length,a=u;for(t=0;o>t;t++)t%3===0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return n=o%3,0===n?(i+=a[r>>18&63],i+=a[r>>12&63], -i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}function a(e){return s&&s.isBuffer(e)}var s=e("buffer").Buffer,c=e("../type"),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new c("tag:yaml.org,2002:binary",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../type":13,buffer:30}],15:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)}function r(e){return"true"===e||"True"===e||"TRUE"===e}function o(e){return"[object Boolean]"===Object.prototype.toString.call(e)}var a=e("../type");t.exports=new a("tag:yaml.org,2002:bool",{kind:"scalar",resolve:i,construct:r,predicate:o,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";function i(e){return null===e?!1:u.test(e)?!0:!1}function r(e){var t,n,i,r;return t=e.replace(/_/g,"").toLowerCase(),n="-"===t[0]?-1:1,r=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),t=0,i=1,r.forEach(function(e){t+=e*i,i*=60}),n*t):n*parseFloat(t,10)}function o(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(s.isNegativeZero(e))return"-0.0";return n=e.toString(10),l.test(n)?n.replace("e",".e"):n}function a(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!==0||s.isNegativeZero(e))}var s=e("../common"),c=e("../type"),u=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),l=/^[-+]?[0-9]+e/;t.exports=new c("tag:yaml.org,2002:float",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o,defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";function i(e){return e>=48&&57>=e||e>=65&&70>=e||e>=97&&102>=e}function r(e){return e>=48&&55>=e}function o(e){return e>=48&&57>=e}function a(e){if(null===e)return!1;var t,n=e.length,a=0,s=!1;if(!n)return!1;if(t=e[a],("-"===t||"+"===t)&&(t=e[++a]),"0"===t){if(a+1===n)return!0;if(t=e[++a],"b"===t){for(a++;n>a;a++)if(t=e[a],"_"!==t){if("0"!==t&&"1"!==t)return!1;s=!0}return s}if("x"===t){for(a++;n>a;a++)if(t=e[a],"_"!==t){if(!i(e.charCodeAt(a)))return!1;s=!0}return s}for(;n>a;a++)if(t=e[a],"_"!==t){if(!r(e.charCodeAt(a)))return!1;s=!0}return s}for(;n>a;a++)if(t=e[a],"_"!==t){if(":"===t)break;if(!o(e.charCodeAt(a)))return!1;s=!0}return s?":"!==t?!0:/^(:[0-5]?[0-9])+$/.test(e.slice(a)):!1}function s(e){var t,n,i=e,r=1,o=[];return-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),t=i[0],("-"===t||"+"===t)&&("-"===t&&(r=-1),i=i.slice(1),t=i[0]),"0"===i?0:"0"===t?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):-1!==i.indexOf(":")?(i.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),i=0,n=1,o.forEach(function(e){i+=e*n,n*=60}),r*i):r*parseInt(i,10)}function c(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1===0&&!u.isNegativeZero(e)}var u=e("../common"),l=e("../type");t.exports=new l("tag:yaml.org,2002:int",{kind:"scalar",resolve:a,construct:s,predicate:c,represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},{"../common":2,"../type":13}],18:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;try{var t="("+e+")",n=s.parse(t,{range:!0});return"Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"FunctionExpression"!==n.body[0].expression.type?!1:!0}catch(i){return!1}}function r(e){var t,n="("+e+")",i=s.parse(n,{range:!0}),r=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){r.push(e.name)}),t=i.body[0].expression.body.range,new Function(r,n.slice(t[0]+1,t[1]-1))}function o(e){return e.toString()}function a(e){return"[object Function]"===Object.prototype.toString.call(e)}var s;try{var c=e;s=c("esprima")}catch(u){"undefined"!=typeof window&&(s=window.esprima)}var l=e("../../type");t.exports=new l("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../../type":13}],19:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),i="";if("/"===t[0]){if(n&&(i=n[1]),i.length>3)return!1;if("/"!==t[t.length-i.length-1])return!1}return!0}function r(e){var t=e,n=/\/([gim]*)$/.exec(e),i="";return"/"===t[0]&&(n&&(i=n[1]),t=t.slice(1,t.length-i.length-1)),new RegExp(t,i)}function o(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function a(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var s=e("../../type");t.exports=new s("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../../type":13}],20:[function(e,t,n){"use strict";function i(){return!0}function r(){}function o(){return""}function a(e){return"undefined"==typeof e}var s=e("../../type");t.exports=new s("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../../type":13}],21:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":13}],22:[function(e,t,n){"use strict";function i(e){return"<<"===e||null===e}var r=e("../type");t.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:i})},{"../type":13}],23:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)}function r(){return null}function o(e){return null===e}var a=e("../type");t.exports=new a("tag:yaml.org,2002:null",{kind:"scalar",resolve:i,construct:r,predicate:o,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":13}],24:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t,n,i,r,o,c=[],u=e;for(t=0,n=u.length;n>t;t+=1){if(i=u[t],o=!1,"[object Object]"!==s.call(i))return!1;for(r in i)if(a.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==c.indexOf(r))return!1;c.push(r)}return!0}function r(e){return null!==e?e:[]}var o=e("../type"),a=Object.prototype.hasOwnProperty,s=Object.prototype.toString;t.exports=new o("tag:yaml.org,2002:omap",{kind:"sequence",resolve:i,construct:r})},{"../type":13}],25:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;n>t;t+=1){if(i=s[t],"[object Object]"!==a.call(i))return!1;if(r=Object.keys(i),1!==r.length)return!1;o[t]=[r[0],i[r[0]]]}return!0}function r(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;n>t;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}var o=e("../type"),a=Object.prototype.toString;t.exports=new o("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:i,construct:r})},{"../type":13}],26:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},{"../type":13}],27:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t,n=e;for(t in n)if(a.call(n,t)&&null!==n[t])return!1;return!0}function r(e){return null!==e?e:{}}var o=e("../type"),a=Object.prototype.hasOwnProperty;t.exports=new o("tag:yaml.org,2002:set",{kind:"mapping",resolve:i,construct:r})},{"../type":13}],28:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},{"../type":13}],29:[function(e,t,n){"use strict";function i(e){return null===e?!1:null===s.exec(e)?!1:!0}function r(e){var t,n,i,r,o,a,c,u,l,p,f=0,h=null;if(t=s.exec(e),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],c=+t[6],t[7]){for(f=t[7].slice(0,3);f.length<3;)f+="0";f=+f}return t[9]&&(u=+t[10],l=+(t[11]||0),h=6e4*(60*u+l),"-"===t[9]&&(h=-h)),p=new Date(Date.UTC(n,i,r,o,a,c,f)),h&&p.setTime(p.getTime()-h),p}function o(e){return e.toISOString()}var a=e("../type"),s=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");t.exports=new a("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:i,construct:r,instanceOf:Date,represent:o})},{"../type":13}],30:[function(e,t,n){},{}],"/":[function(e,t,n){"use strict";var i=e("./lib/js-yaml.js");t.exports=i},{"./lib/js-yaml.js":1}]},{},[])("/")}); +/* js-yaml 3.5.5 https://github.com/nodeca/js-yaml */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.jsyaml=e()}}(function(){return function e(t,n,i){function r(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return r(n?n:e)},l,l.exports,e,t,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;an;n+=1)r=o[n],e[r]=t[r];return e}function s(e,t){var n,i="";for(n=0;t>n;n+=1)i+=e;return i}function c(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e}t.exports.isNothing=i,t.exports.isObject=r,t.exports.toArray=o,t.exports.repeat=s,t.exports.isNegativeZero=c,t.exports.extend=a},{}],3:[function(e,t,n){"use strict";function i(e,t){var n,i,r,o,a,s,c;if(null===t)return{};for(n={},i=Object.keys(t),r=0,o=i.length;o>r;r+=1)a=i[r],s=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),c=e.compiledTypeMap[a],c&&F.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[a]=s;return n}function r(e){var t,n,i;if(t=e.toString(16).toUpperCase(),255>=e)n="x",i=2;else if(65535>=e)n="u",i=4;else{if(!(4294967295>=e))throw new I("code point within a string may not be greater than 0xFFFFFFFF");n="U",i=8}return"\\"+n+j.repeat("0",i-t.length)+t}function o(e){this.schema=e.schema||S,this.indent=Math.max(1,e.indent||2),this.skipInvalid=e.skipInvalid||!1,this.flowLevel=j.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=i(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function a(e,t){for(var n,i=j.repeat(" ",t),r=0,o=-1,a="",s=e.length;s>r;)o=e.indexOf("\n",r),-1===o?(n=e.slice(r),r=s):(n=e.slice(r,o+1),r=o+1),n.length&&"\n"!==n&&(a+=i),a+=n;return a}function s(e,t){return"\n"+j.repeat(" ",e.indent*t)}function c(e,t){var n,i,r;for(n=0,i=e.implicitTypes.length;i>n;n+=1)if(r=e.implicitTypes[n],r.resolve(t))return!0;return!1}function u(e){this.source=e,this.result="",this.checkpoint=0}function l(e,t,n,i){var r,o,s,l,f,m,g,y,x,v,A,b,w,C,k,j,I,S,E,O,F;if(0===t.length)return void(e.dump="''");if(!e.noCompatMode&&-1!==te.indexOf(t))return void(e.dump="'"+t+"'");for(r=!0,o=t.length?t.charCodeAt(0):0,s=M===o||M===t.charCodeAt(t.length-1),P!==o&&W!==o&&G!==o&&z!==o||(r=!1),s||e.flowLevel>-1&&e.flowLevel<=n?(s&&(r=!1),l=!1,f=!1):(l=!i,f=!i),m=!0,g=new u(t),y=!1,x=0,v=0,A=e.indent*n,b=e.lineWidth,-1===b&&(b=9007199254740991),40>A?b-=A:b=40,C=0;C0&&(I=t.charCodeAt(C-1),I===M&&(f=!1,l=!1)),l&&(S=C-x,x=C,S>v&&(v=S))),w!==D&&(m=!1),g.takeUpTo(C),g.escapeChar())}if(r&&c(e,t)&&(r=!1),E="",(l||f)&&(O=0,t.charCodeAt(t.length-1)===T&&(O+=1,t.charCodeAt(t.length-2)===T&&(O+=1)),0===O?E="-":2===O&&(E="+")),(f&&b>v||null!==e.tag)&&(l=!1),y||(f=!1),r)e.dump=t;else if(m)e.dump="'"+t+"'";else if(l)F=p(t,b),e.dump=">"+E+"\n"+a(F,A);else if(f)E||(t=t.replace(/\n$/,"")),e.dump="|"+E+"\n"+a(t,A);else{if(!g)throw new Error("Failed to dump scalar value");g.finish(),e.dump='"'+g.result+'"'}}function p(e,t){var n,i="",r=0,o=e.length,a=/\n+$/.exec(e);for(a&&(o=a.index+1);o>r;)n=e.indexOf("\n",r),n>o||-1===n?(i&&(i+="\n\n"),i+=f(e.slice(r,o),t),r=o):(i&&(i+="\n\n"),i+=f(e.slice(r,n),t),r=n+1);return a&&"\n"!==a[0]&&(i+=a[0]),i}function f(e,t){if(""===e)return e;for(var n,i,r,o=/[^\s] [^\s]/g,a="",s=0,c=0,u=o.exec(e);u;)n=u.index,n-c>t&&(i=s!==c?s:n,a&&(a+="\n"),r=e.slice(c,i),a+=r,c=i+1),s=n+1,u=o.exec(e);return a&&(a+="\n"),a+=c!==s&&e.length-c>t?e.slice(c,s)+"\n"+e.slice(s+1):e.slice(c)}function h(e){return N!==e&&T!==e&&_!==e&&B!==e&&V!==e&&Z!==e&&J!==e&&X!==e&&U!==e&&Y!==e&&$!==e&&L!==e&&Q!==e&&H!==e&&R!==e&&D!==e&&q!==e&&K!==e&&!ee[e]&&!d(e)}function d(e){return!(e>=32&&126>=e||133===e||e>=160&&55295>=e||e>=57344&&65533>=e||e>=65536&&1114111>=e)}function m(e,t,n){var i,r,o="",a=e.tag;for(i=0,r=n.length;r>i;i+=1)A(e,t,n[i],!1,!1)&&(0!==i&&(o+=", "),o+=e.dump);e.tag=a,e.dump="["+o+"]"}function g(e,t,n,i){var r,o,a="",c=e.tag;for(r=0,o=n.length;o>r;r+=1)A(e,t+1,n[r],!0,!0)&&(i&&0===r||(a+=s(e,t)),a+="- "+e.dump);e.tag=c,e.dump=a||"[]"}function y(e,t,n){var i,r,o,a,s,c="",u=e.tag,l=Object.keys(n);for(i=0,r=l.length;r>i;i+=1)s="",0!==i&&(s+=", "),o=l[i],a=n[o],A(e,t,o,!1,!1)&&(e.dump.length>1024&&(s+="? "),s+=e.dump+": ",A(e,t,a,!1,!1)&&(s+=e.dump,c+=s));e.tag=u,e.dump="{"+c+"}"}function x(e,t,n,i){var r,o,a,c,u,l,p="",f=e.tag,h=Object.keys(n);if(e.sortKeys===!0)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new I("sortKeys must be a boolean or a function");for(r=0,o=h.length;o>r;r+=1)l="",i&&0===r||(l+=s(e,t)),a=h[r],c=n[a],A(e,t+1,a,!0,!0,!0)&&(u=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024,u&&(l+=e.dump&&T===e.dump.charCodeAt(0)?"?":"? "),l+=e.dump,u&&(l+=s(e,t)),A(e,t+1,c,!0,u)&&(l+=e.dump&&T===e.dump.charCodeAt(0)?":":": ",l+=e.dump,p+=l));e.tag=f,e.dump=p||"{}"}function v(e,t,n){var i,r,o,a,s,c;for(r=n?e.explicitTypes:e.implicitTypes,o=0,a=r.length;a>o;o+=1)if(s=r[o],(s.instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(e.tag=n?s.tag:"?",s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===O.call(s.represent))i=s.represent(t,c);else{if(!F.call(s.represent,c))throw new I("!<"+s.tag+'> tag resolver accepts not "'+c+'" style');i=s.represent[c](t,c)}e.dump=i}return!0}return!1}function A(e,t,n,i,r,o){e.tag=null,e.dump=n,v(e,n,!1)||v(e,n,!0);var a=O.call(e.dump);i&&(i=e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(s=e.duplicates.indexOf(n),c=-1!==s),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(r=!1),c&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(u&&c&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)i&&0!==Object.keys(e.dump).length?(x(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(y(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a)i&&0!==e.dump.length?(g(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(m(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new I("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&l(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function b(e,t){var n,i,r=[],o=[];for(w(e,r,o),n=0,i=o.length;i>n;n+=1)t.duplicates.push(r[o[n]]);t.usedDuplicates=new Array(i)}function w(e,t,n){var i,r,o;if(null!==e&&"object"==typeof e)if(r=t.indexOf(e),-1!==r)-1===n.indexOf(r)&&n.push(r);else if(t.push(e),Array.isArray(e))for(r=0,o=e.length;o>r;r+=1)w(e[r],t,n);else for(i=Object.keys(e),r=0,o=i.length;o>r;r+=1)w(e[i[r]],t,n)}function C(e,t){t=t||{};var n=new o(t);return n.noRefs||b(e,n),A(n,0,e,!0,!0)?n.dump+"\n":""}function k(e,t){return C(e,j.extend({schema:E},t))}var j=e("./common"),I=e("./exception"),S=e("./schema/default_full"),E=e("./schema/default_safe"),O=Object.prototype.toString,F=Object.prototype.hasOwnProperty,N=9,T=10,_=13,M=32,L=33,D=34,U=35,q=37,Y=38,R=39,$=42,B=44,P=45,K=58,H=62,W=63,G=64,V=91,Z=93,z=96,J=123,Q=124,X=125,ee={};ee[0]="\\0",ee[7]="\\a",ee[8]="\\b",ee[9]="\\t",ee[10]="\\n",ee[11]="\\v",ee[12]="\\f",ee[13]="\\r",ee[27]="\\e",ee[34]='\\"',ee[92]="\\\\",ee[133]="\\N",ee[160]="\\_",ee[8232]="\\L",ee[8233]="\\P";var te=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];u.prototype.takeUpTo=function(e){var t;if(e checkpoint"),t.position=e,t.checkpoint=this.checkpoint,t;return this.result+=this.source.slice(this.checkpoint,e),this.checkpoint=e,this},u.prototype.escapeChar=function(){var e,t;return e=this.source.charCodeAt(this.checkpoint),t=ee[e]||r(e),this.result+=t,this.checkpoint+=1,this},u.prototype.finish=function(){this.source.length>this.checkpoint&&this.takeUpTo(this.source.length)},t.exports.dump=C,t.exports.safeDump=k},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(e,t,n){"use strict";function i(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},t.exports=i},{}],5:[function(e,t,n){"use strict";function i(e){return 10===e||13===e}function r(e){return 9===e||32===e}function o(e){return 9===e||32===e||10===e||13===e}function a(e){return 44===e||91===e||93===e||123===e||125===e}function s(e){var t;return e>=48&&57>=e?e-48:(t=32|e,t>=97&&102>=t?t-97+10:-1)}function c(e){return 120===e?2:117===e?4:85===e?8:0}function u(e){return e>=48&&57>=e?e-48:-1}function l(e){return 48===e?"\x00":97===e?"":98===e?"\b":116===e?" ":9===e?" ":110===e?"\n":118===e?"\x0B":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function p(e){return 65535>=e?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function f(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function h(e,t){return new $(t,new B(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function d(e,t){throw h(e,t)}function m(e,t){e.onWarning&&e.onWarning.call(null,h(e,t))}function g(e,t,n,i){var r,o,a,s;if(n>t){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;o>r;r+=1)a=s.charCodeAt(r),9===a||a>=32&&1114111>=a||d(e,"expected valid JSON character");else X.test(s)&&d(e,"the stream contains non-printable characters");e.result+=s}}function y(e,t,n,i){var r,o,a,s;for(R.isObject(n)||d(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(n),a=0,s=r.length;s>a;a+=1)o=r[a],H.call(t,o)||(t[o]=n[o],i[o]=!0)}function x(e,t,n,i,r,o){var a,s;if(r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(a=0,s=o.length;s>a;a+=1)y(e,t,o[a],n);else y(e,t,o,n);else e.json||H.call(n,r)||!H.call(t,r)||d(e,"duplicated mapping key"),t[r]=o,delete n[r];return t}function v(e){var t;t=e.input.charCodeAt(e.position),10===t?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):d(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function A(e,t,n){for(var o=0,a=e.input.charCodeAt(e.position);0!==a;){for(;r(a);)a=e.input.charCodeAt(++e.position);if(t&&35===a)do a=e.input.charCodeAt(++e.position);while(10!==a&&13!==a&&0!==a);if(!i(a))break;for(v(e),a=e.input.charCodeAt(e.position),o++,e.lineIndent=0;32===a;)e.lineIndent++,a=e.input.charCodeAt(++e.position)}return-1!==n&&0!==o&&e.lineIndent1&&(e.result+=R.repeat("\n",t-1))}function C(e,t,n){var s,c,u,l,p,f,h,d,m,y=e.kind,x=e.result;if(m=e.input.charCodeAt(e.position),o(m)||a(m)||35===m||38===m||42===m||33===m||124===m||62===m||39===m||34===m||37===m||64===m||96===m)return!1;if((63===m||45===m)&&(c=e.input.charCodeAt(e.position+1),o(c)||n&&a(c)))return!1;for(e.kind="scalar",e.result="",u=l=e.position,p=!1;0!==m;){if(58===m){if(c=e.input.charCodeAt(e.position+1),o(c)||n&&a(c))break}else if(35===m){if(s=e.input.charCodeAt(e.position-1),o(s))break}else{if(e.position===e.lineStart&&b(e)||n&&a(m))break;if(i(m)){if(f=e.line,h=e.lineStart,d=e.lineIndent,A(e,!1,-1),e.lineIndent>=t){p=!0,m=e.input.charCodeAt(e.position);continue}e.position=l,e.line=f,e.lineStart=h,e.lineIndent=d;break}}p&&(g(e,u,l,!1),w(e,e.line-f),u=l=e.position,p=!1),r(m)||(l=e.position+1),m=e.input.charCodeAt(++e.position)}return g(e,u,l,!1),e.result?!0:(e.kind=y,e.result=x,!1)}function k(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),39!==n)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(g(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),39!==n)return!0;r=o=e.position,e.position++}else i(n)?(g(e,r,o,!0),w(e,A(e,!1,t)),r=o=e.position):e.position===e.lineStart&&b(e)?d(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);d(e,"unexpected end of the stream within a single quoted scalar")}function j(e,t){var n,r,o,a,u,l;if(l=e.input.charCodeAt(e.position),34!==l)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;0!==(l=e.input.charCodeAt(e.position));){if(34===l)return g(e,n,e.position,!0),e.position++,!0;if(92===l){if(g(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),i(l))A(e,!1,t);else if(256>l&&re[l])e.result+=oe[l],e.position++;else if((u=c(l))>0){for(o=u,a=0;o>0;o--)l=e.input.charCodeAt(++e.position),(u=s(l))>=0?a=(a<<4)+u:d(e,"expected hexadecimal character");e.result+=p(a),e.position++}else d(e,"unknown escape sequence");n=r=e.position}else i(l)?(g(e,n,r,!0),w(e,A(e,!1,t)),n=r=e.position):e.position===e.lineStart&&b(e)?d(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}d(e,"unexpected end of the stream within a double quoted scalar")}function I(e,t){var n,i,r,a,s,c,u,l,p,f,h,m=!0,g=e.tag,y=e.anchor,v={};if(h=e.input.charCodeAt(e.position),91===h)a=93,u=!1,i=[];else{if(123!==h)return!1;a=125,u=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),h=e.input.charCodeAt(++e.position);0!==h;){if(A(e,!0,t),h=e.input.charCodeAt(e.position),h===a)return e.position++,e.tag=g,e.anchor=y,e.kind=u?"mapping":"sequence",e.result=i,!0;m||d(e,"missed comma between flow collection entries"),p=l=f=null,s=c=!1,63===h&&(r=e.input.charCodeAt(e.position+1),o(r)&&(s=c=!0,e.position++,A(e,!0,t))),n=e.line,_(e,t,W,!1,!0),p=e.tag,l=e.result,A(e,!0,t),h=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==h||(s=!0,h=e.input.charCodeAt(++e.position),A(e,!0,t),_(e,t,W,!1,!0),f=e.result),u?x(e,i,v,p,l,f):s?i.push(x(e,null,v,p,l,f)):i.push(l),A(e,!0,t),h=e.input.charCodeAt(e.position),44===h?(m=!0,h=e.input.charCodeAt(++e.position)):m=!1}d(e,"unexpected end of the stream within a flow collection")}function S(e,t){var n,o,a,s,c=z,l=!1,p=t,f=0,h=!1;if(s=e.input.charCodeAt(e.position),124===s)o=!1;else{if(62!==s)return!1;o=!0}for(e.kind="scalar",e.result="";0!==s;)if(s=e.input.charCodeAt(++e.position),43===s||45===s)z===c?c=43===s?Q:J:d(e,"repeat of a chomping mode identifier");else{if(!((a=u(s))>=0))break;0===a?d(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?d(e,"repeat of an indentation width identifier"):(p=t+a-1,l=!0)}if(r(s)){do s=e.input.charCodeAt(++e.position);while(r(s));if(35===s)do s=e.input.charCodeAt(++e.position);while(!i(s)&&0!==s)}for(;0!==s;){for(v(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!l||e.lineIndentp&&(p=e.lineIndent),i(s))f++;else{if(e.lineIndentt)&&0!==r)d(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(_(e,t,Z,!0,a)&&(y?m=e.result:g=e.result),y||(x(e,p,f,h,m,g),h=m=g=null),A(e,!0,-1),c=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==c)d(e,"bad indentation of a mapping entry");else if(e.lineIndentt?h=1:e.lineIndent===t?h=0:e.lineIndentt?h=1:e.lineIndent===t?h=0:e.lineIndentc;c+=1)if(l=e.implicitTypes[c],l.resolve(e.result)){e.result=l.construct(e.result),e.tag=l.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else H.call(e.typeMap,e.tag)?(l=e.typeMap[e.tag],null!==e.result&&l.kind!==e.kind&&d(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):d(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):d(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||g}function M(e){var t,n,a,s,c=e.position,u=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(s=e.input.charCodeAt(e.position))&&(A(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(u=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(t,e.position),a=[],n.length<1&&d(e,"directive name must not be less than one character in length");0!==s;){for(;r(s);)s=e.input.charCodeAt(++e.position);if(35===s){do s=e.input.charCodeAt(++e.position);while(0!==s&&!i(s));break}if(i(s))break;for(t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==s&&v(e),H.call(se,n)?se[n](e,n,a):m(e,'unknown document directive "'+n+'"')}return A(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,A(e,!0,-1)):u&&d(e,"directives end mark is expected"),_(e,e.lineIndent-1,Z,!1,!0),A(e,!0,-1),e.checkLineBreaks&&ee.test(e.input.slice(c,e.position))&&m(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&b(e)?void(46===e.input.charCodeAt(e.position)&&(e.position+=3,A(e,!0,-1))):void(e.positioni;i+=1)t(o[i])}function U(e,t){var n=L(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new $("expected a single document in the stream, but found more")}}function q(e,t,n){D(e,t,R.extend({schema:P},n))}function Y(e,t){return U(e,R.extend({schema:P},t))}for(var R=e("./common"),$=e("./exception"),B=e("./mark"),P=e("./schema/default_safe"),K=e("./schema/default_full"),H=Object.prototype.hasOwnProperty,W=1,G=2,V=3,Z=4,z=1,J=2,Q=3,X=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ee=/[\x85\u2028\u2029]/,te=/[,\[\]\{\}]/,ne=/^(?:!|!!|![a-z\-]+!)$/i,ie=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i,re=new Array(256),oe=new Array(256),ae=0;256>ae;ae++)re[ae]=l(ae)?1:0,oe[ae]=l(ae);var se={YAML:function(e,t,n){var i,r,o;null!==e.version&&d(e,"duplication of %YAML directive"),1!==n.length&&d(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),null===i&&d(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&d(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=2>o,1!==o&&2!==o&&m(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&d(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],ne.test(i)||d(e,"ill-formed tag handle (first argument) of the TAG directive"),H.call(e.tagMap,i)&&d(e,'there is a previously declared suffix for "'+i+'" tag handle'),ie.test(r)||d(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[i]=r}};t.exports.loadAll=D,t.exports.load=U,t.exports.safeLoadAll=q,t.exports.safeLoad=Y},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(e,t,n){"use strict";function i(e,t,n,i,r){this.name=e,this.buffer=t,this.position=n,this.line=i,this.column=r}var r=e("./common");i.prototype.getSnippet=function(e,t){var n,i,o,a,s;if(!this.buffer)return null;for(e=e||4,t=t||75,n="",i=this.position;i>0&&-1==="\x00\r\n…\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>t/2-1){n=" ... ",i+=5;break}for(o="",a=this.position;at/2-1){o=" ... ",a-=5;break}return s=this.buffer.slice(i,a),r.repeat(" ",e)+n+s+o+"\n"+r.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet(),t&&(n+=":\n"+t)),n},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";function i(e,t,n){var r=[];return e.include.forEach(function(e){n=i(e,t,n)}),e[t].forEach(function(e){n.forEach(function(t,n){t.tag===e.tag&&r.push(n)}),n.push(e)}),n.filter(function(e,t){return-1===r.indexOf(t)})}function r(){function e(e){i[e.tag]=e}var t,n,i={};for(t=0,n=arguments.length;n>t;t+=1)arguments[t].forEach(e);return i}function o(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=i(this,"implicit",[]),this.compiledExplicit=i(this,"explicit",[]),this.compiledTypeMap=r(this.compiledImplicit,this.compiledExplicit)}var a=e("./common"),s=e("./exception"),c=e("./type");o.DEFAULT=null,o.create=function(){var e,t;switch(arguments.length){case 1:e=o.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new s("Wrong number of arguments for Schema.create function")}if(e=a.toArray(e),t=a.toArray(t),!e.every(function(e){return e instanceof o}))throw new s("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every(function(e){return e instanceof c}))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new o({include:e,explicit:t})},t.exports=o},{"./common":2,"./exception":4,"./type":13}],8:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./json")]})},{"../schema":7,"./json":12}],9:[function(e,t,n){"use strict";var i=e("../schema");t.exports=i.DEFAULT=new i({include:[e("./default_safe")],explicit:[e("../type/js/undefined"),e("../type/js/regexp"),e("../type/js/function")]})},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./core")],implicit:[e("../type/timestamp"),e("../type/merge")],explicit:[e("../type/binary"),e("../type/omap"),e("../type/pairs"),e("../type/set")]})},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({explicit:[e("../type/str"),e("../type/seq"),e("../type/map")]})},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./failsafe")],implicit:[e("../type/null"),e("../type/bool"),e("../type/int"),e("../type/float")]})},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(e,t,n){"use strict";function i(e){var t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function r(e,t){if(t=t||{},Object.keys(t).forEach(function(t){if(-1===a.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=i(t.styleAliases||null),-1===s.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var o=e("./exception"),a=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],s=["scalar","sequence","mapping"];t.exports=r},{"./exception":4}],14:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=u;for(n=0;r>n;n++)if(t=o.indexOf(e.charAt(n)),!(t>64)){if(0>t)return!1;i+=6}return i%8===0}function r(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=u,a=0,c=[];for(t=0;r>t;t++)t%4===0&&t&&(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return n=r%4*6,0===n?(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)):18===n?(c.push(a>>10&255),c.push(a>>2&255)):12===n&&c.push(a>>4&255),s?new s(c):c}function o(e){var t,n,i="",r=0,o=e.length,a=u;for(t=0;o>t;t++)t%3===0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return n=o%3, +0===n?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}function a(e){return s&&s.isBuffer(e)}var s=e("buffer").Buffer,c=e("../type"),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new c("tag:yaml.org,2002:binary",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../type":13,buffer:30}],15:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)}function r(e){return"true"===e||"True"===e||"TRUE"===e}function o(e){return"[object Boolean]"===Object.prototype.toString.call(e)}var a=e("../type");t.exports=new a("tag:yaml.org,2002:bool",{kind:"scalar",resolve:i,construct:r,predicate:o,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";function i(e){return null===e?!1:!!u.test(e)}function r(e){var t,n,i,r;return t=e.replace(/_/g,"").toLowerCase(),n="-"===t[0]?-1:1,r=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),t=0,i=1,r.forEach(function(e){t+=e*i,i*=60}),n*t):n*parseFloat(t,10)}function o(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(s.isNegativeZero(e))return"-0.0";return n=e.toString(10),l.test(n)?n.replace("e",".e"):n}function a(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!==0||s.isNegativeZero(e))}var s=e("../common"),c=e("../type"),u=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),l=/^[-+]?[0-9]+e/;t.exports=new c("tag:yaml.org,2002:float",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o,defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";function i(e){return e>=48&&57>=e||e>=65&&70>=e||e>=97&&102>=e}function r(e){return e>=48&&55>=e}function o(e){return e>=48&&57>=e}function a(e){if(null===e)return!1;var t,n=e.length,a=0,s=!1;if(!n)return!1;if(t=e[a],"-"!==t&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===n)return!0;if(t=e[++a],"b"===t){for(a++;n>a;a++)if(t=e[a],"_"!==t){if("0"!==t&&"1"!==t)return!1;s=!0}return s}if("x"===t){for(a++;n>a;a++)if(t=e[a],"_"!==t){if(!i(e.charCodeAt(a)))return!1;s=!0}return s}for(;n>a;a++)if(t=e[a],"_"!==t){if(!r(e.charCodeAt(a)))return!1;s=!0}return s}for(;n>a;a++)if(t=e[a],"_"!==t){if(":"===t)break;if(!o(e.charCodeAt(a)))return!1;s=!0}return s?":"!==t?!0:/^(:[0-5]?[0-9])+$/.test(e.slice(a)):!1}function s(e){var t,n,i=e,r=1,o=[];return-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),t=i[0],"-"!==t&&"+"!==t||("-"===t&&(r=-1),i=i.slice(1),t=i[0]),"0"===i?0:"0"===t?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):-1!==i.indexOf(":")?(i.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),i=0,n=1,o.forEach(function(e){i+=e*n,n*=60}),r*i):r*parseInt(i,10)}function c(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1===0&&!u.isNegativeZero(e)}var u=e("../common"),l=e("../type");t.exports=new l("tag:yaml.org,2002:int",{kind:"scalar",resolve:a,construct:s,predicate:c,represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},{"../common":2,"../type":13}],18:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;try{var t="("+e+")",n=s.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&"FunctionExpression"===n.body[0].expression.type}catch(i){return!1}}function r(e){var t,n="("+e+")",i=s.parse(n,{range:!0}),r=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){r.push(e.name)}),t=i.body[0].expression.body.range,new Function(r,n.slice(t[0]+1,t[1]-1))}function o(e){return e.toString()}function a(e){return"[object Function]"===Object.prototype.toString.call(e)}var s;try{var c=e;s=c("esprima")}catch(u){"undefined"!=typeof window&&(s=window.esprima)}var l=e("../../type");t.exports=new l("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../../type":13}],19:[function(e,t,n){"use strict";function i(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),i="";if("/"===t[0]){if(n&&(i=n[1]),i.length>3)return!1;if("/"!==t[t.length-i.length-1])return!1}return!0}function r(e){var t=e,n=/\/([gim]*)$/.exec(e),i="";return"/"===t[0]&&(n&&(i=n[1]),t=t.slice(1,t.length-i.length-1)),new RegExp(t,i)}function o(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function a(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var s=e("../../type");t.exports=new s("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../../type":13}],20:[function(e,t,n){"use strict";function i(){return!0}function r(){}function o(){return""}function a(e){return"undefined"==typeof e}var s=e("../../type");t.exports=new s("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:i,construct:r,predicate:a,represent:o})},{"../../type":13}],21:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":13}],22:[function(e,t,n){"use strict";function i(e){return"<<"===e||null===e}var r=e("../type");t.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:i})},{"../type":13}],23:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)}function r(){return null}function o(e){return null===e}var a=e("../type");t.exports=new a("tag:yaml.org,2002:null",{kind:"scalar",resolve:i,construct:r,predicate:o,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":13}],24:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t,n,i,r,o,c=[],u=e;for(t=0,n=u.length;n>t;t+=1){if(i=u[t],o=!1,"[object Object]"!==s.call(i))return!1;for(r in i)if(a.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==c.indexOf(r))return!1;c.push(r)}return!0}function r(e){return null!==e?e:[]}var o=e("../type"),a=Object.prototype.hasOwnProperty,s=Object.prototype.toString;t.exports=new o("tag:yaml.org,2002:omap",{kind:"sequence",resolve:i,construct:r})},{"../type":13}],25:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;n>t;t+=1){if(i=s[t],"[object Object]"!==a.call(i))return!1;if(r=Object.keys(i),1!==r.length)return!1;o[t]=[r[0],i[r[0]]]}return!0}function r(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;n>t;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}var o=e("../type"),a=Object.prototype.toString;t.exports=new o("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:i,construct:r})},{"../type":13}],26:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},{"../type":13}],27:[function(e,t,n){"use strict";function i(e){if(null===e)return!0;var t,n=e;for(t in n)if(a.call(n,t)&&null!==n[t])return!1;return!0}function r(e){return null!==e?e:{}}var o=e("../type"),a=Object.prototype.hasOwnProperty;t.exports=new o("tag:yaml.org,2002:set",{kind:"mapping",resolve:i,construct:r})},{"../type":13}],28:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},{"../type":13}],29:[function(e,t,n){"use strict";function i(e){return null===e?!1:null!==s.exec(e)?!0:null!==c.exec(e)}function r(e){var t,n,i,r,o,a,u,l,p,f,h=0,d=null;if(t=s.exec(e),null===t&&(t=c.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],u=+t[6],t[7]){for(h=t[7].slice(0,3);h.length<3;)h+="0";h=+h}return t[9]&&(l=+t[10],p=+(t[11]||0),d=6e4*(60*l+p),"-"===t[9]&&(d=-d)),f=new Date(Date.UTC(n,i,r,o,a,u,h)),d&&f.setTime(f.getTime()-d),f}function o(e){return e.toISOString()}var a=e("../type"),s=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),c=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new a("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:i,construct:r,instanceOf:Date,represent:o})},{"../type":13}],30:[function(e,t,n){},{}],"/":[function(e,t,n){"use strict";var i=e("./lib/js-yaml.js");t.exports=i},{"./lib/js-yaml.js":1}]},{},[])("/")}); diff --git a/tools/eslint/node_modules/js-yaml/lib/js-yaml/dumper.js b/tools/eslint/node_modules/js-yaml/lib/js-yaml/dumper.js index 043d2bb47da7a8..855edfc9e63c3c 100644 --- a/tools/eslint/node_modules/js-yaml/lib/js-yaml/dumper.js +++ b/tools/eslint/node_modules/js-yaml/lib/js-yaml/dumper.js @@ -107,14 +107,15 @@ function encodeHex(character) { } function State(options) { - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.indent = Math.max(1, (options['indent'] || 2)); - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; this.implicitTypes = this.schema.compiledImplicit; this.explicitTypes = this.schema.compiledExplicit; @@ -219,7 +220,8 @@ function writeScalar(state, object, level, iskey) { return; } - if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(object) !== -1) { + if (!state.noCompatMode && + DEPRECATED_BOOLEANS_SYNTAX.indexOf(object) !== -1) { state.dump = "'" + object + "'"; return; } diff --git a/tools/eslint/node_modules/js-yaml/lib/js-yaml/type/timestamp.js b/tools/eslint/node_modules/js-yaml/lib/js-yaml/type/timestamp.js index a222a449ba3375..8fa9c5865697ed 100644 --- a/tools/eslint/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +++ b/tools/eslint/node_modules/js-yaml/lib/js-yaml/type/timestamp.js @@ -2,29 +2,36 @@ var Type = require('../type'); +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + var YAML_TIMESTAMP_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9]?)' + // [2] month '-([0-9][0-9]?)' + // [3] day - '(?:(?:[Tt]|[ \\t]+)' + // ... + '(?:[Tt]|[ \\t]+)' + // ... '([0-9][0-9]?)' + // [4] hour ':([0-9][0-9])' + // [5] minute ':([0-9][0-9])' + // [6] second '(?:\\.([0-9]*))?' + // [7] fraction '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute function resolveYamlTimestamp(data) { if (data === null) return false; - if (YAML_TIMESTAMP_REGEXP.exec(data) === null) return false; - return true; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; } function constructYamlTimestamp(data) { var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date; - match = YAML_TIMESTAMP_REGEXP.exec(data); + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); if (match === null) throw new Error('Date resolve error'); diff --git a/tools/eslint/node_modules/js-yaml/package.json b/tools/eslint/node_modules/js-yaml/package.json index 3c1fed557f87af..f55dd462312d24 100644 --- a/tools/eslint/node_modules/js-yaml/package.json +++ b/tools/eslint/node_modules/js-yaml/package.json @@ -2,18 +2,18 @@ "_args": [ [ "js-yaml@^3.5.1", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "js-yaml@>=3.5.1 <4.0.0", - "_id": "js-yaml@3.5.3", + "_id": "js-yaml@3.5.5", "_inCache": true, "_installable": true, - "_location": "/eslint/js-yaml", + "_location": "/js-yaml", "_nodeVersion": "4.3.0", "_npmOperationalInternal": { - "host": "packages-5-east.internal.npmjs.com", - "tmp": "tmp/js-yaml-3.5.3.tgz_1455175645225_0.033302413299679756" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/js-yaml-3.5.5.tgz_1458226126775_0.5821511475369334" }, "_npmUser": { "email": "vitaly@rcdesign.ru", @@ -30,13 +30,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], - "_resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.3.tgz", - "_shasum": "e9ee6082b0657770e4346dfaf2a58c5992251f76", + "_resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", + "_shasum": "0377c38017cabc7322b0d1fbcd25a491641f2fbe", "_shrinkwrap": null, "_spec": "js-yaml@^3.5.1", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "dervus.grim@gmail.com", "name": "Vladimir Zapparov" @@ -52,18 +52,18 @@ }, "contributors": [ { - "email": "ixti@member.fsf.org", "name": "Aleksey V Zapparov", + "email": "ixti@member.fsf.org", "url": "http://www.ixti.net/" }, { - "email": "vitaly@rcdesign.ru", "name": "Vitaly Puzrin", + "email": "vitaly@rcdesign.ru", "url": "https://github.com/puzrin" }, { - "email": "martin.grenfell@gmail.com", "name": "Martin Grenfell", + "email": "martin.grenfell@gmail.com", "url": "http://got-ravings.blogspot.com" } ], @@ -84,28 +84,28 @@ }, "directories": {}, "dist": { - "shasum": "e9ee6082b0657770e4346dfaf2a58c5992251f76", - "tarball": "http://registry.npmjs.org/js-yaml/-/js-yaml-3.5.3.tgz" + "shasum": "0377c38017cabc7322b0d1fbcd25a491641f2fbe", + "tarball": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz" }, "files": [ - "index.js", - "lib/", "bin/", - "dist/" + "dist/", + "index.js", + "lib/" ], - "gitHead": "4a9e0a258586cff292cab63e0b76044fc1f4cb63", + "gitHead": "fdd205e5a1175a62868c0efb28a77493e5e34e3f", "homepage": "https://github.com/nodeca/js-yaml", "keywords": [ - "yaml", "parser", + "pyyaml", "serializer", - "pyyaml" + "yaml" ], "license": "MIT", "maintainers": [ { - "email": "vitaly@rcdesign.ru", - "name": "vitaly" + "name": "vitaly", + "email": "vitaly@rcdesign.ru" } ], "name": "js-yaml", @@ -118,5 +118,5 @@ "scripts": { "test": "make test" }, - "version": "3.5.3" + "version": "3.5.5" } diff --git a/tools/eslint/node_modules/json-stable-stringify/.npmignore b/tools/eslint/node_modules/json-stable-stringify/.npmignore deleted file mode 100644 index 3c3629e647f5dd..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/tools/eslint/node_modules/json-stable-stringify/.travis.yml b/tools/eslint/node_modules/json-stable-stringify/.travis.yml deleted file mode 100644 index cc4dba29d959a2..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/tools/eslint/node_modules/json-stable-stringify/example/key_cmp.js b/tools/eslint/node_modules/json-stable-stringify/example/key_cmp.js deleted file mode 100644 index d5f66752d82e15..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/example/key_cmp.js +++ /dev/null @@ -1,7 +0,0 @@ -var stringify = require('../'); - -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; -}); -console.log(s); diff --git a/tools/eslint/node_modules/json-stable-stringify/example/nested.js b/tools/eslint/node_modules/json-stable-stringify/example/nested.js deleted file mode 100644 index 9a672fc65fb0fc..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/example/nested.js +++ /dev/null @@ -1,3 +0,0 @@ -var stringify = require('../'); -var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; -console.log(stringify(obj)); diff --git a/tools/eslint/node_modules/json-stable-stringify/example/str.js b/tools/eslint/node_modules/json-stable-stringify/example/str.js deleted file mode 100644 index 9b4b3cd289570e..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/example/str.js +++ /dev/null @@ -1,3 +0,0 @@ -var stringify = require('../'); -var obj = { c: 6, b: [4,5], a: 3 }; -console.log(stringify(obj)); diff --git a/tools/eslint/node_modules/json-stable-stringify/example/value_cmp.js b/tools/eslint/node_modules/json-stable-stringify/example/value_cmp.js deleted file mode 100644 index 09f1c5f79b2167..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/example/value_cmp.js +++ /dev/null @@ -1,7 +0,0 @@ -var stringify = require('../'); - -var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; -var s = stringify(obj, function (a, b) { - return a.value < b.value ? 1 : -1; -}); -console.log(s); diff --git a/tools/eslint/node_modules/json-stable-stringify/package.json b/tools/eslint/node_modules/json-stable-stringify/package.json index 7f0b68340d0d85..47b386a47e84be 100644 --- a/tools/eslint/node_modules/json-stable-stringify/package.json +++ b/tools/eslint/node_modules/json-stable-stringify/package.json @@ -2,14 +2,14 @@ "_args": [ [ "json-stable-stringify@^1.0.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "json-stable-stringify@>=1.0.0 <2.0.0", "_id": "json-stable-stringify@1.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/json-stable-stringify", + "_location": "/json-stable-stringify", "_nodeVersion": "4.2.1", "_npmOperationalInternal": { "host": "packages-5-east.internal.npmjs.com", @@ -30,13 +30,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", "_shasum": "9a759d39c5f2ff503fd5300646ed445f88c4f9af", "_shrinkwrap": null, "_spec": "json-stable-stringify@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "mail@substack.net", "name": "James Halliday", @@ -55,24 +55,24 @@ "directories": {}, "dist": { "shasum": "9a759d39c5f2ff503fd5300646ed445f88c4f9af", - "tarball": "http://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz" + "tarball": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz" }, "gitHead": "4a3ac9cc006a91e64901f8ebe78d23bf9fc9fbd0", "homepage": "https://github.com/substack/json-stable-stringify", "keywords": [ - "json", - "stringify", "deterministic", "hash", + "json", "sort", - "stable" + "stable", + "stringify" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" } ], "name": "json-stable-stringify", @@ -87,13 +87,13 @@ }, "testling": { "browsers": [ - "ie/8..latest", - "ff/5", - "ff/latest", "chrome/15", "chrome/latest", - "safari/latest", - "opera/latest" + "ff/5", + "ff/latest", + "ie/8..latest", + "opera/latest", + "safari/latest" ], "files": "test/*.js" }, diff --git a/tools/eslint/node_modules/json-stable-stringify/test/cmp.js b/tools/eslint/node_modules/json-stable-stringify/test/cmp.js deleted file mode 100644 index 2dbb39355c652b..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/test/cmp.js +++ /dev/null @@ -1,11 +0,0 @@ -var test = require('tape'); -var stringify = require('../'); - -test('custom comparison function', function (t) { - t.plan(1); - var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; - var s = stringify(obj, function (a, b) { - return a.key < b.key ? 1 : -1; - }); - t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}'); -}); diff --git a/tools/eslint/node_modules/json-stable-stringify/test/nested.js b/tools/eslint/node_modules/json-stable-stringify/test/nested.js deleted file mode 100644 index e7f5a0e65b7648..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/test/nested.js +++ /dev/null @@ -1,35 +0,0 @@ -var test = require('tape'); -var stringify = require('../'); - -test('nested', function (t) { - t.plan(1); - var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; - t.equal(stringify(obj), '{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}'); -}); - -test('cyclic (default)', function (t) { - t.plan(1); - var one = { a: 1 }; - var two = { a: 2, one: one }; - one.two = two; - try { - stringify(one); - } catch (ex) { - t.equal(ex.toString(), 'TypeError: Converting circular structure to JSON'); - } -}); - -test('cyclic (specifically allowed)', function (t) { - t.plan(1); - var one = { a: 1 }; - var two = { a: 2, one: one }; - one.two = two; - t.equal(stringify(one, {cycles:true}), '{"a":1,"two":{"a":2,"one":"__cycle__"}}'); -}); - -test('repeated non-cyclic value', function(t) { - t.plan(1); - var one = { x: 1 }; - var two = { a: one, b: one }; - t.equal(stringify(two), '{"a":{"x":1},"b":{"x":1}}'); -}); diff --git a/tools/eslint/node_modules/json-stable-stringify/test/replacer.js b/tools/eslint/node_modules/json-stable-stringify/test/replacer.js deleted file mode 100644 index 98802a72d65eff..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/test/replacer.js +++ /dev/null @@ -1,74 +0,0 @@ -var test = require('tape'); -var stringify = require('../'); - -test('replace root', function (t) { - t.plan(1); - - var obj = { a: 1, b: 2, c: false }; - var replacer = function(key, value) { return 'one'; }; - - t.equal(stringify(obj, { replacer: replacer }), '"one"'); -}); - -test('replace numbers', function (t) { - t.plan(1); - - var obj = { a: 1, b: 2, c: false }; - var replacer = function(key, value) { - if(value === 1) return 'one'; - if(value === 2) return 'two'; - return value; - }; - - t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":"two","c":false}'); -}); - -test('replace with object', function (t) { - t.plan(1); - - var obj = { a: 1, b: 2, c: false }; - var replacer = function(key, value) { - if(key === 'b') return { d: 1 }; - if(value === 1) return 'one'; - return value; - }; - - t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":{"d":"one"},"c":false}'); -}); - -test('replace with undefined', function (t) { - t.plan(1); - - var obj = { a: 1, b: 2, c: false }; - var replacer = function(key, value) { - if(value === false) return; - return value; - }; - - t.equal(stringify(obj, { replacer: replacer }), '{"a":1,"b":2}'); -}); - -test('replace with array', function (t) { - t.plan(1); - - var obj = { a: 1, b: 2, c: false }; - var replacer = function(key, value) { - if(key === 'b') return ['one', 'two']; - return value; - }; - - t.equal(stringify(obj, { replacer: replacer }), '{"a":1,"b":["one","two"],"c":false}'); -}); - -test('replace array item', function (t) { - t.plan(1); - - var obj = { a: 1, b: 2, c: [1,2] }; - var replacer = function(key, value) { - if(value === 1) return 'one'; - if(value === 2) return 'two'; - return value; - }; - - t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":"two","c":["one","two"]}'); -}); diff --git a/tools/eslint/node_modules/json-stable-stringify/test/space.js b/tools/eslint/node_modules/json-stable-stringify/test/space.js deleted file mode 100644 index 2621122ae3778c..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/test/space.js +++ /dev/null @@ -1,59 +0,0 @@ -var test = require('tape'); -var stringify = require('../'); - -test('space parameter', function (t) { - t.plan(1); - var obj = { one: 1, two: 2 }; - t.equal(stringify(obj, {space: ' '}), '' - + '{\n' - + ' "one": 1,\n' - + ' "two": 2\n' - + '}' - ); -}); - -test('space parameter (with tabs)', function (t) { - t.plan(1); - var obj = { one: 1, two: 2 }; - t.equal(stringify(obj, {space: '\t'}), '' - + '{\n' - + '\t"one": 1,\n' - + '\t"two": 2\n' - + '}' - ); -}); - -test('space parameter (with a number)', function (t) { - t.plan(1); - var obj = { one: 1, two: 2 }; - t.equal(stringify(obj, {space: 3}), '' - + '{\n' - + ' "one": 1,\n' - + ' "two": 2\n' - + '}' - ); -}); - -test('space parameter (nested objects)', function (t) { - t.plan(1); - var obj = { one: 1, two: { b: 4, a: [2,3] } }; - t.equal(stringify(obj, {space: ' '}), '' - + '{\n' - + ' "one": 1,\n' - + ' "two": {\n' - + ' "a": [\n' - + ' 2,\n' - + ' 3\n' - + ' ],\n' - + ' "b": 4\n' - + ' }\n' - + '}' - ); -}); - -test('space parameter (same as native)', function (t) { - t.plan(1); - // for this test, properties need to be in alphabetical order - var obj = { one: 1, two: { a: [2,3], b: 4 } }; - t.equal(stringify(obj, {space: ' '}), JSON.stringify(obj, null, ' ')); -}); diff --git a/tools/eslint/node_modules/json-stable-stringify/test/str.js b/tools/eslint/node_modules/json-stable-stringify/test/str.js deleted file mode 100644 index 67426b99e30b22..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/test/str.js +++ /dev/null @@ -1,32 +0,0 @@ -var test = require('tape'); -var stringify = require('../'); - -test('simple object', function (t) { - t.plan(1); - var obj = { c: 6, b: [4,5], a: 3, z: null }; - t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}'); -}); - -test('object with undefined', function (t) { - t.plan(1); - var obj = { a: 3, z: undefined }; - t.equal(stringify(obj), '{"a":3}'); -}); - -test('array with undefined', function (t) { - t.plan(1); - var obj = [4, undefined, 6]; - t.equal(stringify(obj), '[4,null,6]'); -}); - -test('object with empty string', function (t) { - t.plan(1); - var obj = { a: 3, z: '' }; - t.equal(stringify(obj), '{"a":3,"z":""}'); -}); - -test('array with empty string', function (t) { - t.plan(1); - var obj = [4, '', 6]; - t.equal(stringify(obj), '[4,"",6]'); -}); diff --git a/tools/eslint/node_modules/json-stable-stringify/test/to-json.js b/tools/eslint/node_modules/json-stable-stringify/test/to-json.js deleted file mode 100644 index ef9a980929ae90..00000000000000 --- a/tools/eslint/node_modules/json-stable-stringify/test/to-json.js +++ /dev/null @@ -1,20 +0,0 @@ -var test = require('tape'); -var stringify = require('../'); - -test('toJSON function', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } }; - t.equal(stringify(obj), '{"one":1}' ); -}); - -test('toJSON returns string', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } }; - t.equal(stringify(obj), '"one"'); -}); - -test('toJSON returns array', function (t) { - t.plan(1); - var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } }; - t.equal(stringify(obj), '["one"]'); -}); diff --git a/tools/eslint/node_modules/jsonify/package.json b/tools/eslint/node_modules/jsonify/package.json index f5f79370bc4e6f..0b4be16988a837 100644 --- a/tools/eslint/node_modules/jsonify/package.json +++ b/tools/eslint/node_modules/jsonify/package.json @@ -2,7 +2,7 @@ "_args": [ [ "jsonify@~0.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/json-stable-stringify" + "/Users/silverwind/git/node/tools/package/package/node_modules/json-stable-stringify" ] ], "_defaultsLoaded": true, @@ -11,7 +11,7 @@ "_id": "jsonify@0.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/jsonify", + "_location": "/jsonify", "_nodeVersion": "v0.5.0-pre", "_npmVersion": "1.0.10", "_phantomChildren": {}, @@ -24,13 +24,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/json-stable-stringify" + "/json-stable-stringify" ], "_resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "_shasum": "2c74b6ee41d93ca51b7b5aaee8f503631d252a73", "_shrinkwrap": null, "_spec": "jsonify@~0.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/json-stable-stringify", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/json-stable-stringify", "author": { "name": "Douglas Crockford", "url": "http://crockford.com/" @@ -57,15 +57,15 @@ }, "homepage": "https://github.com/substack/jsonify#readme", "keywords": [ - "json", - "browser" + "browser", + "json" ], "license": "Public Domain", "main": "index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" } ], "name": "jsonify", diff --git a/tools/eslint/node_modules/jsonify/test/parse.js b/tools/eslint/node_modules/jsonify/test/parse.js deleted file mode 100644 index d23de157e198a4..00000000000000 --- a/tools/eslint/node_modules/jsonify/test/parse.js +++ /dev/null @@ -1,16 +0,0 @@ -var test = require('tap').test; -var json = require('../'); -var garbage = require('garbage'); - -test('parse', function (t) { - for (var i = 0; i < 50; i++) { - var s = JSON.stringify(garbage(50)); - - t.deepEqual( - json.parse(s), - JSON.parse(s) - ); - } - - t.end(); -}); diff --git a/tools/eslint/node_modules/jsonify/test/stringify.js b/tools/eslint/node_modules/jsonify/test/stringify.js deleted file mode 100644 index 72de91f2b6dec6..00000000000000 --- a/tools/eslint/node_modules/jsonify/test/stringify.js +++ /dev/null @@ -1,15 +0,0 @@ -var test = require('tap').test; -var json = require('../'); -var garbage = require('garbage'); - -test('stringify', function (t) { - for (var i = 0; i < 50; i++) { - var obj = garbage(50); - t.equal( - json.stringify(obj), - JSON.stringify(obj) - ); - } - - t.end(); -}); diff --git a/tools/eslint/node_modules/jsonpointer/.travis.yml b/tools/eslint/node_modules/jsonpointer/.travis.yml deleted file mode 100644 index 9338bf147031df..00000000000000 --- a/tools/eslint/node_modules/jsonpointer/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: "node_js" -node_js: - - 0.6 - - 0.8 - - 0.10 - - 0.11 - - 0.12 - - iojs-v1.0 - - iojs-v2.0 - - iojs diff --git a/tools/eslint/node_modules/jsonpointer/package.json b/tools/eslint/node_modules/jsonpointer/package.json index 05d6424e2a1527..64f1b24fa9c3dc 100644 --- a/tools/eslint/node_modules/jsonpointer/package.json +++ b/tools/eslint/node_modules/jsonpointer/package.json @@ -2,14 +2,14 @@ "_args": [ [ "jsonpointer@2.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/is-my-json-valid" + "/Users/silverwind/git/node/tools/package/package/node_modules/is-my-json-valid" ] ], "_from": "jsonpointer@2.0.0", "_id": "jsonpointer@2.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/jsonpointer", + "_location": "/jsonpointer", "_nodeVersion": "0.10.36", "_npmUser": { "email": "marc.brookman@gmail.com", @@ -26,13 +26,13 @@ "type": "version" }, "_requiredBy": [ - "/eslint/is-my-json-valid" + "/is-my-json-valid" ], "_resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz", "_shasum": "3af1dd20fe85463910d469a385e33017d2a030d9", "_shrinkwrap": null, "_spec": "jsonpointer@2.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/is-my-json-valid", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/is-my-json-valid", "author": { "email": "jan@apache.org", "name": "Jan Lehnardt" @@ -42,8 +42,8 @@ }, "contributors": [ { - "email": "joe-github@cursive.net", - "name": "Joe Hildebrand" + "name": "Joe Hildebrand", + "email": "joe-github@cursive.net" } ], "dependencies": {}, @@ -63,12 +63,12 @@ "main": "./jsonpointer", "maintainers": [ { - "email": "jan@apache.org", - "name": "jan" + "name": "jan", + "email": "jan@apache.org" }, { - "email": "marc.brookman@gmail.com", - "name": "marcbachmann" + "name": "marcbachmann", + "email": "marc.brookman@gmail.com" } ], "name": "jsonpointer", @@ -82,9 +82,9 @@ "test": "node test.js" }, "tags": [ - "util", "simple", "util", + "util", "utility" ], "version": "2.0.0" diff --git a/tools/eslint/node_modules/jsonpointer/test.js b/tools/eslint/node_modules/jsonpointer/test.js deleted file mode 100644 index 1c67d7f7efc898..00000000000000 --- a/tools/eslint/node_modules/jsonpointer/test.js +++ /dev/null @@ -1,98 +0,0 @@ -var assert = require("assert"); -var jsonpointer = require("./jsonpointer"); - -var obj = { - a: 1, - b: { - c: 2 - }, - d: { - e: [{a:3}, {b:4}, {c:5}] - } -}; - -assert.equal(jsonpointer.get(obj, "/a"), 1); -assert.equal(jsonpointer.get(obj, "/b/c"), 2); -assert.equal(jsonpointer.get(obj, "/d/e/0/a"), 3); -assert.equal(jsonpointer.get(obj, "/d/e/1/b"), 4); -assert.equal(jsonpointer.get(obj, "/d/e/2/c"), 5); - -// set returns old value -assert.equal(jsonpointer.set(obj, "/a", 2), 1); -assert.equal(jsonpointer.set(obj, "/b/c", 3), 2); -assert.equal(jsonpointer.set(obj, "/d/e/0/a", 4), 3); -assert.equal(jsonpointer.set(obj, "/d/e/1/b", 5), 4); -assert.equal(jsonpointer.set(obj, "/d/e/2/c", 6), 5); - -assert.equal(jsonpointer.get(obj, "/a"), 2); -assert.equal(jsonpointer.get(obj, "/b/c"), 3); -assert.equal(jsonpointer.get(obj, "/d/e/0/a"), 4); -assert.equal(jsonpointer.get(obj, "/d/e/1/b"), 5); -assert.equal(jsonpointer.get(obj, "/d/e/2/c"), 6); - -assert.equal(jsonpointer.get(obj, ""), obj); -assert.throws(function(){ jsonpointer.get(obj, "a"); }, validateError); -assert.throws(function(){ jsonpointer.get(obj, "a/"); }, validateError); - -function validateError(err) { - if ( (err instanceof Error) && /Invalid JSON pointer/.test(err.message) ) { - return true; - } -} - -var complexKeys = { - "a/b": { - c: 1 - }, - d: { - "e/f": 2 - }, - "~1": 3, - "01": 4 -} - -assert.equal(jsonpointer.get(complexKeys, "/a~1b/c"), 1); -assert.equal(jsonpointer.get(complexKeys, "/d/e~1f"), 2); -assert.equal(jsonpointer.get(complexKeys, "/~01"), 3); -assert.equal(jsonpointer.get(complexKeys, "/01"), 4); -assert.equal(jsonpointer.get(complexKeys, "/a/b/c"), null); -assert.equal(jsonpointer.get(complexKeys, "/~1"), null); - -// draft-ietf-appsawg-json-pointer-08 has special array rules -var ary = [ "zero", "one", "two" ]; -assert.equal(jsonpointer.get(ary, "/01"), null); - -//assert.equal(jsonpointer.set(ary, "/-", "three"), null); -//assert.equal(ary[3], "three"); - -// Examples from the draft: -var example = { - "foo": ["bar", "baz"], - "": 0, - "a/b": 1, - "c%d": 2, - "e^f": 3, - "g|h": 4, - "i\\j": 5, - "k\"l": 6, - " ": 7, - "m~n": 8 -}; - -assert.equal(jsonpointer.get(example, ""), example); -var ans = jsonpointer.get(example, "/foo"); -assert.equal(ans.length, 2); -assert.equal(ans[0], "bar"); -assert.equal(ans[1], "baz"); -assert.equal(jsonpointer.get(example, "/foo/0"), "bar"); -assert.equal(jsonpointer.get(example, "/"), 0); -assert.equal(jsonpointer.get(example, "/a~1b"), 1); -assert.equal(jsonpointer.get(example, "/c%d"), 2); -assert.equal(jsonpointer.get(example, "/e^f"), 3); -assert.equal(jsonpointer.get(example, "/g|h"), 4); -assert.equal(jsonpointer.get(example, "/i\\j"), 5); -assert.equal(jsonpointer.get(example, "/k\"l"), 6); -assert.equal(jsonpointer.get(example, "/ "), 7); -assert.equal(jsonpointer.get(example, "/m~0n"), 8); - -console.log("All tests pass."); diff --git a/tools/eslint/node_modules/levn/package.json b/tools/eslint/node_modules/levn/package.json index c6d86622d91c04..f7afdadc63dc0b 100644 --- a/tools/eslint/node_modules/levn/package.json +++ b/tools/eslint/node_modules/levn/package.json @@ -2,14 +2,14 @@ "_args": [ [ "levn@~0.3.0", - "/Users/trott/test/node_modules/eslint/node_modules/optionator" + "/Users/silverwind/git/node/tools/package/package/node_modules/optionator" ] ], "_from": "levn@>=0.3.0 <0.4.0", "_id": "levn@0.3.0", "_inCache": true, "_installable": true, - "_location": "/eslint/levn", + "_location": "/levn", "_nodeVersion": "4.2.4", "_npmUser": { "email": "z@georgezahariev.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/optionator" + "/optionator" ], "_resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "_shasum": "3b09924edf9f083c0490fdd4c0bc4421e04764ee", "_shrinkwrap": null, "_spec": "levn@~0.3.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/optionator", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/optionator", "author": { "email": "z@georgezahariev.com", "name": "George Zahariev" @@ -59,31 +59,31 @@ "node": ">= 0.8.0" }, "files": [ - "lib", + "LICENSE", "README.md", - "LICENSE" + "lib" ], "gitHead": "a92b9acf928282ba81134b4ae8e6a5f29e1f5e1e", "homepage": "https://github.com/gkz/levn", "keywords": [ + "concise", + "ecmascript", + "flexible", + "human", + "json", "levn", "light", - "ecmascript", - "value", "notation", - "json", "typed", - "human", - "concise", "typed", - "flexible" + "value" ], "license": "MIT", "main": "./lib/", "maintainers": [ { - "email": "z@georgezahariev.com", - "name": "gkz" + "name": "gkz", + "email": "z@georgezahariev.com" } ], "name": "levn", diff --git a/tools/eslint/node_modules/lodash/LICENSE b/tools/eslint/node_modules/lodash/LICENSE index bcbe13d67a9621..e0c69d56032d15 100644 --- a/tools/eslint/node_modules/lodash/LICENSE +++ b/tools/eslint/node_modules/lodash/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/tools/eslint/node_modules/lodash/README.md b/tools/eslint/node_modules/lodash/README.md index 33a7ef26ef2e58..ea9313b9564198 100644 --- a/tools/eslint/node_modules/lodash/README.md +++ b/tools/eslint/node_modules/lodash/README.md @@ -1,6 +1,6 @@ -# lodash v4.3.0 +# lodash v4.9.0 -The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. +The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. ## Installation @@ -12,29 +12,29 @@ $ npm i --save lodash In Node.js: ```js -// load the full build +// Load the full build. var _ = require('lodash'); -// load the core build +// Load the core build. var _ = require('lodash/core'); -// load the fp build for immutable auto-curried iteratee-first data-last methods -var _ = require('lodash/fp'); +// Load the fp build for immutable auto-curried iteratee-first data-last methods. +var fp = require('lodash/fp'); -// or a method category +// Load a method category. var array = require('lodash/array'); var object = require('lodash/fp/object'); -// or method for smaller builds with browserify/rollup/webpack +// Load a single method for smaller builds with browserify/rollup/webpack. var chunk = require('lodash/chunk'); var extend = require('lodash/fp/extend'); ``` -See the [package source](https://github.com/lodash/lodash/tree/4.3.0-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.9.0-npm) for more details. **Note:**
        Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
        -Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default. +Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes `lodash` by default. ## Support -Tested in Chrome 47-48, Firefox 43-44, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10, 0.12, 4, & 5, & PhantomJS 1.9.8.
        +Tested in Chrome 48-49, Firefox 44-45, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10, 0.12, 4, & 5, & PhantomJS 1.9.8.
        Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. diff --git a/tools/eslint/node_modules/lodash/_DataView.js b/tools/eslint/node_modules/lodash/_DataView.js new file mode 100644 index 00000000000000..ac2d57ca67c9cb --- /dev/null +++ b/tools/eslint/node_modules/lodash/_DataView.js @@ -0,0 +1,7 @@ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'); + +module.exports = DataView; diff --git a/tools/eslint/node_modules/lodash/_Hash.js b/tools/eslint/node_modules/lodash/_Hash.js index 25108ad7fd7c34..7f4c3ba933a744 100644 --- a/tools/eslint/node_modules/lodash/_Hash.js +++ b/tools/eslint/node_modules/lodash/_Hash.js @@ -4,9 +4,10 @@ var nativeCreate = require('./_nativeCreate'); var objectProto = Object.prototype; /** - * Creates an hash object. + * Creates a hash object. * * @private + * @constructor * @returns {Object} Returns the new hash object. */ function Hash() {} diff --git a/tools/eslint/node_modules/lodash/_LazyWrapper.js b/tools/eslint/node_modules/lodash/_LazyWrapper.js index 3c14d805c925a7..81786c7f1e4940 100644 --- a/tools/eslint/node_modules/lodash/_LazyWrapper.js +++ b/tools/eslint/node_modules/lodash/_LazyWrapper.js @@ -8,6 +8,7 @@ var MAX_ARRAY_LENGTH = 4294967295; * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private + * @constructor * @param {*} value The value to wrap. */ function LazyWrapper(value) { @@ -20,6 +21,7 @@ function LazyWrapper(value) { this.__views__ = []; } +// Ensure `LazyWrapper` is an instance of `baseLodash`. LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; diff --git a/tools/eslint/node_modules/lodash/_LodashWrapper.js b/tools/eslint/node_modules/lodash/_LodashWrapper.js index 7c255b2dd1500c..c1e4d9df762b40 100644 --- a/tools/eslint/node_modules/lodash/_LodashWrapper.js +++ b/tools/eslint/node_modules/lodash/_LodashWrapper.js @@ -6,7 +6,7 @@ var baseCreate = require('./_baseCreate'), * * @private * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable chaining for all wrapper methods. + * @param {boolean} [chainAll] Enable explicit method chain sequences. */ function LodashWrapper(value, chainAll) { this.__wrapped__ = value; diff --git a/tools/eslint/node_modules/lodash/_MapCache.js b/tools/eslint/node_modules/lodash/_MapCache.js index 734324be552a68..4c6fa99949d0f2 100644 --- a/tools/eslint/node_modules/lodash/_MapCache.js +++ b/tools/eslint/node_modules/lodash/_MapCache.js @@ -8,6 +8,7 @@ var mapClear = require('./_mapClear'), * Creates a map cache object to store key-value pairs. * * @private + * @constructor * @param {Array} [values] The values to cache. */ function MapCache(values) { @@ -21,7 +22,7 @@ function MapCache(values) { } } -// Add functions to the `MapCache`. +// Add methods to `MapCache`. MapCache.prototype.clear = mapClear; MapCache.prototype['delete'] = mapDelete; MapCache.prototype.get = mapGet; diff --git a/tools/eslint/node_modules/lodash/_Promise.js b/tools/eslint/node_modules/lodash/_Promise.js new file mode 100644 index 00000000000000..247b9e1bacac64 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_Promise.js @@ -0,0 +1,7 @@ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Promise = getNative(root, 'Promise'); + +module.exports = Promise; diff --git a/tools/eslint/node_modules/lodash/_SetCache.js b/tools/eslint/node_modules/lodash/_SetCache.js index 66b8b614b0f3e1..6fd915bdc181a7 100644 --- a/tools/eslint/node_modules/lodash/_SetCache.js +++ b/tools/eslint/node_modules/lodash/_SetCache.js @@ -6,6 +6,7 @@ var MapCache = require('./_MapCache'), * Creates a set cache object to store unique values. * * @private + * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { @@ -18,7 +19,7 @@ function SetCache(values) { } } -// Add functions to the `SetCache`. +// Add methods to `SetCache`. SetCache.prototype.push = cachePush; module.exports = SetCache; diff --git a/tools/eslint/node_modules/lodash/_Stack.js b/tools/eslint/node_modules/lodash/_Stack.js index 7c3c2f318fac53..414cd5295d14b1 100644 --- a/tools/eslint/node_modules/lodash/_Stack.js +++ b/tools/eslint/node_modules/lodash/_Stack.js @@ -8,6 +8,7 @@ var stackClear = require('./_stackClear'), * Creates a stack cache object to store key-value pairs. * * @private + * @constructor * @param {Array} [values] The values to cache. */ function Stack(values) { @@ -21,7 +22,7 @@ function Stack(values) { } } -// Add functions to the `Stack` cache. +// Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; diff --git a/tools/eslint/node_modules/lodash/_addMapEntry.js b/tools/eslint/node_modules/lodash/_addMapEntry.js index c76dc3fddb7384..0112ef74425759 100644 --- a/tools/eslint/node_modules/lodash/_addMapEntry.js +++ b/tools/eslint/node_modules/lodash/_addMapEntry.js @@ -7,6 +7,7 @@ * @returns {Object} Returns `map`. */ function addMapEntry(map, pair) { + // Don't return `Map#set` because it doesn't return the map instance in IE 11. map.set(pair[0], pair[1]); return map; } diff --git a/tools/eslint/node_modules/lodash/_apply.js b/tools/eslint/node_modules/lodash/_apply.js index 22d4f8a70315f6..d000f046079f31 100644 --- a/tools/eslint/node_modules/lodash/_apply.js +++ b/tools/eslint/node_modules/lodash/_apply.js @@ -5,7 +5,7 @@ * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. - * @param {...*} args The arguments to invoke `func` with. + * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { diff --git a/tools/eslint/node_modules/lodash/_arrayEvery.js b/tools/eslint/node_modules/lodash/_arrayEvery.js index d3ba018f66816b..8d89fb102d890c 100644 --- a/tools/eslint/node_modules/lodash/_arrayEvery.js +++ b/tools/eslint/node_modules/lodash/_arrayEvery.js @@ -5,7 +5,8 @@ * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. */ function arrayEvery(array, predicate) { var index = -1, diff --git a/tools/eslint/node_modules/lodash/_arrayFilter.js b/tools/eslint/node_modules/lodash/_arrayFilter.js index 297083b4a2aa02..7b61ba6f9eea59 100644 --- a/tools/eslint/node_modules/lodash/_arrayFilter.js +++ b/tools/eslint/node_modules/lodash/_arrayFilter.js @@ -10,13 +10,13 @@ function arrayFilter(array, predicate) { var index = -1, length = array.length, - resIndex = -1, + resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { - result[++resIndex] = value; + result[resIndex++] = value; } } return result; diff --git a/tools/eslint/node_modules/lodash/_arrayIncludesWith.js b/tools/eslint/node_modules/lodash/_arrayIncludesWith.js index a360d3a75ceb9d..88ea23719b4c99 100644 --- a/tools/eslint/node_modules/lodash/_arrayIncludesWith.js +++ b/tools/eslint/node_modules/lodash/_arrayIncludesWith.js @@ -1,6 +1,5 @@ /** - * A specialized version of `_.includesWith` for arrays without support for - * specifying an index to search from. + * This function is like `arrayIncludes` except that it accepts a comparator. * * @private * @param {Array} array The array to search. diff --git a/tools/eslint/node_modules/lodash/_arrayReduce.js b/tools/eslint/node_modules/lodash/_arrayReduce.js index 6a355bce82f77c..41bea2cf07a5fb 100644 --- a/tools/eslint/node_modules/lodash/_arrayReduce.js +++ b/tools/eslint/node_modules/lodash/_arrayReduce.js @@ -6,7 +6,8 @@ * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { diff --git a/tools/eslint/node_modules/lodash/_arrayReduceRight.js b/tools/eslint/node_modules/lodash/_arrayReduceRight.js index b33a2d086cf365..038e0fa7890e5d 100644 --- a/tools/eslint/node_modules/lodash/_arrayReduceRight.js +++ b/tools/eslint/node_modules/lodash/_arrayReduceRight.js @@ -6,7 +6,8 @@ * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as the initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { diff --git a/tools/eslint/node_modules/lodash/_arraySome.js b/tools/eslint/node_modules/lodash/_arraySome.js index b93d53129867f3..e6e657b8f9b9de 100644 --- a/tools/eslint/node_modules/lodash/_arraySome.js +++ b/tools/eslint/node_modules/lodash/_arraySome.js @@ -5,7 +5,8 @@ * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ function arraySome(array, predicate) { var index = -1, diff --git a/tools/eslint/node_modules/lodash/_assignMergeValue.js b/tools/eslint/node_modules/lodash/_assignMergeValue.js index 1c493b0651af22..61dd5832905f16 100644 --- a/tools/eslint/node_modules/lodash/_assignMergeValue.js +++ b/tools/eslint/node_modules/lodash/_assignMergeValue.js @@ -1,7 +1,8 @@ var eq = require('./eq'); /** - * This function is like `assignValue` except that it doesn't assign `undefined` values. + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. * * @private * @param {Object} object The object to modify. diff --git a/tools/eslint/node_modules/lodash/_assignValue.js b/tools/eslint/node_modules/lodash/_assignValue.js index 7563b604e957d5..35d49f04e88c40 100644 --- a/tools/eslint/node_modules/lodash/_assignValue.js +++ b/tools/eslint/node_modules/lodash/_assignValue.js @@ -18,8 +18,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; */ function assignValue(object, key, value) { var objValue = object[key]; - if ((!eq(objValue, value) || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) || + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { object[key] = value; } diff --git a/tools/eslint/node_modules/lodash/_assocDelete.js b/tools/eslint/node_modules/lodash/_assocDelete.js index 709a04a9c69cb3..49f61e830f10be 100644 --- a/tools/eslint/node_modules/lodash/_assocDelete.js +++ b/tools/eslint/node_modules/lodash/_assocDelete.js @@ -10,7 +10,7 @@ var splice = arrayProto.splice; * Removes `key` and its value from the associative array. * * @private - * @param {Array} array The array to query. + * @param {Array} array The array to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ diff --git a/tools/eslint/node_modules/lodash/_assocIndexOf.js b/tools/eslint/node_modules/lodash/_assocIndexOf.js index 958c8d8f58f830..8f2c41fbcda558 100644 --- a/tools/eslint/node_modules/lodash/_assocIndexOf.js +++ b/tools/eslint/node_modules/lodash/_assocIndexOf.js @@ -1,8 +1,7 @@ var eq = require('./eq'); /** - * Gets the index at which the first occurrence of `key` is found in `array` - * of key-value pairs. + * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to search. diff --git a/tools/eslint/node_modules/lodash/_baseCastArrayLikeObject.js b/tools/eslint/node_modules/lodash/_baseCastArrayLikeObject.js new file mode 100644 index 00000000000000..b9156ef1cfc2e9 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseCastArrayLikeObject.js @@ -0,0 +1,14 @@ +var isArrayLikeObject = require('./isArrayLikeObject'); + +/** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ +function baseCastArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; +} + +module.exports = baseCastArrayLikeObject; diff --git a/tools/eslint/node_modules/lodash/_baseCastFunction.js b/tools/eslint/node_modules/lodash/_baseCastFunction.js new file mode 100644 index 00000000000000..ca118b6baa5afd --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseCastFunction.js @@ -0,0 +1,14 @@ +var identity = require('./identity'); + +/** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ +function baseCastFunction(value) { + return typeof value == 'function' ? value : identity; +} + +module.exports = baseCastFunction; diff --git a/tools/eslint/node_modules/lodash/_baseCastKey.js b/tools/eslint/node_modules/lodash/_baseCastKey.js new file mode 100644 index 00000000000000..0259e6239d3172 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseCastKey.js @@ -0,0 +1,14 @@ +var isSymbol = require('./isSymbol'); + +/** + * Casts `value` to a string if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the cast key. + */ +function baseCastKey(key) { + return (typeof key == 'string' || isSymbol(key)) ? key : (key + ''); +} + +module.exports = baseCastKey; diff --git a/tools/eslint/node_modules/lodash/_baseCastPath.js b/tools/eslint/node_modules/lodash/_baseCastPath.js new file mode 100644 index 00000000000000..7634e5ba2b1d4d --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseCastPath.js @@ -0,0 +1,15 @@ +var isArray = require('./isArray'), + stringToPath = require('./_stringToPath'); + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +module.exports = baseCastPath; diff --git a/tools/eslint/node_modules/lodash/_baseClone.js b/tools/eslint/node_modules/lodash/_baseClone.js index 42d90a95c62915..b1079edd8be28c 100644 --- a/tools/eslint/node_modules/lodash/_baseClone.js +++ b/tools/eslint/node_modules/lodash/_baseClone.js @@ -2,10 +2,10 @@ var Stack = require('./_Stack'), arrayEach = require('./_arrayEach'), assignValue = require('./_assignValue'), baseAssign = require('./_baseAssign'), - baseForOwn = require('./_baseForOwn'), cloneBuffer = require('./_cloneBuffer'), copyArray = require('./_copyArray'), copySymbols = require('./_copySymbols'), + getAllKeys = require('./_getAllKeys'), getTag = require('./_getTag'), initCloneArray = require('./_initCloneArray'), initCloneByTag = require('./_initCloneByTag'), @@ -13,7 +13,8 @@ var Stack = require('./_Stack'), isArray = require('./isArray'), isBuffer = require('./isBuffer'), isHostObject = require('./_isHostObject'), - isObject = require('./isObject'); + isObject = require('./isObject'), + keys = require('./keys'); /** `Object#toString` result references. */ var argsTag = '[object Arguments]', @@ -33,6 +34,7 @@ var argsTag = '[object Arguments]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', @@ -46,16 +48,16 @@ var arrayBufferTag = '[object ArrayBuffer]', /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = -cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = -cloneableTags[dateTag] = cloneableTags[float32Tag] = -cloneableTags[float64Tag] = cloneableTags[int8Tag] = -cloneableTags[int16Tag] = cloneableTags[int32Tag] = -cloneableTags[mapTag] = cloneableTags[numberTag] = -cloneableTags[objectTag] = cloneableTags[regexpTag] = -cloneableTags[setTag] = cloneableTags[stringTag] = -cloneableTags[symbolTag] = cloneableTags[uint8Tag] = -cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = -cloneableTags[uint32Tag] = true; +cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = +cloneableTags[boolTag] = cloneableTags[dateTag] = +cloneableTags[float32Tag] = cloneableTags[float64Tag] = +cloneableTags[int8Tag] = cloneableTags[int16Tag] = +cloneableTags[int32Tag] = cloneableTags[mapTag] = +cloneableTags[numberTag] = cloneableTags[objectTag] = +cloneableTags[regexpTag] = cloneableTags[setTag] = +cloneableTags[stringTag] = cloneableTags[symbolTag] = +cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = +cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; @@ -66,13 +68,14 @@ cloneableTags[weakMapTag] = false; * @private * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. + * @param {boolean} [isFull] Specify a clone including symbols. * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ -function baseClone(value, isDeep, customizer, key, object, stack) { +function baseClone(value, isDeep, isFull, customizer, key, object, stack) { var result; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); @@ -105,9 +108,10 @@ function baseClone(value, isDeep, customizer, key, object, stack) { return copySymbols(value, baseAssign(result, value)); } } else { - return cloneableTags[tag] - ? initCloneByTag(value, tag, isDeep) - : (object ? value : {}); + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, baseClone, isDeep); } } // Check for circular references and return its corresponding clone. @@ -118,11 +122,18 @@ function baseClone(value, isDeep, customizer, key, object, stack) { } stack.set(value, result); + if (!isArr) { + var props = isFull ? getAllKeys(value) : keys(value); + } // Recursively populate clone (susceptible to call stack limits). - (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { - assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack)); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); }); - return isArr ? result : copySymbols(value, result); + return result; } module.exports = baseClone; diff --git a/tools/eslint/node_modules/lodash/_baseConforms.js b/tools/eslint/node_modules/lodash/_baseConforms.js index 888434d620e203..973aa6d4397af9 100644 --- a/tools/eslint/node_modules/lodash/_baseConforms.js +++ b/tools/eslint/node_modules/lodash/_baseConforms.js @@ -21,7 +21,8 @@ function baseConforms(source) { predicate = source[key], value = object[key]; - if ((value === undefined && !(key in Object(object))) || !predicate(value)) { + if ((value === undefined && + !(key in Object(object))) || !predicate(value)) { return false; } } diff --git a/tools/eslint/node_modules/lodash/_baseCreate.js b/tools/eslint/node_modules/lodash/_baseCreate.js index 64d53eccca290c..4372cad2b2aaef 100644 --- a/tools/eslint/node_modules/lodash/_baseCreate.js +++ b/tools/eslint/node_modules/lodash/_baseCreate.js @@ -1,5 +1,8 @@ var isObject = require('./isObject'); +/** Built-in value references. */ +var objectCreate = Object.create; + /** * The base implementation of `_.create` without support for assigning * properties to the created object. @@ -8,16 +11,8 @@ var isObject = require('./isObject'); * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} module.exports = baseCreate; diff --git a/tools/eslint/node_modules/lodash/_baseDifference.js b/tools/eslint/node_modules/lodash/_baseDifference.js index b266d7e3bea457..a49bdffa5a620f 100644 --- a/tools/eslint/node_modules/lodash/_baseDifference.js +++ b/tools/eslint/node_modules/lodash/_baseDifference.js @@ -9,8 +9,8 @@ var SetCache = require('./_SetCache'), var LARGE_ARRAY_SIZE = 200; /** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. diff --git a/tools/eslint/node_modules/lodash/_baseEvery.js b/tools/eslint/node_modules/lodash/_baseEvery.js index aafa00dade230a..fa52f7bc7d6b77 100644 --- a/tools/eslint/node_modules/lodash/_baseEvery.js +++ b/tools/eslint/node_modules/lodash/_baseEvery.js @@ -6,7 +6,8 @@ var baseEach = require('./_baseEach'); * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` */ function baseEvery(collection, predicate) { var result = true; diff --git a/tools/eslint/node_modules/lodash/_baseFind.js b/tools/eslint/node_modules/lodash/_baseFind.js index 535f7f35379b23..338f932c443b07 100644 --- a/tools/eslint/node_modules/lodash/_baseFind.js +++ b/tools/eslint/node_modules/lodash/_baseFind.js @@ -7,7 +7,8 @@ * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. + * @param {boolean} [retKey] Specify returning the key of the found element + * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { diff --git a/tools/eslint/node_modules/lodash/_baseFlatten.js b/tools/eslint/node_modules/lodash/_baseFlatten.js index 8a4cb460d71195..4b1e009b150cbf 100644 --- a/tools/eslint/node_modules/lodash/_baseFlatten.js +++ b/tools/eslint/node_modules/lodash/_baseFlatten.js @@ -1,31 +1,30 @@ var arrayPush = require('./_arrayPush'), - isArguments = require('./isArguments'), - isArray = require('./isArray'), - isArrayLikeObject = require('./isArrayLikeObject'); + isFlattenable = require('./_isFlattenable'); /** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. - * @param {boolean} [isDeep] Specify a deep flatten. - * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ -function baseFlatten(array, isDeep, isStrict, result) { - result || (result = []); - +function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; + predicate || (predicate = isFlattenable); + result || (result = []); + while (++index < length) { var value = array[index]; - if (isArrayLikeObject(value) && - (isStrict || isArray(value) || isArguments(value))) { - if (isDeep) { + if (depth > 0 && predicate(value)) { + if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, isDeep, isStrict, result); + baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } diff --git a/tools/eslint/node_modules/lodash/_baseFor.js b/tools/eslint/node_modules/lodash/_baseFor.js index 97b70c9e0db71c..a90460386d86ad 100644 --- a/tools/eslint/node_modules/lodash/_baseFor.js +++ b/tools/eslint/node_modules/lodash/_baseFor.js @@ -1,10 +1,9 @@ var createBaseFor = require('./_createBaseFor'); /** - * The base implementation of `baseForIn` and `baseForOwn` which iterates - * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iteratee functions may exit iteration early by explicitly - * returning `false`. + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` invoking `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. diff --git a/tools/eslint/node_modules/lodash/_baseForIn.js b/tools/eslint/node_modules/lodash/_baseForIn.js deleted file mode 100644 index 4dcfdaf1e36974..00000000000000 --- a/tools/eslint/node_modules/lodash/_baseForIn.js +++ /dev/null @@ -1,16 +0,0 @@ -var baseFor = require('./_baseFor'), - keysIn = require('./keysIn'); - -/** - * The base implementation of `_.forIn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForIn(object, iteratee) { - return object == null ? object : baseFor(object, iteratee, keysIn); -} - -module.exports = baseForIn; diff --git a/tools/eslint/node_modules/lodash/_baseGet.js b/tools/eslint/node_modules/lodash/_baseGet.js index d11de17bf3aa6c..0956af551a3117 100644 --- a/tools/eslint/node_modules/lodash/_baseGet.js +++ b/tools/eslint/node_modules/lodash/_baseGet.js @@ -1,4 +1,4 @@ -var baseToPath = require('./_baseToPath'), +var baseCastPath = require('./_baseCastPath'), isKey = require('./_isKey'); /** @@ -10,7 +10,7 @@ var baseToPath = require('./_baseToPath'), * @returns {*} Returns the resolved value. */ function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = 0, length = path.length; diff --git a/tools/eslint/node_modules/lodash/_baseGetAllKeys.js b/tools/eslint/node_modules/lodash/_baseGetAllKeys.js new file mode 100644 index 00000000000000..7f8b38bd4c1f94 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseGetAllKeys.js @@ -0,0 +1,22 @@ +var arrayPush = require('./_arrayPush'), + isArray = require('./isArray'); + +/** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ +function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) + ? result + : arrayPush(result, symbolsFunc(object)); +} + +module.exports = baseGetAllKeys; diff --git a/tools/eslint/node_modules/lodash/_baseHas.js b/tools/eslint/node_modules/lodash/_baseHas.js index b3932069d8b341..1de5d841c2938d 100644 --- a/tools/eslint/node_modules/lodash/_baseHas.js +++ b/tools/eslint/node_modules/lodash/_baseHas.js @@ -1,12 +1,11 @@ +var getPrototype = require('./_getPrototype'); + /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; -/** Built-in value references. */ -var getPrototypeOf = Object.getPrototypeOf; - /** * The base implementation of `_.has` without support for deep paths. * @@ -20,7 +19,7 @@ function baseHas(object, key) { // that are composed entirely of index properties, return `false` for // `hasOwnProperty` checks of them. return hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototypeOf(object) === null); + (typeof object == 'object' && key in object && getPrototype(object) === null); } module.exports = baseHas; diff --git a/tools/eslint/node_modules/lodash/_baseIndexOfWith.js b/tools/eslint/node_modules/lodash/_baseIndexOfWith.js new file mode 100644 index 00000000000000..8be568af269323 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseIndexOfWith.js @@ -0,0 +1,23 @@ +/** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; +} + +module.exports = baseIndexOfWith; diff --git a/tools/eslint/node_modules/lodash/_baseIntersection.js b/tools/eslint/node_modules/lodash/_baseIntersection.js index 77e463f85ef8aa..7d129267ed355d 100644 --- a/tools/eslint/node_modules/lodash/_baseIntersection.js +++ b/tools/eslint/node_modules/lodash/_baseIntersection.js @@ -5,6 +5,9 @@ var SetCache = require('./_SetCache'), baseUnary = require('./_baseUnary'), cacheHas = require('./_cacheHas'); +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + /** * The base implementation of methods like `_.intersection`, without support * for iteratee shorthands, that accepts an array of arrays to inspect. @@ -17,9 +20,11 @@ var SetCache = require('./_SetCache'), */ function baseIntersection(arrays, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), + maxLength = Infinity, result = []; while (othIndex--) { @@ -27,26 +32,32 @@ function baseIntersection(arrays, iteratee, comparator) { if (othIndex && iteratee) { array = arrayMap(array, baseUnary(iteratee)); } - caches[othIndex] = !comparator && (iteratee || array.length >= 120) + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) ? new SetCache(othIndex && array) : undefined; } array = arrays[0]; var index = -1, - length = array.length, seen = caches[0]; outer: - while (++index < length) { + while (++index < length && result.length < maxLength) { var value = array[index], computed = iteratee ? iteratee(value) : value; - if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) { - var othIndex = othLength; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; - if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) { + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { continue outer; } } diff --git a/tools/eslint/node_modules/lodash/_baseInvoke.js b/tools/eslint/node_modules/lodash/_baseInvoke.js index a19a5f8f8ac378..7a94a3f3a9fb48 100644 --- a/tools/eslint/node_modules/lodash/_baseInvoke.js +++ b/tools/eslint/node_modules/lodash/_baseInvoke.js @@ -1,5 +1,5 @@ var apply = require('./_apply'), - baseToPath = require('./_baseToPath'), + baseCastPath = require('./_baseCastPath'), isKey = require('./_isKey'), last = require('./last'), parent = require('./_parent'); @@ -16,7 +16,7 @@ var apply = require('./_apply'), */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); path = last(path); } diff --git a/tools/eslint/node_modules/lodash/_baseIsEqualDeep.js b/tools/eslint/node_modules/lodash/_baseIsEqualDeep.js index 54eca35069a223..c18d6d1fcdbb5b 100644 --- a/tools/eslint/node_modules/lodash/_baseIsEqualDeep.js +++ b/tools/eslint/node_modules/lodash/_baseIsEqualDeep.js @@ -31,7 +31,8 @@ var hasOwnProperty = objectProto.hasOwnProperty; * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` + * for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ @@ -43,41 +44,39 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { if (!objIsArr) { objTag = getTag(object); - if (objTag == argsTag) { - objTag = objectTag; - } else if (objTag != objectTag) { - objIsArr = isTypedArray(object); - } + objTag = objTag == argsTag ? objectTag : objTag; } if (!othIsArr) { othTag = getTag(other); - if (othTag == argsTag) { - othTag = objectTag; - } else if (othTag != objectTag) { - othIsArr = isTypedArray(other); - } + othTag = othTag == argsTag ? objectTag : othTag; } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) + : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); } - var isPartial = bitmask & PARTIAL_COMPARE_FLAG; - if (!isPartial) { + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); - return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); + return equalObjects(object, other, equalFunc, customizer, bitmask, stack); } module.exports = baseIsEqualDeep; diff --git a/tools/eslint/node_modules/lodash/_baseIsMatch.js b/tools/eslint/node_modules/lodash/_baseIsMatch.js index c1dcafc89c1d2a..d36c8785191183 100644 --- a/tools/eslint/node_modules/lodash/_baseIsMatch.js +++ b/tools/eslint/node_modules/lodash/_baseIsMatch.js @@ -44,9 +44,10 @@ function baseIsMatch(object, source, matchData, customizer) { return false; } } else { - var stack = new Stack, - result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; - + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result diff --git a/tools/eslint/node_modules/lodash/_baseIteratee.js b/tools/eslint/node_modules/lodash/_baseIteratee.js index 19531af3b9ae8c..995c2575672c85 100644 --- a/tools/eslint/node_modules/lodash/_baseIteratee.js +++ b/tools/eslint/node_modules/lodash/_baseIteratee.js @@ -12,14 +12,15 @@ var baseMatches = require('./_baseMatches'), * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { return value; } if (value == null) { return identity; } - if (type == 'object') { + if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); diff --git a/tools/eslint/node_modules/lodash/_baseKeys.js b/tools/eslint/node_modules/lodash/_baseKeys.js index 4b747d50fa2b74..2c8ccb912ce9ed 100644 --- a/tools/eslint/node_modules/lodash/_baseKeys.js +++ b/tools/eslint/node_modules/lodash/_baseKeys.js @@ -6,7 +6,6 @@ var nativeKeys = Object.keys; * property of prototypes or treat sparse arrays as dense. * * @private - * @type Function * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ diff --git a/tools/eslint/node_modules/lodash/_baseLodash.js b/tools/eslint/node_modules/lodash/_baseLodash.js index 15b79d3f7b9a70..f76c790e2e1196 100644 --- a/tools/eslint/node_modules/lodash/_baseLodash.js +++ b/tools/eslint/node_modules/lodash/_baseLodash.js @@ -1,5 +1,5 @@ /** - * The function whose prototype all chaining wrappers inherit from. + * The function whose prototype chain sequence wrappers inherit from. * * @private */ diff --git a/tools/eslint/node_modules/lodash/_baseMatches.js b/tools/eslint/node_modules/lodash/_baseMatches.js index 56c72e6ca2467d..ba9012f946c21c 100644 --- a/tools/eslint/node_modules/lodash/_baseMatches.js +++ b/tools/eslint/node_modules/lodash/_baseMatches.js @@ -1,5 +1,6 @@ var baseIsMatch = require('./_baseIsMatch'), - getMatchData = require('./_getMatchData'); + getMatchData = require('./_getMatchData'), + matchesStrictComparable = require('./_matchesStrictComparable'); /** * The base implementation of `_.matches` which doesn't clone `source`. @@ -11,16 +12,7 @@ var baseIsMatch = require('./_baseIsMatch'), function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; + return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); diff --git a/tools/eslint/node_modules/lodash/_baseMatchesProperty.js b/tools/eslint/node_modules/lodash/_baseMatchesProperty.js index 256ad65f3f1f7b..88afd67e141708 100644 --- a/tools/eslint/node_modules/lodash/_baseMatchesProperty.js +++ b/tools/eslint/node_modules/lodash/_baseMatchesProperty.js @@ -1,6 +1,9 @@ var baseIsEqual = require('./_baseIsEqual'), get = require('./get'), - hasIn = require('./hasIn'); + hasIn = require('./hasIn'), + isKey = require('./_isKey'), + isStrictComparable = require('./_isStrictComparable'), + matchesStrictComparable = require('./_matchesStrictComparable'); /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, @@ -15,6 +18,9 @@ var UNORDERED_COMPARE_FLAG = 1, * @returns {Function} Returns the new function. */ function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(path, srcValue); + } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) diff --git a/tools/eslint/node_modules/lodash/_baseMean.js b/tools/eslint/node_modules/lodash/_baseMean.js new file mode 100644 index 00000000000000..ac99a42317d70f --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseMean.js @@ -0,0 +1,20 @@ +var baseSum = require('./_baseSum'); + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ +function baseMean(array, iteratee) { + var length = array ? array.length : 0; + return length ? (baseSum(array, iteratee) / length) : NAN; +} + +module.exports = baseMean; diff --git a/tools/eslint/node_modules/lodash/_baseMerge.js b/tools/eslint/node_modules/lodash/_baseMerge.js index 97784648496820..e18d3bf750a3ac 100644 --- a/tools/eslint/node_modules/lodash/_baseMerge.js +++ b/tools/eslint/node_modules/lodash/_baseMerge.js @@ -15,13 +15,16 @@ var Stack = require('./_Stack'), * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } - var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); + if (!(isArray(source) || isTypedArray(source))) { + var props = keysIn(source); + } arrayEach(props || source, function(srcValue, key) { if (props) { key = srcValue; @@ -32,7 +35,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { - var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; + var newValue = customizer + ? customizer(object[key], srcValue, (key + ''), object, source, stack) + : undefined; + if (newValue === undefined) { newValue = srcValue; } diff --git a/tools/eslint/node_modules/lodash/_baseMergeDeep.js b/tools/eslint/node_modules/lodash/_baseMergeDeep.js index d5caf3fffe720b..062f004c23ac93 100644 --- a/tools/eslint/node_modules/lodash/_baseMergeDeep.js +++ b/tools/eslint/node_modules/lodash/_baseMergeDeep.js @@ -22,7 +22,8 @@ var assignMergeValue = require('./_assignMergeValue'), * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = object[key], @@ -33,21 +34,24 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta assignMergeValue(object, key, stacked); return; } - var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined, - isCommon = newValue === undefined; + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; if (isCommon) { newValue = srcValue; if (isArray(srcValue) || isTypedArray(srcValue)) { if (isArray(objValue)) { - newValue = srcIndex ? copyArray(objValue) : objValue; + newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { @@ -56,10 +60,10 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta } else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } else { - newValue = srcIndex ? baseClone(objValue) : objValue; + newValue = objValue; } } else { @@ -72,6 +76,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta // Recursively merge objects and arrays (susceptible to call stack limits). mergeFunc(newValue, srcValue, srcIndex, customizer, stack); } + stack['delete'](srcValue); assignMergeValue(object, key, newValue); } diff --git a/tools/eslint/node_modules/lodash/_baseOrderBy.js b/tools/eslint/node_modules/lodash/_baseOrderBy.js index 46186806407a75..319f77a986f196 100644 --- a/tools/eslint/node_modules/lodash/_baseOrderBy.js +++ b/tools/eslint/node_modules/lodash/_baseOrderBy.js @@ -2,7 +2,8 @@ var arrayMap = require('./_arrayMap'), baseIteratee = require('./_baseIteratee'), baseMap = require('./_baseMap'), baseSortBy = require('./_baseSortBy'), - compareMultiple = require('./_compareMultiple'); + compareMultiple = require('./_compareMultiple'), + identity = require('./identity'); /** * The base implementation of `_.orderBy` without param guards. @@ -14,12 +15,8 @@ var arrayMap = require('./_arrayMap'), * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { - var index = -1, - toIteratee = baseIteratee; - - iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) { - return toIteratee(iteratee); - }); + var index = -1; + iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseIteratee); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { diff --git a/tools/eslint/node_modules/lodash/_basePick.js b/tools/eslint/node_modules/lodash/_basePick.js index e2ce7229f83731..7272548307c101 100644 --- a/tools/eslint/node_modules/lodash/_basePick.js +++ b/tools/eslint/node_modules/lodash/_basePick.js @@ -2,11 +2,11 @@ var arrayReduce = require('./_arrayReduce'); /** * The base implementation of `_.pick` without support for individual - * property names. + * property identifiers. * * @private * @param {Object} object The source object. - * @param {string[]} props The property names to pick. + * @param {string[]} props The property identifiers to pick. * @returns {Object} Returns the new object. */ function basePick(object, props) { diff --git a/tools/eslint/node_modules/lodash/_basePickBy.js b/tools/eslint/node_modules/lodash/_basePickBy.js index 37c4943ba19f45..56ffa5f5d7f60d 100644 --- a/tools/eslint/node_modules/lodash/_basePickBy.js +++ b/tools/eslint/node_modules/lodash/_basePickBy.js @@ -1,4 +1,4 @@ -var baseForIn = require('./_baseForIn'); +var getAllKeysIn = require('./_getAllKeysIn'); /** * The base implementation of `_.pickBy` without support for iteratee shorthands. @@ -9,12 +9,19 @@ var baseForIn = require('./_baseForIn'); * @returns {Object} Returns the new object. */ function basePickBy(object, predicate) { - var result = {}; - baseForIn(object, function(value, key) { + var index = -1, + props = getAllKeysIn(object), + length = props.length, + result = {}; + + while (++index < length) { + var key = props[index], + value = object[key]; + if (predicate(value, key)) { result[key] = value; } - }); + } return result; } diff --git a/tools/eslint/node_modules/lodash/_basePullAll.js b/tools/eslint/node_modules/lodash/_basePullAll.js index d54d2b130d1e5f..3c07c994cfd426 100644 --- a/tools/eslint/node_modules/lodash/_basePullAll.js +++ b/tools/eslint/node_modules/lodash/_basePullAll.js @@ -1,15 +1,47 @@ -var basePullAllBy = require('./_basePullAllBy'); +var arrayMap = require('./_arrayMap'), + baseIndexOf = require('./_baseIndexOf'), + baseIndexOfWith = require('./_baseIndexOfWith'), + baseUnary = require('./_baseUnary'); + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; /** - * The base implementation of `_.pullAll`. + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns `array`. */ -function basePullAll(array, values) { - return basePullAllBy(array, values); +function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; } module.exports = basePullAll; diff --git a/tools/eslint/node_modules/lodash/_basePullAllBy.js b/tools/eslint/node_modules/lodash/_basePullAllBy.js deleted file mode 100644 index 00167fad646752..00000000000000 --- a/tools/eslint/node_modules/lodash/_basePullAllBy.js +++ /dev/null @@ -1,43 +0,0 @@ -var arrayMap = require('./_arrayMap'), - baseIndexOf = require('./_baseIndexOf'); - -/** Used for built-in method references. */ -var arrayProto = Array.prototype; - -/** Built-in value references. */ -var splice = arrayProto.splice; - -/** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns `array`. - */ -function basePullAllBy(array, values, iteratee) { - var index = -1, - length = values.length, - seen = array; - - if (iteratee) { - seen = arrayMap(array, function(value) { return iteratee(value); }); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = baseIndexOf(seen, computed, fromIndex)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; -} - -module.exports = basePullAllBy; diff --git a/tools/eslint/node_modules/lodash/_basePullAt.js b/tools/eslint/node_modules/lodash/_basePullAt.js index 206b1965f57034..eb9ed21e8a2a07 100644 --- a/tools/eslint/node_modules/lodash/_basePullAt.js +++ b/tools/eslint/node_modules/lodash/_basePullAt.js @@ -1,4 +1,4 @@ -var baseToPath = require('./_baseToPath'), +var baseCastPath = require('./_baseCastPath'), isIndex = require('./_isIndex'), isKey = require('./_isKey'), last = require('./last'), @@ -31,7 +31,7 @@ function basePullAt(array, indexes) { splice.call(array, index, 1); } else if (!isKey(index, array)) { - var path = baseToPath(index), + var path = baseCastPath(index), object = parent(array, path); if (object != null) { diff --git a/tools/eslint/node_modules/lodash/_baseReduce.js b/tools/eslint/node_modules/lodash/_baseReduce.js index 6ec544251dbb59..5a1f8b57f1f86a 100644 --- a/tools/eslint/node_modules/lodash/_baseReduce.js +++ b/tools/eslint/node_modules/lodash/_baseReduce.js @@ -6,7 +6,8 @@ * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ diff --git a/tools/eslint/node_modules/lodash/_baseRepeat.js b/tools/eslint/node_modules/lodash/_baseRepeat.js new file mode 100644 index 00000000000000..ee44c31ab0c4b1 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseRepeat.js @@ -0,0 +1,35 @@ +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeFloor = Math.floor; + +/** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ +function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; +} + +module.exports = baseRepeat; diff --git a/tools/eslint/node_modules/lodash/_baseSet.js b/tools/eslint/node_modules/lodash/_baseSet.js index 07b18406de78e5..c903e41b5b67b9 100644 --- a/tools/eslint/node_modules/lodash/_baseSet.js +++ b/tools/eslint/node_modules/lodash/_baseSet.js @@ -1,5 +1,5 @@ var assignValue = require('./_assignValue'), - baseToPath = require('./_baseToPath'), + baseCastPath = require('./_baseCastPath'), isIndex = require('./_isIndex'), isKey = require('./_isKey'), isObject = require('./isObject'); @@ -15,7 +15,7 @@ var assignValue = require('./_assignValue'), * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = -1, length = path.length, @@ -30,7 +30,9 @@ function baseSet(object, path, value, customizer) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { - newValue = objValue == null ? (isIndex(path[index + 1]) ? [] : {}) : objValue; + newValue = objValue == null + ? (isIndex(path[index + 1]) ? [] : {}) + : objValue; } } assignValue(nested, key, newValue); diff --git a/tools/eslint/node_modules/lodash/_baseSome.js b/tools/eslint/node_modules/lodash/_baseSome.js index 8b6aa0a265eba6..58f3f447a34ecc 100644 --- a/tools/eslint/node_modules/lodash/_baseSome.js +++ b/tools/eslint/node_modules/lodash/_baseSome.js @@ -6,7 +6,8 @@ var baseEach = require('./_baseEach'); * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ function baseSome(collection, predicate) { var result; diff --git a/tools/eslint/node_modules/lodash/_baseSortBy.js b/tools/eslint/node_modules/lodash/_baseSortBy.js index fec0afeb78f10e..a25c92eda6ebd2 100644 --- a/tools/eslint/node_modules/lodash/_baseSortBy.js +++ b/tools/eslint/node_modules/lodash/_baseSortBy.js @@ -1,7 +1,7 @@ /** - * The base implementation of `_.sortBy` which uses `comparer` to define - * the sort order of `array` and replaces criteria objects with their - * corresponding values. + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. * * @private * @param {Array} array The array to sort. diff --git a/tools/eslint/node_modules/lodash/_baseSortedIndexBy.js b/tools/eslint/node_modules/lodash/_baseSortedIndexBy.js index 6e295f92fe7bbe..c0c7d66a2adacf 100644 --- a/tools/eslint/node_modules/lodash/_baseSortedIndexBy.js +++ b/tools/eslint/node_modules/lodash/_baseSortedIndexBy.js @@ -16,7 +16,8 @@ var nativeFloor = Math.floor, * @param {*} value The value to evaluate. * @param {Function} iteratee The iteratee invoked per element. * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { value = iteratee(value); diff --git a/tools/eslint/node_modules/lodash/_baseSortedUniqBy.js b/tools/eslint/node_modules/lodash/_baseSortedUniqBy.js index c95a83f24342f0..81e7ae1bc339b4 100644 --- a/tools/eslint/node_modules/lodash/_baseSortedUniqBy.js +++ b/tools/eslint/node_modules/lodash/_baseSortedUniqBy.js @@ -15,7 +15,7 @@ function baseSortedUniqBy(array, iteratee) { value = array[0], computed = iteratee ? iteratee(value) : value, seen = computed, - resIndex = 0, + resIndex = 1, result = [value]; while (++index < length) { @@ -24,7 +24,7 @@ function baseSortedUniqBy(array, iteratee) { if (!eq(computed, seen)) { seen = computed; - result[++resIndex] = value; + result[resIndex++] = value; } } return result; diff --git a/tools/eslint/node_modules/lodash/_baseSum.js b/tools/eslint/node_modules/lodash/_baseSum.js index 348b5e8c0aabac..a9e84c13c9098c 100644 --- a/tools/eslint/node_modules/lodash/_baseSum.js +++ b/tools/eslint/node_modules/lodash/_baseSum.js @@ -1,5 +1,6 @@ /** - * The base implementation of `_.sum` without support for iteratee shorthands. + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. diff --git a/tools/eslint/node_modules/lodash/_baseToPath.js b/tools/eslint/node_modules/lodash/_baseToPath.js deleted file mode 100644 index eb45827cac4142..00000000000000 --- a/tools/eslint/node_modules/lodash/_baseToPath.js +++ /dev/null @@ -1,16 +0,0 @@ -var isArray = require('./isArray'), - stringToPath = require('./_stringToPath'); - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -module.exports = baseToPath; diff --git a/tools/eslint/node_modules/lodash/_baseUnset.js b/tools/eslint/node_modules/lodash/_baseUnset.js index 2be1c1270814a0..9100d6fc8cd068 100644 --- a/tools/eslint/node_modules/lodash/_baseUnset.js +++ b/tools/eslint/node_modules/lodash/_baseUnset.js @@ -1,4 +1,4 @@ -var baseToPath = require('./_baseToPath'), +var baseCastPath = require('./_baseCastPath'), has = require('./has'), isKey = require('./_isKey'), last = require('./last'), @@ -13,7 +13,7 @@ var baseToPath = require('./_baseToPath'), * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ function baseUnset(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); object = parent(object, path); var key = last(path); return (object != null && has(object, key)) ? delete object[key] : true; diff --git a/tools/eslint/node_modules/lodash/_baseUpdate.js b/tools/eslint/node_modules/lodash/_baseUpdate.js new file mode 100644 index 00000000000000..ec1b338366d8eb --- /dev/null +++ b/tools/eslint/node_modules/lodash/_baseUpdate.js @@ -0,0 +1,18 @@ +var baseGet = require('./_baseGet'), + baseSet = require('./_baseSet'); + +/** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ +function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); +} + +module.exports = baseUpdate; diff --git a/tools/eslint/node_modules/lodash/_baseZipObject.js b/tools/eslint/node_modules/lodash/_baseZipObject.js index c8a3e833ed5ac2..401f85be20b458 100644 --- a/tools/eslint/node_modules/lodash/_baseZipObject.js +++ b/tools/eslint/node_modules/lodash/_baseZipObject.js @@ -2,7 +2,7 @@ * This base implementation of `_.zipObject` which assigns values using `assignFunc`. * * @private - * @param {Array} props The property names. + * @param {Array} props The property identifiers. * @param {Array} values The property values. * @param {Function} assignFunc The function to assign values. * @returns {Object} Returns the new object. @@ -14,7 +14,8 @@ function baseZipObject(props, values, assignFunc) { result = {}; while (++index < length) { - assignFunc(result, props[index], index < valsLength ? values[index] : undefined); + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); } return result; } diff --git a/tools/eslint/node_modules/lodash/_cloneArrayBuffer.js b/tools/eslint/node_modules/lodash/_cloneArrayBuffer.js index a7ed50cddbed20..c3d8f6e39a61ad 100644 --- a/tools/eslint/node_modules/lodash/_cloneArrayBuffer.js +++ b/tools/eslint/node_modules/lodash/_cloneArrayBuffer.js @@ -8,11 +8,8 @@ var Uint8Array = require('./_Uint8Array'); * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { - var Ctor = arrayBuffer.constructor, - result = new Ctor(arrayBuffer.byteLength), - view = new Uint8Array(result); - - view.set(new Uint8Array(arrayBuffer)); + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } diff --git a/tools/eslint/node_modules/lodash/_cloneBuffer.js b/tools/eslint/node_modules/lodash/_cloneBuffer.js index 58a4e2bdd857ee..247d4106f7f3c1 100644 --- a/tools/eslint/node_modules/lodash/_cloneBuffer.js +++ b/tools/eslint/node_modules/lodash/_cloneBuffer.js @@ -10,9 +10,7 @@ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } - var Ctor = buffer.constructor, - result = new Ctor(buffer.length); - + var result = new buffer.constructor(buffer.length); buffer.copy(result); return result; } diff --git a/tools/eslint/node_modules/lodash/_cloneDataView.js b/tools/eslint/node_modules/lodash/_cloneDataView.js new file mode 100644 index 00000000000000..9c9b7b054d5e2c --- /dev/null +++ b/tools/eslint/node_modules/lodash/_cloneDataView.js @@ -0,0 +1,16 @@ +var cloneArrayBuffer = require('./_cloneArrayBuffer'); + +/** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ +function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); +} + +module.exports = cloneDataView; diff --git a/tools/eslint/node_modules/lodash/_cloneMap.js b/tools/eslint/node_modules/lodash/_cloneMap.js index 1b5af07f8b3453..b51983d24c7bec 100644 --- a/tools/eslint/node_modules/lodash/_cloneMap.js +++ b/tools/eslint/node_modules/lodash/_cloneMap.js @@ -7,11 +7,13 @@ var addMapEntry = require('./_addMapEntry'), * * @private * @param {Object} map The map to clone. + * @param {Function} cloneFunc The function to clone values. + * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned map. */ -function cloneMap(map) { - var Ctor = map.constructor; - return arrayReduce(mapToArray(map), addMapEntry, new Ctor); +function cloneMap(map, isDeep, cloneFunc) { + var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map); + return arrayReduce(array, addMapEntry, new map.constructor); } module.exports = cloneMap; diff --git a/tools/eslint/node_modules/lodash/_cloneRegExp.js b/tools/eslint/node_modules/lodash/_cloneRegExp.js index f36fd5730aa4c4..64a30dfb4ac39a 100644 --- a/tools/eslint/node_modules/lodash/_cloneRegExp.js +++ b/tools/eslint/node_modules/lodash/_cloneRegExp.js @@ -9,9 +9,7 @@ var reFlags = /\w*$/; * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { - var Ctor = regexp.constructor, - result = new Ctor(regexp.source, reFlags.exec(regexp)); - + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } diff --git a/tools/eslint/node_modules/lodash/_cloneSet.js b/tools/eslint/node_modules/lodash/_cloneSet.js index a6fa4a2f86e9db..dc1db95c618d3d 100644 --- a/tools/eslint/node_modules/lodash/_cloneSet.js +++ b/tools/eslint/node_modules/lodash/_cloneSet.js @@ -7,11 +7,13 @@ var addSetEntry = require('./_addSetEntry'), * * @private * @param {Object} set The set to clone. + * @param {Function} cloneFunc The function to clone values. + * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned set. */ -function cloneSet(set) { - var Ctor = set.constructor; - return arrayReduce(setToArray(set), addSetEntry, new Ctor); +function cloneSet(set, isDeep, cloneFunc) { + var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set); + return arrayReduce(array, addSetEntry, new set.constructor); } module.exports = cloneSet; diff --git a/tools/eslint/node_modules/lodash/_cloneSymbol.js b/tools/eslint/node_modules/lodash/_cloneSymbol.js index ac0217d74e056b..bede39f50a6fcd 100644 --- a/tools/eslint/node_modules/lodash/_cloneSymbol.js +++ b/tools/eslint/node_modules/lodash/_cloneSymbol.js @@ -2,7 +2,7 @@ var Symbol = require('./_Symbol'); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = Symbol ? symbolProto.valueOf : undefined; + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * Creates a clone of the `symbol` object. @@ -12,7 +12,7 @@ var symbolProto = Symbol ? Symbol.prototype : undefined, * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { - return Symbol ? Object(symbolValueOf.call(symbol)) : {}; + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; } module.exports = cloneSymbol; diff --git a/tools/eslint/node_modules/lodash/_cloneTypedArray.js b/tools/eslint/node_modules/lodash/_cloneTypedArray.js index 8a2d0f7e65810b..7aad84d4fec4bc 100644 --- a/tools/eslint/node_modules/lodash/_cloneTypedArray.js +++ b/tools/eslint/node_modules/lodash/_cloneTypedArray.js @@ -9,10 +9,8 @@ var cloneArrayBuffer = require('./_cloneArrayBuffer'); * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, - Ctor = typedArray.constructor; - - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } module.exports = cloneTypedArray; diff --git a/tools/eslint/node_modules/lodash/_compareMultiple.js b/tools/eslint/node_modules/lodash/_compareMultiple.js index a3f2d8b9a3e065..ad61f0fbcaa404 100644 --- a/tools/eslint/node_modules/lodash/_compareMultiple.js +++ b/tools/eslint/node_modules/lodash/_compareMultiple.js @@ -37,7 +37,7 @@ function compareMultiple(object, other, orders) { // for more details. // // This also ensures a stable sort in V8 and other engines. - // See https://code.google.com/p/v8/issues/detail?id=90 for more details. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } diff --git a/tools/eslint/node_modules/lodash/_composeArgs.js b/tools/eslint/node_modules/lodash/_composeArgs.js index 863f71f7e09a9b..07398e78409486 100644 --- a/tools/eslint/node_modules/lodash/_composeArgs.js +++ b/tools/eslint/node_modules/lodash/_composeArgs.js @@ -9,23 +9,28 @@ var nativeMax = Math.max; * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ -function composeArgs(args, partials, holders) { - var holdersLength = holders.length, - argsIndex = -1, - argsLength = nativeMax(args.length - holdersLength, 0), +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, - result = Array(leftLength + argsLength); + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { - result[holders[argsIndex]] = args[argsIndex]; + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } } - while (argsLength--) { + while (rangeLength--) { result[leftIndex++] = args[argsIndex++]; } return result; diff --git a/tools/eslint/node_modules/lodash/_composeArgsRight.js b/tools/eslint/node_modules/lodash/_composeArgsRight.js index 4bb639b86c4689..18cfae0340efdc 100644 --- a/tools/eslint/node_modules/lodash/_composeArgsRight.js +++ b/tools/eslint/node_modules/lodash/_composeArgsRight.js @@ -9,18 +9,21 @@ var nativeMax = Math.max; * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ -function composeArgsRight(args, partials, holders) { - var holdersIndex = -1, +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, holdersLength = holders.length, - argsIndex = -1, - argsLength = nativeMax(args.length - holdersLength, 0), rightIndex = -1, rightLength = partials.length, - result = Array(argsLength + rightLength); + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; - while (++argsIndex < argsLength) { + while (++argsIndex < rangeLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; @@ -28,7 +31,9 @@ function composeArgsRight(args, partials, holders) { result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } } return result; } diff --git a/tools/eslint/node_modules/lodash/_copyObject.js b/tools/eslint/node_modules/lodash/_copyObject.js index f8406b6547b62d..d95a4cbdc559a2 100644 --- a/tools/eslint/node_modules/lodash/_copyObject.js +++ b/tools/eslint/node_modules/lodash/_copyObject.js @@ -5,7 +5,7 @@ var copyObjectWith = require('./_copyObjectWith'); * * @private * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. + * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @returns {Object} Returns `object`. */ diff --git a/tools/eslint/node_modules/lodash/_copyObjectWith.js b/tools/eslint/node_modules/lodash/_copyObjectWith.js index ac5b9d3be81e37..11240c60699c96 100644 --- a/tools/eslint/node_modules/lodash/_copyObjectWith.js +++ b/tools/eslint/node_modules/lodash/_copyObjectWith.js @@ -6,7 +6,7 @@ var assignValue = require('./_assignValue'); * * @private * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. + * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. @@ -18,8 +18,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } diff --git a/tools/eslint/node_modules/lodash/_countHolders.js b/tools/eslint/node_modules/lodash/_countHolders.js new file mode 100644 index 00000000000000..8cc95e6e0e6d6f --- /dev/null +++ b/tools/eslint/node_modules/lodash/_countHolders.js @@ -0,0 +1,21 @@ +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; +} + +module.exports = countHolders; diff --git a/tools/eslint/node_modules/lodash/_createAssigner.js b/tools/eslint/node_modules/lodash/_createAssigner.js index 72c3039e5a3067..1e81db9319a10d 100644 --- a/tools/eslint/node_modules/lodash/_createAssigner.js +++ b/tools/eslint/node_modules/lodash/_createAssigner.js @@ -15,7 +15,10 @@ function createAssigner(assigner) { customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; - customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; + customizer = typeof customizer == 'function' + ? (length--, customizer) + : undefined; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; diff --git a/tools/eslint/node_modules/lodash/_createBaseFor.js b/tools/eslint/node_modules/lodash/_createBaseFor.js index bc84c037a5b819..94cbf297aa2031 100644 --- a/tools/eslint/node_modules/lodash/_createBaseFor.js +++ b/tools/eslint/node_modules/lodash/_createBaseFor.js @@ -1,5 +1,5 @@ /** - * Creates a base function for methods like `_.forIn`. + * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. diff --git a/tools/eslint/node_modules/lodash/_createBaseWrapper.js b/tools/eslint/node_modules/lodash/_createBaseWrapper.js index fd3bb9a695ee39..c365621bd747e3 100644 --- a/tools/eslint/node_modules/lodash/_createBaseWrapper.js +++ b/tools/eslint/node_modules/lodash/_createBaseWrapper.js @@ -10,7 +10,8 @@ var BIND_FLAG = 1; * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new wrapped function. */ diff --git a/tools/eslint/node_modules/lodash/_createCaseFirst.js b/tools/eslint/node_modules/lodash/_createCaseFirst.js index 5718f6f4aa8ef3..a6f70543eb659b 100644 --- a/tools/eslint/node_modules/lodash/_createCaseFirst.js +++ b/tools/eslint/node_modules/lodash/_createCaseFirst.js @@ -24,8 +24,11 @@ function createCaseFirst(methodName) { return function(string) { string = toString(string); - var strSymbols = reHasComplexSymbol.test(string) ? stringToArray(string) : undefined, - chr = strSymbols ? strSymbols[0] : string.charAt(0), + var strSymbols = reHasComplexSymbol.test(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols ? strSymbols[0] : string.charAt(0), trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); return chr[methodName]() + trailing; diff --git a/tools/eslint/node_modules/lodash/_createCtorWrapper.js b/tools/eslint/node_modules/lodash/_createCtorWrapper.js index a0a7f83d70e760..17e1bd8314f420 100644 --- a/tools/eslint/node_modules/lodash/_createCtorWrapper.js +++ b/tools/eslint/node_modules/lodash/_createCtorWrapper.js @@ -11,8 +11,8 @@ var baseCreate = require('./_baseCreate'), */ function createCtorWrapper(Ctor) { return function() { - // Use a `switch` statement to work with class constructors. - // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; switch (args.length) { diff --git a/tools/eslint/node_modules/lodash/_createCurryWrapper.js b/tools/eslint/node_modules/lodash/_createCurryWrapper.js index 2fc9f7e6c9716c..c48ba62402ab3d 100644 --- a/tools/eslint/node_modules/lodash/_createCurryWrapper.js +++ b/tools/eslint/node_modules/lodash/_createCurryWrapper.js @@ -2,6 +2,7 @@ var apply = require('./_apply'), createCtorWrapper = require('./_createCtorWrapper'), createHybridWrapper = require('./_createHybridWrapper'), createRecurryWrapper = require('./_createRecurryWrapper'), + getPlaceholder = require('./_getPlaceholder'), replaceHolders = require('./_replaceHolders'), root = require('./_root'); @@ -10,7 +11,8 @@ var apply = require('./_apply'), * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {number} arity The arity of `func`. * @returns {Function} Returns the new wrapped function. */ @@ -19,10 +21,9 @@ function createCurryWrapper(func, bitmask, arity) { function wrapper() { var length = arguments.length, - index = length, args = Array(length), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, - placeholder = wrapper.placeholder; + index = length, + placeholder = getPlaceholder(wrapper); while (index--) { args[index] = arguments[index]; @@ -32,9 +33,13 @@ function createCurryWrapper(func, bitmask, arity) { : replaceHolders(args, placeholder); length -= holders.length; - return length < arity - ? createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, undefined, args, holders, undefined, undefined, arity - length) - : apply(fn, this, args); + if (length < arity) { + return createRecurryWrapper( + func, bitmask, createHybridWrapper, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); } return wrapper; } diff --git a/tools/eslint/node_modules/lodash/_createFlow.js b/tools/eslint/node_modules/lodash/_createFlow.js index 1d5e5f18137b9f..6b5ee54be1ef50 100644 --- a/tools/eslint/node_modules/lodash/_createFlow.js +++ b/tools/eslint/node_modules/lodash/_createFlow.js @@ -6,18 +6,18 @@ var LodashWrapper = require('./_LodashWrapper'), isLaziable = require('./_isLaziable'), rest = require('./rest'); -/** Used to compose bitmasks for wrapper metadata. */ -var CURRY_FLAG = 8, - PARTIAL_FLAG = 32, - ARY_FLAG = 128, - REARG_FLAG = 256; - /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; +/** Used to compose bitmasks for wrapper metadata. */ +var CURRY_FLAG = 8, + PARTIAL_FLAG = 32, + ARY_FLAG = 128, + REARG_FLAG = 256; + /** * Creates a `_.flow` or `_.flowRight` function. * @@ -27,7 +27,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; */ function createFlow(fromRight) { return rest(function(funcs) { - funcs = baseFlatten(funcs); + funcs = baseFlatten(funcs, 1); var length = funcs.length, index = length, @@ -52,17 +52,23 @@ function createFlow(fromRight) { var funcName = getFuncName(func), data = funcName == 'wrapper' ? getData(func) : undefined; - if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { + if (data && isLaziable(data[0]) && + data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { - wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; - if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { + if (wrapper && args.length == 1 && + isArray(value) && value.length >= LARGE_ARRAY_SIZE) { return wrapper.plant(value).value(); } var index = 0, diff --git a/tools/eslint/node_modules/lodash/_createHybridWrapper.js b/tools/eslint/node_modules/lodash/_createHybridWrapper.js index 7d34c74916548f..144a90d7931b40 100644 --- a/tools/eslint/node_modules/lodash/_createHybridWrapper.js +++ b/tools/eslint/node_modules/lodash/_createHybridWrapper.js @@ -1,7 +1,9 @@ var composeArgs = require('./_composeArgs'), composeArgsRight = require('./_composeArgsRight'), + countHolders = require('./_countHolders'), createCtorWrapper = require('./_createCtorWrapper'), createRecurryWrapper = require('./_createRecurryWrapper'), + getPlaceholder = require('./_getPlaceholder'), reorder = require('./_reorder'), replaceHolders = require('./_replaceHolders'), root = require('./_root'); @@ -20,11 +22,14 @@ var BIND_FLAG = 1, * * @private * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to the new function. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided to the new function. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. @@ -35,8 +40,7 @@ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partials var isAry = bitmask & ARY_FLAG, isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, - isCurry = bitmask & CURRY_FLAG, - isCurryRight = bitmask & CURRY_RIGHT_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), isFlip = bitmask & FLIP_FLAG, Ctor = isBindKey ? undefined : createCtorWrapper(func); @@ -48,30 +52,34 @@ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partials while (index--) { args[index] = arguments[index]; } + if (isCurried) { + var placeholder = getPlaceholder(wrapper), + holdersCount = countHolders(args, placeholder); + } if (partials) { - args = composeArgs(args, partials, holders); + args = composeArgs(args, partials, holders, isCurried); } if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight); + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); } - if (isCurry || isCurryRight) { - var placeholder = wrapper.placeholder, - argsHolders = replaceHolders(args, placeholder); - - length -= argsHolders.length; - if (length < arity) { - return createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, thisArg, args, argsHolders, argPos, ary, arity - length); - } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurryWrapper( + func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; + length = args.length; if (argPos) { args = reorder(args, argPos); - } else if (isFlip && args.length > 1) { + } else if (isFlip && length > 1) { args.reverse(); } - if (isAry && ary < args.length) { + if (isAry && ary < length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { diff --git a/tools/eslint/node_modules/lodash/_createMathOperation.js b/tools/eslint/node_modules/lodash/_createMathOperation.js new file mode 100644 index 00000000000000..56a4d447d0b367 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_createMathOperation.js @@ -0,0 +1,24 @@ +/** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new mathematical operation function. + */ +function createMathOperation(operator) { + return function(value, other) { + var result; + if (value === undefined && other === undefined) { + return 0; + } + if (value !== undefined) { + result = value; + } + if (other !== undefined) { + result = result === undefined ? other : operator(result, other); + } + return result; + }; +} + +module.exports = createMathOperation; diff --git a/tools/eslint/node_modules/lodash/_createOver.js b/tools/eslint/node_modules/lodash/_createOver.js index 62fed02167cfcd..b34ca964c21748 100644 --- a/tools/eslint/node_modules/lodash/_createOver.js +++ b/tools/eslint/node_modules/lodash/_createOver.js @@ -2,6 +2,7 @@ var apply = require('./_apply'), arrayMap = require('./_arrayMap'), baseFlatten = require('./_baseFlatten'), baseIteratee = require('./_baseIteratee'), + isFlattenableIteratee = require('./_isFlattenableIteratee'), rest = require('./rest'); /** @@ -13,7 +14,7 @@ var apply = require('./_apply'), */ function createOver(arrayFunc) { return rest(function(iteratees) { - iteratees = arrayMap(baseFlatten(iteratees), baseIteratee); + iteratees = arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseIteratee); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { diff --git a/tools/eslint/node_modules/lodash/_createPadding.js b/tools/eslint/node_modules/lodash/_createPadding.js index e59cc5212e748e..2626376aeaecbb 100644 --- a/tools/eslint/node_modules/lodash/_createPadding.js +++ b/tools/eslint/node_modules/lodash/_createPadding.js @@ -1,7 +1,6 @@ -var repeat = require('./repeat'), +var baseRepeat = require('./_baseRepeat'), stringSize = require('./_stringSize'), - stringToArray = require('./_stringToArray'), - toInteger = require('./toInteger'); + stringToArray = require('./_stringToArray'); /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', @@ -23,25 +22,21 @@ var nativeCeil = Math.ceil; * is truncated if the number of characters exceeds `length`. * * @private - * @param {string} string The string to create padding for. - * @param {number} [length=0] The padding length. + * @param {number} length The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padding for `string`. */ -function createPadding(string, length, chars) { - length = toInteger(length); - - var strLength = stringSize(string); - if (!length || strLength >= length) { - return ''; - } - var padLength = length - strLength; +function createPadding(length, chars) { chars = chars === undefined ? ' ' : (chars + ''); - var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); return reHasComplexSymbol.test(chars) - ? stringToArray(result).slice(0, padLength).join('') - : result.slice(0, padLength); + ? stringToArray(result).slice(0, length).join('') + : result.slice(0, length); } module.exports = createPadding; diff --git a/tools/eslint/node_modules/lodash/_createPartialWrapper.js b/tools/eslint/node_modules/lodash/_createPartialWrapper.js index 1fc3a9b01eb783..cc4314ef9f5db1 100644 --- a/tools/eslint/node_modules/lodash/_createPartialWrapper.js +++ b/tools/eslint/node_modules/lodash/_createPartialWrapper.js @@ -6,15 +6,16 @@ var apply = require('./_apply'), var BIND_FLAG = 1; /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg` and the `partials` prepended to those provided to - * the wrapper. + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to the new function. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. * @returns {Function} Returns the new wrapped function. */ function createPartialWrapper(func, bitmask, thisArg, partials) { diff --git a/tools/eslint/node_modules/lodash/_createRecurryWrapper.js b/tools/eslint/node_modules/lodash/_createRecurryWrapper.js index 2e3f10a89e9438..47e5e3a740c80b 100644 --- a/tools/eslint/node_modules/lodash/_createRecurryWrapper.js +++ b/tools/eslint/node_modules/lodash/_createRecurryWrapper.js @@ -15,11 +15,13 @@ var BIND_FLAG = 1, * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder to replace. + * @param {*} placeholder The placeholder value. * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to the new function. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. @@ -29,7 +31,7 @@ var BIND_FLAG = 1, function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & CURRY_FLAG, newArgPos = argPos ? copyArray(argPos) : undefined, - newsHolders = isCurry ? holders : undefined, + newHolders = isCurry ? holders : undefined, newHoldersRight = isCurry ? undefined : holders, newPartials = isCurry ? partials : undefined, newPartialsRight = isCurry ? undefined : partials; @@ -40,9 +42,12 @@ function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, par if (!(bitmask & CURRY_BOUND_FLAG)) { bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); } - var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity], - result = wrapFunc.apply(undefined, newData); + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, newArgPos, ary, arity + ]; + var result = wrapFunc.apply(undefined, newData); if (isLaziable(func)) { setData(result, newData); } diff --git a/tools/eslint/node_modules/lodash/_createWrapper.js b/tools/eslint/node_modules/lodash/_createWrapper.js index f391c1a359940c..7b573b2f133f64 100644 --- a/tools/eslint/node_modules/lodash/_createWrapper.js +++ b/tools/eslint/node_modules/lodash/_createWrapper.js @@ -8,6 +8,9 @@ var baseSetData = require('./_baseSetData'), setData = require('./_setData'), toInteger = require('./toInteger'); +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, BIND_KEY_FLAG = 2, @@ -16,9 +19,6 @@ var BIND_FLAG = 1, PARTIAL_FLAG = 32, PARTIAL_RIGHT_FLAG = 64; -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; @@ -67,8 +67,12 @@ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, a partials = holders = undefined; } - var data = isBindKey ? undefined : getData(func), - newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; + var data = isBindKey ? undefined : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; if (data) { mergeData(newData, data); diff --git a/tools/eslint/node_modules/lodash/_equalArrays.js b/tools/eslint/node_modules/lodash/_equalArrays.js index f789ee5887cead..323c67cc8d4335 100644 --- a/tools/eslint/node_modules/lodash/_equalArrays.js +++ b/tools/eslint/node_modules/lodash/_equalArrays.js @@ -12,9 +12,10 @@ var UNORDERED_COMPARE_FLAG = 1, * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `array` and `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { @@ -55,12 +56,16 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { // Recursively compare arrays (susceptible to call stack limits). if (isUnordered) { if (!arraySome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); + return arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack); })) { result = false; break; } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack) + )) { result = false; break; } diff --git a/tools/eslint/node_modules/lodash/_equalByTag.js b/tools/eslint/node_modules/lodash/_equalByTag.js index bc503f3f5c2cf2..b3e37bd8a5f322 100644 --- a/tools/eslint/node_modules/lodash/_equalByTag.js +++ b/tools/eslint/node_modules/lodash/_equalByTag.js @@ -1,5 +1,6 @@ var Symbol = require('./_Symbol'), Uint8Array = require('./_Uint8Array'), + equalArrays = require('./_equalArrays'), mapToArray = require('./_mapToArray'), setToArray = require('./_setToArray'); @@ -18,11 +19,12 @@ var boolTag = '[object Boolean]', stringTag = '[object String]', symbolTag = '[object Symbol]'; -var arrayBufferTag = '[object ArrayBuffer]'; +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]'; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = Symbol ? symbolProto.valueOf : undefined; + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * A specialized version of `baseIsEqualDeep` for comparing objects of @@ -36,12 +38,22 @@ var symbolProto = Symbol ? Symbol.prototype : undefined, * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ -function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { +function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { @@ -51,8 +63,9 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { case boolTag: case dateTag: - // Coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + // Coerce dates and booleans to numbers, dates to milliseconds and + // booleans to `1` or `0` treating invalid dates coerced to `NaN` as + // not equal. return +object == +other; case errorTag: @@ -64,8 +77,9 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { case regexpTag: case stringTag: - // Coerce regexes to strings and treat strings primitives and string - // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring + // for more details. return object == (other + ''); case mapTag: @@ -75,12 +89,24 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { var isPartial = bitmask & PARTIAL_COMPARE_FLAG; convert || (convert = setToArray); + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= UNORDERED_COMPARE_FLAG; + stack.set(object, other); + // Recursively compare objects (susceptible to call stack limits). - return (isPartial || object.size == other.size) && - equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); + return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); case symbolTag: - return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } } return false; } diff --git a/tools/eslint/node_modules/lodash/_equalObjects.js b/tools/eslint/node_modules/lodash/_equalObjects.js index 8e4a8547b05c57..9a5d17fac1bed0 100644 --- a/tools/eslint/node_modules/lodash/_equalObjects.js +++ b/tools/eslint/node_modules/lodash/_equalObjects.js @@ -12,9 +12,10 @@ var PARTIAL_COMPARE_FLAG = 2; * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { diff --git a/tools/eslint/node_modules/lodash/_getAllKeys.js b/tools/eslint/node_modules/lodash/_getAllKeys.js new file mode 100644 index 00000000000000..a9ce6995a6ad27 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_getAllKeys.js @@ -0,0 +1,16 @@ +var baseGetAllKeys = require('./_baseGetAllKeys'), + getSymbols = require('./_getSymbols'), + keys = require('./keys'); + +/** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ +function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); +} + +module.exports = getAllKeys; diff --git a/tools/eslint/node_modules/lodash/_getAllKeysIn.js b/tools/eslint/node_modules/lodash/_getAllKeysIn.js new file mode 100644 index 00000000000000..1b4667841db49a --- /dev/null +++ b/tools/eslint/node_modules/lodash/_getAllKeysIn.js @@ -0,0 +1,17 @@ +var baseGetAllKeys = require('./_baseGetAllKeys'), + getSymbolsIn = require('./_getSymbolsIn'), + keysIn = require('./keysIn'); + +/** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ +function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); +} + +module.exports = getAllKeysIn; diff --git a/tools/eslint/node_modules/lodash/_getLength.js b/tools/eslint/node_modules/lodash/_getLength.js index 1848d490183617..54071653aadbe9 100644 --- a/tools/eslint/node_modules/lodash/_getLength.js +++ b/tools/eslint/node_modules/lodash/_getLength.js @@ -3,8 +3,9 @@ var baseProperty = require('./_baseProperty'); /** * Gets the "length" property value of `object`. * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. diff --git a/tools/eslint/node_modules/lodash/_getNative.js b/tools/eslint/node_modules/lodash/_getNative.js index b85007aee81dac..f6ff7f19b97122 100644 --- a/tools/eslint/node_modules/lodash/_getNative.js +++ b/tools/eslint/node_modules/lodash/_getNative.js @@ -9,7 +9,7 @@ var isNative = require('./isNative'); * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object == null ? undefined : object[key]; + var value = object[key]; return isNative(value) ? value : undefined; } diff --git a/tools/eslint/node_modules/lodash/_getPlaceholder.js b/tools/eslint/node_modules/lodash/_getPlaceholder.js new file mode 100644 index 00000000000000..4bbcda25ecb6db --- /dev/null +++ b/tools/eslint/node_modules/lodash/_getPlaceholder.js @@ -0,0 +1,13 @@ +/** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ +function getPlaceholder(func) { + var object = func; + return object.placeholder; +} + +module.exports = getPlaceholder; diff --git a/tools/eslint/node_modules/lodash/_getPrototype.js b/tools/eslint/node_modules/lodash/_getPrototype.js new file mode 100644 index 00000000000000..1ef6d927e31c09 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_getPrototype.js @@ -0,0 +1,15 @@ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetPrototype = Object.getPrototypeOf; + +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +function getPrototype(value) { + return nativeGetPrototype(Object(value)); +} + +module.exports = getPrototype; diff --git a/tools/eslint/node_modules/lodash/_getSymbols.js b/tools/eslint/node_modules/lodash/_getSymbols.js index 266906a027fe3a..63df71742d6a50 100644 --- a/tools/eslint/node_modules/lodash/_getSymbols.js +++ b/tools/eslint/node_modules/lodash/_getSymbols.js @@ -2,14 +2,23 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols; /** - * Creates an array of the own symbol properties of `object`. + * Creates an array of the own enumerable symbol properties of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ -var getSymbols = getOwnPropertySymbols || function() { - return []; -}; +function getSymbols(object) { + // Coerce `object` to an object to avoid non-object errors in V8. + // See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details. + return getOwnPropertySymbols(Object(object)); +} + +// Fallback for IE < 11. +if (!getOwnPropertySymbols) { + getSymbols = function() { + return []; + }; +} module.exports = getSymbols; diff --git a/tools/eslint/node_modules/lodash/_getSymbolsIn.js b/tools/eslint/node_modules/lodash/_getSymbolsIn.js new file mode 100644 index 00000000000000..3a3729f05b78c1 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_getSymbolsIn.js @@ -0,0 +1,25 @@ +var arrayPush = require('./_arrayPush'), + getPrototype = require('./_getPrototype'), + getSymbols = require('./_getSymbols'); + +/** Built-in value references. */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; + +/** + * Creates an array of the own and inherited enumerable symbol properties + * of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ +var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; +}; + +module.exports = getSymbolsIn; diff --git a/tools/eslint/node_modules/lodash/_getTag.js b/tools/eslint/node_modules/lodash/_getTag.js index 1516eca3923a1e..0d1a455c1bd33f 100644 --- a/tools/eslint/node_modules/lodash/_getTag.js +++ b/tools/eslint/node_modules/lodash/_getTag.js @@ -1,29 +1,35 @@ -var Map = require('./_Map'), +var DataView = require('./_DataView'), + Map = require('./_Map'), + Promise = require('./_Promise'), Set = require('./_Set'), - WeakMap = require('./_WeakMap'); + WeakMap = require('./_WeakMap'), + toSource = require('./_toSource'); /** `Object#toString` result references. */ var mapTag = '[object Map]', objectTag = '[object Object]', + promiseTag = '[object Promise]', setTag = '[object Set]', weakMapTag = '[object WeakMap]'; +var dataViewTag = '[object DataView]'; + /** Used for built-in method references. */ var objectProto = Object.prototype; -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to detect maps, sets, and weakmaps. */ -var mapCtorString = Map ? funcToString.call(Map) : '', - setCtorString = Set ? funcToString.call(Set) : '', - weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; +var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); /** * Gets the `toStringTag` of `value`. @@ -36,18 +42,23 @@ function getTag(value) { return objectToString.call(value); } -// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps. -if ((Map && getTag(new Map) != mapTag) || +// Fallback for data views, maps, sets, and weak maps in IE 11, +// for data views in Edge, and promises in Node.js. +if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = objectToString.call(value), - Ctor = result == objectTag ? value.constructor : null, - ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : undefined; if (ctorString) { switch (ctorString) { + case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } diff --git a/tools/eslint/node_modules/lodash/_hasPath.js b/tools/eslint/node_modules/lodash/_hasPath.js index c063592ce9a5fc..eea7e72ab16454 100644 --- a/tools/eslint/node_modules/lodash/_hasPath.js +++ b/tools/eslint/node_modules/lodash/_hasPath.js @@ -1,12 +1,10 @@ -var baseToPath = require('./_baseToPath'), +var baseCastPath = require('./_baseCastPath'), isArguments = require('./isArguments'), isArray = require('./isArray'), isIndex = require('./_isIndex'), isKey = require('./_isKey'), isLength = require('./isLength'), - isString = require('./isString'), - last = require('./last'), - parent = require('./_parent'); + isString = require('./isString'); /** * Checks if `path` exists on `object`. @@ -18,23 +16,25 @@ var baseToPath = require('./_baseToPath'), * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { - if (object == null) { - return false; - } - var result = hasFunc(object, path); - if (!result && !isKey(path)) { - path = baseToPath(path); - object = parent(object, path); - if (object != null) { - path = last(path); - result = hasFunc(object, path); + path = isKey(path, object) ? [path] : baseCastPath(path); + + var result, + index = -1, + length = path.length; + + while (++index < length) { + var key = path[index]; + if (!(result = object != null && hasFunc(object, key))) { + break; } + object = object[key]; + } + if (result) { + return result; } - var length = object ? object.length : undefined; - return result || ( - !!length && isLength(length) && isIndex(path, length) && - (isArray(object) || isString(object) || isArguments(object)) - ); + var length = object ? object.length : 0; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isString(object) || isArguments(object)); } module.exports = hasPath; diff --git a/tools/eslint/node_modules/lodash/_initCloneByTag.js b/tools/eslint/node_modules/lodash/_initCloneByTag.js index 5d21cda7f6ca25..e7b77edc696e4a 100644 --- a/tools/eslint/node_modules/lodash/_initCloneByTag.js +++ b/tools/eslint/node_modules/lodash/_initCloneByTag.js @@ -1,4 +1,5 @@ var cloneArrayBuffer = require('./_cloneArrayBuffer'), + cloneDataView = require('./_cloneDataView'), cloneMap = require('./_cloneMap'), cloneRegExp = require('./_cloneRegExp'), cloneSet = require('./_cloneSet'), @@ -16,6 +17,7 @@ var boolTag = '[object Boolean]', symbolTag = '[object Symbol]'; var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', @@ -35,10 +37,11 @@ var arrayBufferTag = '[object ArrayBuffer]', * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. + * @param {Function} cloneFunc The function to clone values. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ -function initCloneByTag(object, tag, isDeep) { +function initCloneByTag(object, tag, cloneFunc, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: @@ -48,13 +51,16 @@ function initCloneByTag(object, tag, isDeep) { case dateTag: return new Ctor(+object); + case dataViewTag: + return cloneDataView(object, isDeep); + case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: - return cloneMap(object); + return cloneMap(object, isDeep, cloneFunc); case numberTag: case stringTag: @@ -64,7 +70,7 @@ function initCloneByTag(object, tag, isDeep) { return cloneRegExp(object); case setTag: - return cloneSet(object); + return cloneSet(object, isDeep, cloneFunc); case symbolTag: return cloneSymbol(object); diff --git a/tools/eslint/node_modules/lodash/_initCloneObject.js b/tools/eslint/node_modules/lodash/_initCloneObject.js index b1da6cb7a747aa..5a13e64a5266d7 100644 --- a/tools/eslint/node_modules/lodash/_initCloneObject.js +++ b/tools/eslint/node_modules/lodash/_initCloneObject.js @@ -1,5 +1,5 @@ var baseCreate = require('./_baseCreate'), - isFunction = require('./isFunction'), + getPrototype = require('./_getPrototype'), isPrototype = require('./_isPrototype'); /** @@ -10,11 +10,9 @@ var baseCreate = require('./_baseCreate'), * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { - if (isPrototype(object)) { - return {}; - } - var Ctor = object.constructor; - return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; } module.exports = initCloneObject; diff --git a/tools/eslint/node_modules/lodash/_isFlattenable.js b/tools/eslint/node_modules/lodash/_isFlattenable.js new file mode 100644 index 00000000000000..847ad1fa0e046d --- /dev/null +++ b/tools/eslint/node_modules/lodash/_isFlattenable.js @@ -0,0 +1,16 @@ +var isArguments = require('./isArguments'), + isArray = require('./isArray'), + isArrayLikeObject = require('./isArrayLikeObject'); + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArrayLikeObject(value) && (isArray(value) || isArguments(value)); +} + +module.exports = isFlattenable; diff --git a/tools/eslint/node_modules/lodash/_isFlattenableIteratee.js b/tools/eslint/node_modules/lodash/_isFlattenableIteratee.js new file mode 100644 index 00000000000000..f7ede3e22a12cd --- /dev/null +++ b/tools/eslint/node_modules/lodash/_isFlattenableIteratee.js @@ -0,0 +1,16 @@ +var isArray = require('./isArray'), + isFunction = require('./isFunction'); + +/** + * Checks if `value` is a flattenable array and not a `_.matchesProperty` + * iteratee shorthand. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenableIteratee(value) { + return isArray(value) && !(value.length == 2 && !isFunction(value[0])); +} + +module.exports = isFlattenableIteratee; diff --git a/tools/eslint/node_modules/lodash/_isIterateeCall.js b/tools/eslint/node_modules/lodash/_isIterateeCall.js index b422b486942ea7..a0bb5a9cf60533 100644 --- a/tools/eslint/node_modules/lodash/_isIterateeCall.js +++ b/tools/eslint/node_modules/lodash/_isIterateeCall.js @@ -10,7 +10,8 @@ var eq = require('./eq'), * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { @@ -18,8 +19,9 @@ function isIterateeCall(value, index, object) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object)) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; diff --git a/tools/eslint/node_modules/lodash/_isKey.js b/tools/eslint/node_modules/lodash/_isKey.js index 0e34576fa5e6db..a907950add8048 100644 --- a/tools/eslint/node_modules/lodash/_isKey.js +++ b/tools/eslint/node_modules/lodash/_isKey.js @@ -1,4 +1,5 @@ -var isArray = require('./isArray'); +var isArray = require('./isArray'), + isSymbol = require('./isSymbol'); /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, @@ -13,11 +14,12 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } diff --git a/tools/eslint/node_modules/lodash/_isKeyable.js b/tools/eslint/node_modules/lodash/_isKeyable.js index a2521b2da94299..5df83c0e97226e 100644 --- a/tools/eslint/node_modules/lodash/_isKeyable.js +++ b/tools/eslint/node_modules/lodash/_isKeyable.js @@ -8,7 +8,7 @@ function isKeyable(value) { var type = typeof value; return type == 'number' || type == 'boolean' || - (type == 'string' && value !== '__proto__') || value == null; + (type == 'string' && value != '__proto__') || value == null; } module.exports = isKeyable; diff --git a/tools/eslint/node_modules/lodash/_isLaziable.js b/tools/eslint/node_modules/lodash/_isLaziable.js index faa17b9fbd8453..a57c4f2dc72b57 100644 --- a/tools/eslint/node_modules/lodash/_isLaziable.js +++ b/tools/eslint/node_modules/lodash/_isLaziable.js @@ -8,7 +8,8 @@ var LazyWrapper = require('./_LazyWrapper'), * * @private * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. */ function isLaziable(func) { var funcName = getFuncName(func), diff --git a/tools/eslint/node_modules/lodash/_lazyValue.js b/tools/eslint/node_modules/lodash/_lazyValue.js index cc6ebcff1269ef..09bf14b43a7737 100644 --- a/tools/eslint/node_modules/lodash/_lazyValue.js +++ b/tools/eslint/node_modules/lodash/_lazyValue.js @@ -36,7 +36,8 @@ function lazyValue() { resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); - if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { + if (!isArr || arrLength < LARGE_ARRAY_SIZE || + (arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; diff --git a/tools/eslint/node_modules/lodash/_mapClear.js b/tools/eslint/node_modules/lodash/_mapClear.js index c8ca3ef7c4346e..296f41794d6cfb 100644 --- a/tools/eslint/node_modules/lodash/_mapClear.js +++ b/tools/eslint/node_modules/lodash/_mapClear.js @@ -9,7 +9,11 @@ var Hash = require('./_Hash'), * @memberOf MapCache */ function mapClear() { - this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash }; + this.__data__ = { + 'hash': new Hash, + 'map': Map ? new Map : [], + 'string': new Hash + }; } module.exports = mapClear; diff --git a/tools/eslint/node_modules/lodash/_mapSet.js b/tools/eslint/node_modules/lodash/_mapSet.js index 7a587861eae6f0..23b075fc6e96e4 100644 --- a/tools/eslint/node_modules/lodash/_mapSet.js +++ b/tools/eslint/node_modules/lodash/_mapSet.js @@ -11,7 +11,7 @@ var Map = require('./_Map'), * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. - * @returns {Object} Returns the map cache object. + * @returns {Object} Returns the map cache instance. */ function mapSet(key, value) { var data = this.__data__; diff --git a/tools/eslint/node_modules/lodash/_matchesStrictComparable.js b/tools/eslint/node_modules/lodash/_matchesStrictComparable.js new file mode 100644 index 00000000000000..70375e0e5dcfc3 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_matchesStrictComparable.js @@ -0,0 +1,20 @@ +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new function. + */ +function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; +} + +module.exports = matchesStrictComparable; diff --git a/tools/eslint/node_modules/lodash/_mergeData.js b/tools/eslint/node_modules/lodash/_mergeData.js index 3be23cefa199ac..55fd5ee031b720 100644 --- a/tools/eslint/node_modules/lodash/_mergeData.js +++ b/tools/eslint/node_modules/lodash/_mergeData.js @@ -3,6 +3,9 @@ var composeArgs = require('./_composeArgs'), copyArray = require('./_copyArray'), replaceHolders = require('./_replaceHolders'); +/** Used as the internal argument placeholder. */ +var PLACEHOLDER = '__lodash_placeholder__'; + /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, BIND_KEY_FLAG = 2, @@ -11,9 +14,6 @@ var BIND_FLAG = 1, ARY_FLAG = 128, REARG_FLAG = 256; -/** Used as the internal argument placeholder. */ -var PLACEHOLDER = '__lodash_placeholder__'; - /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMin = Math.min; @@ -22,10 +22,11 @@ var nativeMin = Math.min; * * Merging metadata reduces the number of wrappers used to invoke a function. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` - * modify function arguments, making the order in which they are executed important, - * preventing the merging of metadata. However, we make an exception for a safe - * combined case where curried functions have `_.ary` and or `_.rearg` applied. + * may be applied regardless of execution order. Methods like `_.ary` and + * `_.rearg` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined case where curried functions have `_.ary` + * and or `_.rearg` applied. * * @private * @param {Array} data The destination metadata. @@ -39,9 +40,9 @@ function mergeData(data, source) { isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG); var isCombo = - (srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) || - (srcBitmask == ARY_FLAG && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || - (srcBitmask == (ARY_FLAG | REARG_FLAG) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); + ((srcBitmask == ARY_FLAG) && (bitmask == CURRY_FLAG)) || + ((srcBitmask == ARY_FLAG) && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (ARY_FLAG | REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -51,7 +52,7 @@ function mergeData(data, source) { if (srcBitmask & BIND_FLAG) { data[2] = source[2]; // Set when currying a bound function. - newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; + newBitmask |= bitmask & BIND_FLAG ? 0 : CURRY_BOUND_FLAG; } // Compose partial arguments. var value = source[3]; diff --git a/tools/eslint/node_modules/lodash/_mergeDefaults.js b/tools/eslint/node_modules/lodash/_mergeDefaults.js index b09c66b43d9d37..33375cc5bb42c6 100644 --- a/tools/eslint/node_modules/lodash/_mergeDefaults.js +++ b/tools/eslint/node_modules/lodash/_mergeDefaults.js @@ -10,13 +10,13 @@ var baseMerge = require('./_baseMerge'), * @param {string} key The key of the property to merge. * @param {Object} object The parent object of `objValue`. * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. * @returns {*} Returns the value to assign. */ function mergeDefaults(objValue, srcValue, key, object, source, stack) { if (isObject(objValue) && isObject(srcValue)) { - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, mergeDefaults, stack); + baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue)); } return objValue; } diff --git a/tools/eslint/node_modules/lodash/_parent.js b/tools/eslint/node_modules/lodash/_parent.js index e04ff6e2a9cb09..81d94d0de08443 100644 --- a/tools/eslint/node_modules/lodash/_parent.js +++ b/tools/eslint/node_modules/lodash/_parent.js @@ -1,5 +1,5 @@ -var baseSlice = require('./_baseSlice'), - get = require('./get'); +var baseGet = require('./_baseGet'), + baseSlice = require('./_baseSlice'); /** * Gets the parent value at `path` of `object`. @@ -10,7 +10,7 @@ var baseSlice = require('./_baseSlice'), * @returns {*} Returns the parent value. */ function parent(object, path) { - return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); + return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); } module.exports = parent; diff --git a/tools/eslint/node_modules/lodash/_replaceHolders.js b/tools/eslint/node_modules/lodash/_replaceHolders.js index 3089e75e94d339..74360ec4d3bbf8 100644 --- a/tools/eslint/node_modules/lodash/_replaceHolders.js +++ b/tools/eslint/node_modules/lodash/_replaceHolders.js @@ -13,13 +13,14 @@ var PLACEHOLDER = '__lodash_placeholder__'; function replaceHolders(array, placeholder) { var index = -1, length = array.length, - resIndex = -1, + resIndex = 0, result = []; while (++index < length) { - if (array[index] === placeholder) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { array[index] = PLACEHOLDER; - result[++resIndex] = index; + result[resIndex++] = index; } } return result; diff --git a/tools/eslint/node_modules/lodash/_root.js b/tools/eslint/node_modules/lodash/_root.js index b491ca4e6c7258..d2cfd311491c5d 100644 --- a/tools/eslint/node_modules/lodash/_root.js +++ b/tools/eslint/node_modules/lodash/_root.js @@ -7,10 +7,14 @@ var objectTypes = { }; /** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; /** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; /** Detect free variable `global` from Node.js. */ var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); @@ -30,6 +34,8 @@ var thisGlobal = checkGlobal(objectTypes[typeof this] && this); * The `this` value is used if it's the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); +var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); module.exports = root; diff --git a/tools/eslint/node_modules/lodash/_setData.js b/tools/eslint/node_modules/lodash/_setData.js index 8b2efca0feb93c..d86c61086e5053 100644 --- a/tools/eslint/node_modules/lodash/_setData.js +++ b/tools/eslint/node_modules/lodash/_setData.js @@ -9,8 +9,9 @@ var HOT_COUNT = 150, * Sets metadata for `func`. * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity function - * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) + * period of time, it will trip its breaker and transition to an identity + * function to avoid garbage collection pauses in V8. See + * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) * for more details. * * @private diff --git a/tools/eslint/node_modules/lodash/_stackSet.js b/tools/eslint/node_modules/lodash/_stackSet.js index 0194d100f432de..76ca89a8df2b84 100644 --- a/tools/eslint/node_modules/lodash/_stackSet.js +++ b/tools/eslint/node_modules/lodash/_stackSet.js @@ -12,7 +12,7 @@ var LARGE_ARRAY_SIZE = 200; * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. - * @returns {Object} Returns the stack cache object. + * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__, diff --git a/tools/eslint/node_modules/lodash/_stringToPath.js b/tools/eslint/node_modules/lodash/_stringToPath.js index a8fd82ab71e61b..b6a1fc28aceea4 100644 --- a/tools/eslint/node_modules/lodash/_stringToPath.js +++ b/tools/eslint/node_modules/lodash/_stringToPath.js @@ -1,4 +1,5 @@ -var toString = require('./toString'); +var memoize = require('./memoize'), + toString = require('./toString'); /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; @@ -13,12 +14,12 @@ var reEscapeChar = /\\(\\)?/g; * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ -function stringToPath(string) { +var stringToPath = memoize(function(string) { var result = []; toString(string).replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; -} +}); module.exports = stringToPath; diff --git a/tools/eslint/node_modules/lodash/_toArrayLikeObject.js b/tools/eslint/node_modules/lodash/_toArrayLikeObject.js deleted file mode 100644 index be01dabc7b11bd..00000000000000 --- a/tools/eslint/node_modules/lodash/_toArrayLikeObject.js +++ /dev/null @@ -1,14 +0,0 @@ -var isArrayLikeObject = require('./isArrayLikeObject'); - -/** - * Converts `value` to an array-like object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the array-like object. - */ -function toArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; -} - -module.exports = toArrayLikeObject; diff --git a/tools/eslint/node_modules/lodash/_toFunction.js b/tools/eslint/node_modules/lodash/_toFunction.js deleted file mode 100644 index 4fa85d17165f2f..00000000000000 --- a/tools/eslint/node_modules/lodash/_toFunction.js +++ /dev/null @@ -1,14 +0,0 @@ -var identity = require('./identity'); - -/** - * Converts `value` to a function if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Function} Returns the function. - */ -function toFunction(value) { - return typeof value == 'function' ? value : identity; -} - -module.exports = toFunction; diff --git a/tools/eslint/node_modules/lodash/_toSource.js b/tools/eslint/node_modules/lodash/_toSource.js new file mode 100644 index 00000000000000..43f3ff8bf9f583 --- /dev/null +++ b/tools/eslint/node_modules/lodash/_toSource.js @@ -0,0 +1,23 @@ +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +module.exports = toSource; diff --git a/tools/eslint/node_modules/lodash/add.js b/tools/eslint/node_modules/lodash/add.js index d09785022c3d6f..d82c6522ae3e15 100644 --- a/tools/eslint/node_modules/lodash/add.js +++ b/tools/eslint/node_modules/lodash/add.js @@ -1,8 +1,11 @@ +var createMathOperation = require('./_createMathOperation'); + /** * Adds two numbers. * * @static * @memberOf _ + * @since 3.4.0 * @category Math * @param {number} augend The first number in an addition. * @param {number} addend The second number in an addition. @@ -12,18 +15,8 @@ * _.add(6, 4); * // => 10 */ -function add(augend, addend) { - var result; - if (augend === undefined && addend === undefined) { - return 0; - } - if (augend !== undefined) { - result = augend; - } - if (addend !== undefined) { - result = result === undefined ? addend : (result + addend); - } - return result; -} +var add = createMathOperation(function(augend, addend) { + return augend + addend; +}); module.exports = add; diff --git a/tools/eslint/node_modules/lodash/after.js b/tools/eslint/node_modules/lodash/after.js index 41b01461423218..910923a9a61317 100644 --- a/tools/eslint/node_modules/lodash/after.js +++ b/tools/eslint/node_modules/lodash/after.js @@ -9,6 +9,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {number} n The number of calls before `func` is invoked. * @param {Function} func The function to restrict. @@ -24,7 +25,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); - * // => logs 'done saving!' after the two async saves have completed + * // => Logs 'done saving!' after the two async saves have completed. */ function after(n, func) { if (typeof func != 'function') { diff --git a/tools/eslint/node_modules/lodash/array.js b/tools/eslint/node_modules/lodash/array.js index 01c121671791cd..bfded5ccee4e16 100644 --- a/tools/eslint/node_modules/lodash/array.js +++ b/tools/eslint/node_modules/lodash/array.js @@ -14,6 +14,7 @@ module.exports = { 'findLastIndex': require('./findLastIndex'), 'flatten': require('./flatten'), 'flattenDeep': require('./flattenDeep'), + 'flattenDepth': require('./flattenDepth'), 'fromPairs': require('./fromPairs'), 'head': require('./head'), 'indexOf': require('./indexOf'), @@ -27,6 +28,7 @@ module.exports = { 'pull': require('./pull'), 'pullAll': require('./pullAll'), 'pullAllBy': require('./pullAllBy'), + 'pullAllWith': require('./pullAllWith'), 'pullAt': require('./pullAt'), 'remove': require('./remove'), 'reverse': require('./reverse'), diff --git a/tools/eslint/node_modules/lodash/ary.js b/tools/eslint/node_modules/lodash/ary.js index b3906acb3c77bd..e901f1b9db0db5 100644 --- a/tools/eslint/node_modules/lodash/ary.js +++ b/tools/eslint/node_modules/lodash/ary.js @@ -4,15 +4,16 @@ var createWrapper = require('./_createWrapper'); var ARY_FLAG = 128; /** - * Creates a function that accepts up to `n` arguments, ignoring any - * additional arguments. + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new function. * @example * diff --git a/tools/eslint/node_modules/lodash/assign.js b/tools/eslint/node_modules/lodash/assign.js index d766dd0c4a5a89..281e8acf1453b9 100644 --- a/tools/eslint/node_modules/lodash/assign.js +++ b/tools/eslint/node_modules/lodash/assign.js @@ -1,17 +1,33 @@ -var copyObject = require('./_copyObject'), +var assignValue = require('./_assignValue'), + copyObject = require('./_copyObject'), createAssigner = require('./_createAssigner'), + isArrayLike = require('./isArrayLike'), + isPrototype = require('./_isPrototype'), keys = require('./keys'); +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ +var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); + /** - * Assigns own enumerable properties of source objects to the destination - * object. Source objects are applied from left to right. Subsequent sources - * overwrite property assignments of previous sources. + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ + * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. @@ -33,7 +49,15 @@ var copyObject = require('./_copyObject'), * // => { 'a': 1, 'c': 3, 'e': 5 } */ var assign = createAssigner(function(object, source) { - copyObject(source, keys(source), object); + if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } }); module.exports = assign; diff --git a/tools/eslint/node_modules/lodash/assignIn.js b/tools/eslint/node_modules/lodash/assignIn.js index b4177e6ab9372e..f48e92558f756f 100644 --- a/tools/eslint/node_modules/lodash/assignIn.js +++ b/tools/eslint/node_modules/lodash/assignIn.js @@ -1,7 +1,19 @@ -var copyObject = require('./_copyObject'), +var assignValue = require('./_assignValue'), + copyObject = require('./_copyObject'), createAssigner = require('./_createAssigner'), + isArrayLike = require('./isArrayLike'), + isPrototype = require('./_isPrototype'), keysIn = require('./keysIn'); +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ +var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); + /** * This method is like `_.assign` except that it iterates over own and * inherited source properties. @@ -10,6 +22,7 @@ var copyObject = require('./_copyObject'), * * @static * @memberOf _ + * @since 4.0.0 * @alias extend * @category Object * @param {Object} object The destination object. @@ -32,7 +45,13 @@ var copyObject = require('./_copyObject'), * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } */ var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); + if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + copyObject(source, keysIn(source), object); + return; + } + for (var key in source) { + assignValue(object, key, source[key]); + } }); module.exports = assignIn; diff --git a/tools/eslint/node_modules/lodash/assignInWith.js b/tools/eslint/node_modules/lodash/assignInWith.js index da73ef7c017264..9a24e4f0a8d6f0 100644 --- a/tools/eslint/node_modules/lodash/assignInWith.js +++ b/tools/eslint/node_modules/lodash/assignInWith.js @@ -3,15 +3,16 @@ var copyObjectWith = require('./_copyObjectWith'), keysIn = require('./keysIn'); /** - * This method is like `_.assignIn` except that it accepts `customizer` which - * is invoked to produce the assigned values. If `customizer` returns `undefined` - * assignment is handled by the method instead. The `customizer` is invoked - * with five arguments: (objValue, srcValue, key, object, source). + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ + * @since 4.0.0 * @alias extendWith * @category Object * @param {Object} object The destination object. diff --git a/tools/eslint/node_modules/lodash/assignWith.js b/tools/eslint/node_modules/lodash/assignWith.js index eb7915b508d45a..1f573fbc4b24da 100644 --- a/tools/eslint/node_modules/lodash/assignWith.js +++ b/tools/eslint/node_modules/lodash/assignWith.js @@ -3,15 +3,16 @@ var copyObjectWith = require('./_copyObjectWith'), keys = require('./keys'); /** - * This method is like `_.assign` except that it accepts `customizer` which - * is invoked to produce the assigned values. If `customizer` returns `undefined` - * assignment is handled by the method instead. The `customizer` is invoked - * with five arguments: (objValue, srcValue, key, object, source). + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. diff --git a/tools/eslint/node_modules/lodash/at.js b/tools/eslint/node_modules/lodash/at.js index cc361883543c1c..82ba3433db415f 100644 --- a/tools/eslint/node_modules/lodash/at.js +++ b/tools/eslint/node_modules/lodash/at.js @@ -7,6 +7,7 @@ var baseAt = require('./_baseAt'), * * @static * @memberOf _ + * @since 1.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths of elements to pick, @@ -23,7 +24,7 @@ var baseAt = require('./_baseAt'), * // => ['a', 'c'] */ var at = rest(function(object, paths) { - return baseAt(object, baseFlatten(paths)); + return baseAt(object, baseFlatten(paths, 1)); }); module.exports = at; diff --git a/tools/eslint/node_modules/lodash/attempt.js b/tools/eslint/node_modules/lodash/attempt.js index 322bf2fd10e6c7..e65b2e6f5ff105 100644 --- a/tools/eslint/node_modules/lodash/attempt.js +++ b/tools/eslint/node_modules/lodash/attempt.js @@ -1,5 +1,5 @@ var apply = require('./_apply'), - isObject = require('./isObject'), + isError = require('./isError'), rest = require('./rest'); /** @@ -8,8 +8,10 @@ var apply = require('./_apply'), * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Function} func The function to attempt. + * @param {...*} [args] The arguments to invoke `func` with. * @returns {*} Returns the `func` result or error object. * @example * @@ -26,7 +28,7 @@ var attempt = rest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { - return isObject(e) ? e : new Error(e); + return isError(e) ? e : new Error(e); } }); diff --git a/tools/eslint/node_modules/lodash/before.js b/tools/eslint/node_modules/lodash/before.js index 47148b1fe09af4..a495adcbdc2cdd 100644 --- a/tools/eslint/node_modules/lodash/before.js +++ b/tools/eslint/node_modules/lodash/before.js @@ -10,6 +10,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. diff --git a/tools/eslint/node_modules/lodash/bind.js b/tools/eslint/node_modules/lodash/bind.js index bd89d1f03b12f0..a41b94619ca6fb 100644 --- a/tools/eslint/node_modules/lodash/bind.js +++ b/tools/eslint/node_modules/lodash/bind.js @@ -1,4 +1,5 @@ var createWrapper = require('./_createWrapper'), + getPlaceholder = require('./_getPlaceholder'), replaceHolders = require('./_replaceHolders'), rest = require('./rest'); @@ -8,8 +9,7 @@ var BIND_FLAG = 1, /** * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and prepends any additional `_.bind` arguments to those provided to the - * bound function. + * and `partials` prepended to the arguments it receives. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. @@ -19,6 +19,7 @@ var BIND_FLAG = 1, * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. @@ -44,9 +45,7 @@ var BIND_FLAG = 1, var bind = rest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { - var placeholder = bind.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(bind)); bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); diff --git a/tools/eslint/node_modules/lodash/bindAll.js b/tools/eslint/node_modules/lodash/bindAll.js index d5bde424951662..0d158803ee1260 100644 --- a/tools/eslint/node_modules/lodash/bindAll.js +++ b/tools/eslint/node_modules/lodash/bindAll.js @@ -10,6 +10,7 @@ var arrayEach = require('./_arrayEach'), * **Note:** This method doesn't set the "length" property of bound functions. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {Object} object The object to bind and assign the bound methods to. @@ -27,10 +28,10 @@ var arrayEach = require('./_arrayEach'), * * _.bindAll(view, 'onClick'); * jQuery(element).on('click', view.onClick); - * // => logs 'clicked docs' when clicked + * // => Logs 'clicked docs' when clicked. */ var bindAll = rest(function(object, methodNames) { - arrayEach(baseFlatten(methodNames), function(key) { + arrayEach(baseFlatten(methodNames, 1), function(key) { object[key] = bind(object[key], object); }); return object; diff --git a/tools/eslint/node_modules/lodash/bindKey.js b/tools/eslint/node_modules/lodash/bindKey.js index 5cefad3ed80e61..364dd698122c9b 100644 --- a/tools/eslint/node_modules/lodash/bindKey.js +++ b/tools/eslint/node_modules/lodash/bindKey.js @@ -1,4 +1,5 @@ var createWrapper = require('./_createWrapper'), + getPlaceholder = require('./_getPlaceholder'), replaceHolders = require('./_replaceHolders'), rest = require('./rest'); @@ -8,12 +9,12 @@ var BIND_FLAG = 1, PARTIAL_FLAG = 32; /** - * Creates a function that invokes the method at `object[key]` and prepends - * any additional `_.bindKey` arguments to those provided to the bound function. + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. * * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. - * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * methods that may be redefined or don't yet exist. See + * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic @@ -21,6 +22,7 @@ var BIND_FLAG = 1, * * @static * @memberOf _ + * @since 0.10.0 * @category Function * @param {Object} object The object to invoke the method on. * @param {string} key The key of the method. @@ -54,9 +56,7 @@ var BIND_FLAG = 1, var bindKey = rest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { - var placeholder = bindKey.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(bindKey)); bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); diff --git a/tools/eslint/node_modules/lodash/camelCase.js b/tools/eslint/node_modules/lodash/camelCase.js index 00239e3c816afc..d7390def558f67 100644 --- a/tools/eslint/node_modules/lodash/camelCase.js +++ b/tools/eslint/node_modules/lodash/camelCase.js @@ -6,6 +6,7 @@ var capitalize = require('./capitalize'), * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. @@ -14,10 +15,10 @@ var capitalize = require('./capitalize'), * _.camelCase('Foo Bar'); * // => 'fooBar' * - * _.camelCase('--foo-bar'); + * _.camelCase('--foo-bar--'); * // => 'fooBar' * - * _.camelCase('__foo_bar__'); + * _.camelCase('__FOO_BAR__'); * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { diff --git a/tools/eslint/node_modules/lodash/capitalize.js b/tools/eslint/node_modules/lodash/capitalize.js index 4daec0354c1941..3e1600e7d9e919 100644 --- a/tools/eslint/node_modules/lodash/capitalize.js +++ b/tools/eslint/node_modules/lodash/capitalize.js @@ -7,6 +7,7 @@ var toString = require('./toString'), * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. diff --git a/tools/eslint/node_modules/lodash/castArray.js b/tools/eslint/node_modules/lodash/castArray.js new file mode 100644 index 00000000000000..e470bdb9b9156a --- /dev/null +++ b/tools/eslint/node_modules/lodash/castArray.js @@ -0,0 +1,44 @@ +var isArray = require('./isArray'); + +/** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ +function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; +} + +module.exports = castArray; diff --git a/tools/eslint/node_modules/lodash/ceil.js b/tools/eslint/node_modules/lodash/ceil.js index ecf2f12321b223..56c8722cfc7cec 100644 --- a/tools/eslint/node_modules/lodash/ceil.js +++ b/tools/eslint/node_modules/lodash/ceil.js @@ -5,6 +5,7 @@ var createRound = require('./_createRound'); * * @static * @memberOf _ + * @since 3.10.0 * @category Math * @param {number} number The number to round up. * @param {number} [precision=0] The precision to round up to. diff --git a/tools/eslint/node_modules/lodash/chain.js b/tools/eslint/node_modules/lodash/chain.js index 3300933e09bf94..f6cd6475ffdf17 100644 --- a/tools/eslint/node_modules/lodash/chain.js +++ b/tools/eslint/node_modules/lodash/chain.js @@ -1,11 +1,13 @@ var lodash = require('./wrapperLodash'); /** - * Creates a `lodash` object that wraps `value` with explicit method chaining enabled. - * The result of such method chaining must be unwrapped with `_#value`. + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. * * @static * @memberOf _ + * @since 1.3.0 * @category Seq * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` wrapper instance. diff --git a/tools/eslint/node_modules/lodash/chunk.js b/tools/eslint/node_modules/lodash/chunk.js index b4bbc7bef16f6e..f2094743700775 100644 --- a/tools/eslint/node_modules/lodash/chunk.js +++ b/tools/eslint/node_modules/lodash/chunk.js @@ -1,4 +1,5 @@ var baseSlice = require('./_baseSlice'), + isIterateeCall = require('./_isIterateeCall'), toInteger = require('./toInteger'); /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -12,9 +13,11 @@ var nativeCeil = Math.ceil, * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to process. - * @param {number} [size=0] The length of each chunk. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the new array containing chunks. * @example * @@ -24,19 +27,22 @@ var nativeCeil = Math.ceil, * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ -function chunk(array, size) { - size = nativeMax(toInteger(size), 0); - +function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } var length = array ? array.length : 0; if (!length || size < 1) { return []; } var index = 0, - resIndex = -1, + resIndex = 0, result = Array(nativeCeil(length / size)); while (index < length) { - result[++resIndex] = baseSlice(array, index, (index += size)); + result[resIndex++] = baseSlice(array, index, (index += size)); } return result; } diff --git a/tools/eslint/node_modules/lodash/clamp.js b/tools/eslint/node_modules/lodash/clamp.js index 9e186d8182a5d3..91a72c9782dc92 100644 --- a/tools/eslint/node_modules/lodash/clamp.js +++ b/tools/eslint/node_modules/lodash/clamp.js @@ -6,6 +6,7 @@ var baseClamp = require('./_baseClamp'), * * @static * @memberOf _ + * @since 4.0.0 * @category Number * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. diff --git a/tools/eslint/node_modules/lodash/clone.js b/tools/eslint/node_modules/lodash/clone.js index 08e9744f2df73e..d33799250abdd1 100644 --- a/tools/eslint/node_modules/lodash/clone.js +++ b/tools/eslint/node_modules/lodash/clone.js @@ -13,6 +13,7 @@ var baseClone = require('./_baseClone'); * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to clone. * @returns {*} Returns the cloned value. @@ -25,7 +26,7 @@ var baseClone = require('./_baseClone'); * // => true */ function clone(value) { - return baseClone(value); + return baseClone(value, false, true); } module.exports = clone; diff --git a/tools/eslint/node_modules/lodash/cloneDeep.js b/tools/eslint/node_modules/lodash/cloneDeep.js index 9fbf338b3452e1..037002eef5f7d3 100644 --- a/tools/eslint/node_modules/lodash/cloneDeep.js +++ b/tools/eslint/node_modules/lodash/cloneDeep.js @@ -5,6 +5,7 @@ var baseClone = require('./_baseClone'); * * @static * @memberOf _ + * @since 1.0.0 * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. @@ -17,7 +18,7 @@ var baseClone = require('./_baseClone'); * // => false */ function cloneDeep(value) { - return baseClone(value, true); + return baseClone(value, true, true); } module.exports = cloneDeep; diff --git a/tools/eslint/node_modules/lodash/cloneDeepWith.js b/tools/eslint/node_modules/lodash/cloneDeepWith.js index be5bb57296d1f6..581ab9fa83b96f 100644 --- a/tools/eslint/node_modules/lodash/cloneDeepWith.js +++ b/tools/eslint/node_modules/lodash/cloneDeepWith.js @@ -5,6 +5,7 @@ var baseClone = require('./_baseClone'); * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to recursively clone. * @param {Function} [customizer] The function to customize cloning. @@ -27,7 +28,7 @@ var baseClone = require('./_baseClone'); * // => 20 */ function cloneDeepWith(value, customizer) { - return baseClone(value, true, customizer); + return baseClone(value, true, true, customizer); } module.exports = cloneDeepWith; diff --git a/tools/eslint/node_modules/lodash/cloneWith.js b/tools/eslint/node_modules/lodash/cloneWith.js index 1bc6035a211de8..df731c7af62661 100644 --- a/tools/eslint/node_modules/lodash/cloneWith.js +++ b/tools/eslint/node_modules/lodash/cloneWith.js @@ -2,12 +2,13 @@ var baseClone = require('./_baseClone'); /** * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined` + * is invoked to produce the cloned value. If `customizer` returns `undefined`, * cloning is handled by the method instead. The `customizer` is invoked with * up to four arguments; (value [, index|key, object, stack]). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to clone. * @param {Function} [customizer] The function to customize cloning. @@ -30,7 +31,7 @@ var baseClone = require('./_baseClone'); * // => 0 */ function cloneWith(value, customizer) { - return baseClone(value, false, customizer); + return baseClone(value, false, true, customizer); } module.exports = cloneWith; diff --git a/tools/eslint/node_modules/lodash/collection.js b/tools/eslint/node_modules/lodash/collection.js index 6d37b3fd12bbe3..22b0c8bce7a097 100644 --- a/tools/eslint/node_modules/lodash/collection.js +++ b/tools/eslint/node_modules/lodash/collection.js @@ -8,6 +8,8 @@ module.exports = { 'find': require('./find'), 'findLast': require('./findLast'), 'flatMap': require('./flatMap'), + 'flatMapDeep': require('./flatMapDeep'), + 'flatMapDepth': require('./flatMapDepth'), 'forEach': require('./forEach'), 'forEachRight': require('./forEachRight'), 'groupBy': require('./groupBy'), diff --git a/tools/eslint/node_modules/lodash/commit.js b/tools/eslint/node_modules/lodash/commit.js index 1f87f505250338..fe4db71783bd99 100644 --- a/tools/eslint/node_modules/lodash/commit.js +++ b/tools/eslint/node_modules/lodash/commit.js @@ -1,10 +1,11 @@ var LodashWrapper = require('./_LodashWrapper'); /** - * Executes the chained sequence and returns the wrapped result. + * Executes the chain sequence and returns the wrapped result. * * @name commit * @memberOf _ + * @since 3.2.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example diff --git a/tools/eslint/node_modules/lodash/compact.js b/tools/eslint/node_modules/lodash/compact.js index 1dc1c55e8f1efb..790f31199ba101 100644 --- a/tools/eslint/node_modules/lodash/compact.js +++ b/tools/eslint/node_modules/lodash/compact.js @@ -4,6 +4,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the new array of filtered values. @@ -15,13 +16,13 @@ function compact(array) { var index = -1, length = array ? array.length : 0, - resIndex = -1, + resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value) { - result[++resIndex] = value; + result[resIndex++] = value; } } return result; diff --git a/tools/eslint/node_modules/lodash/concat.js b/tools/eslint/node_modules/lodash/concat.js index a3a78df0ec7a5b..de9270b4828954 100644 --- a/tools/eslint/node_modules/lodash/concat.js +++ b/tools/eslint/node_modules/lodash/concat.js @@ -1,7 +1,7 @@ var arrayConcat = require('./_arrayConcat'), baseFlatten = require('./_baseFlatten'), - isArray = require('./isArray'), - rest = require('./rest'); + castArray = require('./castArray'), + copyArray = require('./_copyArray'); /** * Creates a new array concatenating `array` with any additional arrays @@ -9,6 +9,7 @@ var arrayConcat = require('./_arrayConcat'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. @@ -24,12 +25,18 @@ var arrayConcat = require('./_arrayConcat'), * console.log(array); * // => [1] */ -var concat = rest(function(array, values) { - if (!isArray(array)) { - array = array == null ? [] : [Object(array)]; +function concat() { + var length = arguments.length, + array = castArray(arguments[0]); + + if (length < 2) { + return length ? copyArray(array) : []; + } + var args = Array(length - 1); + while (length--) { + args[length - 1] = arguments[length]; } - values = baseFlatten(values); - return arrayConcat(array, values); -}); + return arrayConcat(array, baseFlatten(args, 1)); +} module.exports = concat; diff --git a/tools/eslint/node_modules/lodash/cond.js b/tools/eslint/node_modules/lodash/cond.js index 593ac9e2e1c483..d851d07414b873 100644 --- a/tools/eslint/node_modules/lodash/cond.js +++ b/tools/eslint/node_modules/lodash/cond.js @@ -14,6 +14,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {Array} pairs The predicate-function pairs. * @returns {Function} Returns the new function. @@ -35,13 +36,14 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * // => 'no match' */ function cond(pairs) { - var length = pairs ? pairs.length : 0; + var length = pairs ? pairs.length : 0, + toIteratee = baseIteratee; pairs = !length ? [] : arrayMap(pairs, function(pair) { if (typeof pair[1] != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - return [baseIteratee(pair[0]), pair[1]]; + return [toIteratee(pair[0]), pair[1]]; }); return rest(function(args) { diff --git a/tools/eslint/node_modules/lodash/conforms.js b/tools/eslint/node_modules/lodash/conforms.js index 2bfeca2502fa4d..6ec590f30b7d20 100644 --- a/tools/eslint/node_modules/lodash/conforms.js +++ b/tools/eslint/node_modules/lodash/conforms.js @@ -8,6 +8,7 @@ var baseClone = require('./_baseClone'), * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/constant.js b/tools/eslint/node_modules/lodash/constant.js index 584480451a7722..59bcb420263b8d 100644 --- a/tools/eslint/node_modules/lodash/constant.js +++ b/tools/eslint/node_modules/lodash/constant.js @@ -3,6 +3,7 @@ * * @static * @memberOf _ + * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/core.js b/tools/eslint/node_modules/lodash/core.js index ee2a004e74702d..b6e5b3244565a4 100644 --- a/tools/eslint/node_modules/lodash/core.js +++ b/tools/eslint/node_modules/lodash/core.js @@ -1,11 +1,11 @@ /** * @license - * lodash 4.3.0 (Custom Build) + * lodash 4.9.0 (Custom Build) * Build: `lodash core -o ./dist/lodash.core.js` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ ;(function() { @@ -13,7 +13,10 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.3.0'; + var VERSION = '4.9.0'; + + /** Used as the `TypeError` message for "Functions" methods. */ + var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -23,11 +26,9 @@ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; - /** Used as the `TypeError` message for "Functions" methods. */ - var FUNC_ERROR_TEXT = 'Expected a function'; - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', @@ -66,10 +67,19 @@ }; /** Detect free variable `exports`. */ - var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; + var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; /** Detect free variable `module`. */ - var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; + var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = (freeModule && freeModule.exports === freeExports) + ? freeExports + : undefined; /** Detect free variable `global` from Node.js. */ var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); @@ -80,9 +90,6 @@ /** Detect free variable `window`. */ var freeWindow = checkGlobal(objectTypes[typeof window] && window); - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; - /** Detect `this` as the global object. */ var thisGlobal = checkGlobal(objectTypes[typeof this] && this); @@ -92,7 +99,9 @@ * The `this` value is used if it's the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ - var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); + var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ @@ -117,13 +126,7 @@ * @returns {Array} Returns `array`. */ function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } + array.push.apply(array, values); return array; } @@ -165,7 +168,8 @@ * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. + * @param {boolean} [retKey] Specify returning the key of the found element + * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { @@ -187,7 +191,8 @@ * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ @@ -352,7 +357,8 @@ var idCounter = 0; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -365,6 +371,7 @@ Symbol = root.Symbol, Uint8Array = root.Uint8Array, enumerate = Reflect ? Reflect.enumerate : undefined, + objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -372,29 +379,32 @@ nativeKeys = Object.keys, nativeMax = Math.max; + /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ + var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); + /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps `value` to enable implicit method - * chaining. Methods that operate on and return arrays, collections, and - * functions can be chained together. Methods that retrieve a single value or - * may return a primitive value will automatically end the chain sequence and - * return the unwrapped value. Otherwise, the value must be unwrapped with - * `_#value`. + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. * - * Explicit chaining, which must be unwrapped with `_#value` in all cases, - * may be enabled using `_.chain`. + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. * * The execution of chained methods is lazy, that is, it's deferred until * `_#value` is implicitly or explicitly called. * - * Lazy evaluation allows several methods to support shortcut fusion. Shortcut - * fusion is an optimization to merge iteratee calls; this avoids the creation - * of intermediate arrays and can greatly reduce the number of iteratee executions. - * Sections of a chain sequence qualify for shortcut fusion if the section is - * applied to an array of at least two hundred elements and any iteratees - * accept only one argument. The heuristic for whether a section qualifies - * for shortcut fusion is subject to change. + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array of at least `200` elements + * and any iteratees accept only one argument. The heuristic for whether a + * section qualifies for shortcut fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. @@ -413,51 +423,55 @@ * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` * * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, - * `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`, - * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, - * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, - * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, - * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`, - * `flowRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, - * `intersection`, `intersectionBy`, `intersectionWith`, `invert`, `invertBy`, - * `invokeMap`, `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, - * `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, - * `method`, `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, - * `orderBy`, `over`, `overArgs`, `overEvery`, `overSome`, `partial`, - * `partialRight`, `partition`, `pick`, `pickBy`, `plant`, `property`, - * `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, - * `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`, `sampleSize`, - * `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, - * `thru`, `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, - * `transform`, `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, - * `uniqWith`, `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, - * `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`, - * `zipObjectDeep`, and `zipWith` + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` * * The wrapper methods that are **not** chainable by default are: * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, - * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, - * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`, + * `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`, + * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`, + * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`, + * `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`, + * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`, - * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, `isMatchWith`, - * `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`, - * `isPlainObject`, `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`, - * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, - * `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`, + * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`, + * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, + * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, + * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, + * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, + * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, * `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`, * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, - * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toLower`, - * `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, - * `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, - * `upperCase`, `upperFirst`, `value`, and `words` + * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`, + * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`, + * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, + * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` * * @name _ * @constructor @@ -486,15 +500,9 @@ * // => true */ function lodash(value) { - if (isObjectLike(value) && !isArray(value)) { - if (value instanceof LodashWrapper) { - return value; - } - if (hasOwnProperty.call(value, '__wrapped__')) { - return wrapperClone(value); - } - } - return new LodashWrapper(value); + return value instanceof LodashWrapper + ? value + : new LodashWrapper(value); } /** @@ -502,7 +510,7 @@ * * @private * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable chaining for all wrapper methods. + * @param {boolean} [chainAll] Enable explicit method chain sequences. */ function LodashWrapper(value, chainAll) { this.__wrapped__ = value; @@ -510,6 +518,9 @@ this.__chain__ = !!chainAll; } + LodashWrapper.prototype = baseCreate(lodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + /*------------------------------------------------------------------------*/ /** @@ -542,8 +553,7 @@ */ function assignValue(object, key, value) { var objValue = object[key]; - if ((!eq(objValue, value) || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) || + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { object[key] = value; } @@ -557,17 +567,9 @@ * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ - var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; - }()); + function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; + } /** * The base implementation of `_.delay` and `_.defer` which accepts an array @@ -602,7 +604,8 @@ * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` */ function baseEvery(collection, predicate) { var result = true; @@ -636,24 +639,25 @@ * * @private * @param {Array} array The array to flatten. - * @param {boolean} [isDeep] Specify a deep flatten. - * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ - function baseFlatten(array, isDeep, isStrict, result) { - result || (result = []); - + function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; + predicate || (predicate = isFlattenable); + result || (result = []); + while (++index < length) { var value = array[index]; - if (isArrayLikeObject(value) && - (isStrict || isArray(value) || isArguments(value))) { - if (isDeep) { + if (depth > 0 && predicate(value)) { + if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, isDeep, isStrict, result); + baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } @@ -665,10 +669,9 @@ } /** - * The base implementation of `baseForIn` and `baseForOwn` which iterates - * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iteratee functions may exit iteration early by explicitly - * returning `false`. + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` invoking `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. @@ -740,7 +743,8 @@ * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` + * for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ @@ -752,44 +756,48 @@ if (!objIsArr) { objTag = objectToString.call(object); - if (objTag == argsTag) { - objTag = objectTag; - } + objTag = objTag == argsTag ? objectTag : objTag; } if (!othIsArr) { othTag = objectToString.call(other); - if (othTag == argsTag) { - othTag = objectTag; - } + othTag = othTag == argsTag ? objectTag : othTag; } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); + stack || (stack = []); + var stacked = find(stack, function(entry) { + return entry[0] === object; + }); + if (stacked && stacked[1]) { + return stacked[1] == other; } - var isPartial = bitmask & PARTIAL_COMPARE_FLAG; - if (!isPartial) { + stack.push([object, other]); + if (isSameTag && !objIsObj) { + var result = (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) + : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); + stack.pop(); + return result; + } + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + var result = equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + stack.pop(); + return result; } } if (!isSameTag) { return false; } - stack || (stack = []); - var stacked = find(stack, function(entry) { - return entry[0] === object; - }); - if (stacked && stacked[1]) { - return stacked[1] == other; - } - stack.push([object, other]); - var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); + var result = equalObjects(object, other, equalFunc, customizer, bitmask, stack); stack.pop(); return result; } @@ -802,13 +810,13 @@ * @returns {Function} Returns the iteratee. */ function baseIteratee(func) { - var type = typeof func; - if (type == 'function') { + if (typeof func == 'function') { return func; } - return func == null - ? identity - : (type == 'object' ? baseMatches : baseProperty)(func); + if (func == null) { + return identity; + } + return (typeof func == 'object' ? baseMatches : baseProperty)(func); } /** @@ -816,7 +824,6 @@ * property of prototypes or treat sparse arrays as dense. * * @private - * @type Function * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ @@ -896,11 +903,11 @@ /** * The base implementation of `_.pick` without support for individual - * property names. + * property identifiers. * * @private * @param {Object} object The source object. - * @param {string[]} props The property names to pick. + * @param {string[]} props The property identifiers to pick. * @returns {Object} Returns the new object. */ function basePick(object, props) { @@ -974,7 +981,8 @@ * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ function baseSome(collection, predicate) { var result; @@ -1008,7 +1016,7 @@ * * @private * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. + * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @returns {Object} Returns `object`. */ @@ -1020,7 +1028,7 @@ * * @private * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. + * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. @@ -1032,8 +1040,11 @@ length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -1053,7 +1064,10 @@ length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined; - customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; + customizer = typeof customizer == 'function' + ? (length--, customizer) + : undefined; + object = Object(object); while (++index < length) { var source = sources[index]; @@ -1095,7 +1109,7 @@ } /** - * Creates a base function for methods like `_.forIn`. + * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. @@ -1128,8 +1142,8 @@ */ function createCtorWrapper(Ctor) { return function() { - // Use a `switch` statement to work with class constructors. - // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; var thisBinding = baseCreate(Ctor.prototype), @@ -1142,15 +1156,16 @@ } /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg` and the `partials` prepended to those provided to - * the wrapper. + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to the new function. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. * @returns {Function} Returns the new wrapped function. */ function createPartialWrapper(func, bitmask, thisArg, partials) { @@ -1187,9 +1202,10 @@ * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `array` and `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { @@ -1220,12 +1236,16 @@ // Recursively compare arrays (susceptible to call stack limits). if (isUnordered) { if (!baseSome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); + return arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack); })) { result = false; break; } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack) + )) { result = false; break; } @@ -1245,17 +1265,20 @@ * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ - function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { + function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { switch (tag) { case boolTag: case dateTag: - // Coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + // Coerce dates and booleans to numbers, dates to milliseconds and + // booleans to `1` or `0` treating invalid dates coerced to `NaN` as + // not equal. return +object == +other; case errorTag: @@ -1267,8 +1290,9 @@ case regexpTag: case stringTag: - // Coerce regexes to strings and treat strings primitives and string - // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring + // for more details. return object == (other + ''); } @@ -1283,9 +1307,10 @@ * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { @@ -1342,8 +1367,9 @@ /** * Gets the "length" property value of `object`. * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. @@ -1369,41 +1395,28 @@ } /** - * Checks if `value` is likely a prototype object. + * Checks if `value` is a flattenable `arguments` object or array. * * @private * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; + function isFlattenable(value) { + return isArrayLikeObject(value) && (isArray(value) || isArguments(value)); } /** - * Converts `value` to a function if it's not one. + * Checks if `value` is likely a prototype object. * * @private - * @param {*} value The value to process. - * @returns {Function} Returns the function. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ - function toFunction(value) { - return typeof value == 'function' ? value : identity; - } + function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - /** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ - function wrapperClone(wrapper) { - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - return result; + return value === proto; } /*------------------------------------------------------------------------*/ @@ -1414,6 +1427,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the new array of filtered values. @@ -1432,6 +1446,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. @@ -1447,48 +1462,56 @@ * console.log(array); * // => [1] */ - var concat = rest(function(array, values) { - if (!isArray(array)) { - array = array == null ? [] : [Object(array)]; + function concat() { + var length = arguments.length, + array = castArray(arguments[0]); + + if (length < 2) { + return length ? copyArray(array) : []; } - values = baseFlatten(values); - return arrayConcat(array, values); - }); + var args = Array(length - 1); + while (length--) { + args[length - 1] = arguments[length]; + } + return arrayConcat(array, baseFlatten(args, 1)); + } /** - * Flattens `array` a single level. + * Flattens `array` a single level deep. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * - * _.flatten([1, [2, 3, [4]]]); - * // => [1, 2, 3, [4]] + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] */ function flatten(array) { var length = array ? array.length : 0; - return length ? baseFlatten(array) : []; + return length ? baseFlatten(array, 1) : []; } /** - * This method is like `_.flatten` except that it recursively flattens `array`. + * Recursively flattens `array`. * * @static * @memberOf _ + * @since 3.0.0 * @category Array - * @param {Array} array The array to recursively flatten. + * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * - * _.flattenDeep([1, [2, 3, [4]]]); - * // => [1, 2, 3, 4] + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] */ function flattenDeep(array) { var length = array ? array.length : 0; - return length ? baseFlatten(array, true) : []; + return length ? baseFlatten(array, INFINITY) : []; } /** @@ -1496,6 +1519,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @alias first * @category Array * @param {Array} array The array to query. @@ -1515,11 +1539,12 @@ /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `array`. + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. @@ -1558,6 +1583,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. @@ -1574,11 +1600,13 @@ /** * Creates a slice of `array` from `start` up to, but not including, `end`. * - * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice) - * to ensure dense arrays are returned. + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. @@ -1595,11 +1623,13 @@ /*------------------------------------------------------------------------*/ /** - * Creates a `lodash` object that wraps `value` with explicit method chaining enabled. - * The result of such method chaining must be unwrapped with `_#value`. + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. * * @static * @memberOf _ + * @since 1.3.0 * @category Seq * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` wrapper instance. @@ -1630,10 +1660,11 @@ /** * This method invokes `interceptor` and returns `value`. The interceptor * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain in order to modify intermediate results. + * "tap into" a method chain sequence in order to modify intermediate results. * * @static * @memberOf _ + * @since 0.1.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. @@ -1657,10 +1688,11 @@ /** * This method is like `_.tap` except that it returns the result of `interceptor`. * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain. + * results in a method chain sequence. * * @static * @memberOf _ + * @since 3.0.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. @@ -1681,10 +1713,11 @@ } /** - * Enables explicit method chaining on the wrapper object. + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. * * @name chain * @memberOf _ + * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example @@ -1711,10 +1744,11 @@ } /** - * Executes the chained sequence to extract the unwrapped value. + * Executes the chain sequence to resolve the unwrapped value. * * @name value * @memberOf _ + * @since 0.1.0 * @alias toJSON, valueOf * @category Seq * @returns {*} Returns the resolved unwrapped value. @@ -1736,19 +1770,22 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false } + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * // The `_.matches` iteratee shorthand. @@ -1770,14 +1807,16 @@ /** * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * @@ -1807,14 +1846,16 @@ /** * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -1848,12 +1889,13 @@ * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * - * **Note:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` - * for object iteration. + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. * * @static * @memberOf _ + * @since 0.1.0 * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. @@ -1864,19 +1906,19 @@ * _([1, 2]).forEach(function(value) { * console.log(value); * }); - * // => logs `1` then `2` + * // => Logs `1` then `2`. * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { - return baseEach(collection, toFunction(iteratee)); + return baseEach(collection, baseIteratee(iteratee)); } /** - * Creates an array of values by running each element in `collection` through + * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * @@ -1884,16 +1926,18 @@ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: - * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, - * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, - * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, - * and `words` + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `take`, `takeRight`, `template`, + * `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * @@ -1922,9 +1966,9 @@ /** * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` through `iteratee`, where each successive + * each element in `collection` thru `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` - * is not given the first element of `collection` is used as the initial + * is not given, the first element of `collection` is used as the initial * value. The iteratee is invoked with four arguments: * (accumulator, value, index|key, collection). * @@ -1937,6 +1981,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -1961,10 +2006,11 @@ /** * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable properties for objects. + * values or the number of own enumerable string keyed properties for objects. * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to inspect. * @returns {number} Returns the collection size. @@ -1994,11 +2040,14 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); @@ -2028,36 +2077,38 @@ /** * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through each iteratee. This method + * running each element in a collection thru each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] - * The iteratees to sort by, specified individually or in arrays. + * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])} + * [iteratees=[_.identity]] The iteratees to sort by, specified individually + * or in arrays. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 42 }, + * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, function(o) { return o.user; }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] * * _.sortBy(users, 'user', function(o) { * return Math.floor(o.age / 10); * }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function sortBy(collection, iteratee) { var index = 0; @@ -2079,6 +2130,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. @@ -2107,8 +2159,7 @@ /** * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and prepends any additional `_.bind` arguments to those provided to the - * bound function. + * and `partials` prepended to the arguments it receives. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. @@ -2118,6 +2169,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. @@ -2150,6 +2202,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke `func` with. @@ -2159,7 +2212,7 @@ * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // => logs 'deferred' after one or more milliseconds + * // => Logs 'deferred' after one or more milliseconds. */ var defer = rest(function(func, args) { return baseDelay(func, 1, args); @@ -2171,6 +2224,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. @@ -2181,7 +2235,7 @@ * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); - * // => logs 'later' after one second + * // => Logs 'later' after one second. */ var delay = rest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); @@ -2194,6 +2248,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new function. @@ -2222,6 +2277,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. @@ -2238,12 +2294,15 @@ /** * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. + * created function and arguments from `start` and beyond provided as + * an array. * - * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. @@ -2284,6 +2343,47 @@ /*------------------------------------------------------------------------*/ + /** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + /** * Creates a shallow clone of `value`. * @@ -2297,6 +2397,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to clone. * @returns {*} Returns the cloned value. @@ -2316,11 +2417,13 @@ } /** - * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. @@ -2354,10 +2457,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. * @example * * _.gt(3, 1); @@ -2378,9 +2483,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArguments(function() { return arguments; }()); @@ -2400,10 +2507,12 @@ * * @static * @memberOf _ - * @type Function + * @since 0.1.0 + * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -2427,7 +2536,7 @@ * * @static * @memberOf _ - * @type Function + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -2446,8 +2555,7 @@ * // => false */ function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); + return value != null && isLength(getLength(value)) && !isFunction(value); } /** @@ -2456,10 +2564,11 @@ * * @static * @memberOf _ - * @type Function + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); @@ -2483,9 +2592,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isBoolean(false); @@ -2504,9 +2615,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isDate(new Date); @@ -2520,14 +2633,20 @@ } /** - * Checks if `value` is empty. A value is considered empty unless it's an - * `arguments` object, array, string, or jQuery-like collection with a length - * greater than `0` or an object with own enumerable properties. + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang - * @param {Array|Object|string} value The value to inspect. + * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * @@ -2548,7 +2667,8 @@ */ function isEmpty(value) { if (isArrayLike(value) && - (isArray(value) || isString(value) || isFunction(value.splice) || isArguments(value))) { + (isArray(value) || isString(value) || + isFunction(value.splice) || isArguments(value))) { return !value.length; } for (var key in value) { @@ -2556,7 +2676,7 @@ return false; } } - return true; + return !(nonEnumShadows && keys(value).length); } /** @@ -2571,10 +2691,12 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @returns {boolean} Returns `true` if the values are equivalent, + * else `false`. * @example * * var object = { 'user': 'fred' }; @@ -2593,13 +2715,16 @@ /** * Checks if `value` is a finite primitive number. * - * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite). + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @returns {boolean} Returns `true` if `value` is a finite number, + * else `false`. * @example * * _.isFinite(3); @@ -2623,9 +2748,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -2636,8 +2763,8 @@ */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -2645,13 +2772,16 @@ /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. * @example * * _.isLength(3); @@ -2667,15 +2797,18 @@ * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -2704,6 +2837,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. @@ -2728,11 +2862,14 @@ /** * Checks if `value` is `NaN`. * - * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) - * which returns `true` for `undefined` and other non-numeric values. + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. @@ -2752,7 +2889,8 @@ */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. return isNumber(value) && value != +value; } @@ -2761,6 +2899,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. @@ -2779,14 +2918,16 @@ /** * Checks if `value` is classified as a `Number` primitive or object. * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified - * as numbers, use the `_.isFinite` method. + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isNumber(3); @@ -2811,9 +2952,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isRegExp(/abc/); @@ -2830,10 +2973,12 @@ * Checks if `value` is classified as a `String` primitive or object. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isString('abc'); @@ -2851,6 +2996,7 @@ * Checks if `value` is `undefined`. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. @@ -2872,10 +3018,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. * @example * * _.lt(1, 3); @@ -2895,6 +3043,7 @@ * Converts `value` to an array. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to convert. @@ -2923,10 +3072,12 @@ /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * **Note:** This function is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. @@ -2951,6 +3102,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. @@ -2976,6 +3128,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. @@ -3000,15 +3153,16 @@ /*------------------------------------------------------------------------*/ /** - * Assigns own enumerable properties of source objects to the destination - * object. Source objects are applied from left to right. Subsequent sources - * overwrite property assignments of previous sources. + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ + * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. @@ -3041,6 +3195,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @alias extend * @category Object * @param {Object} object The destination object. @@ -3067,15 +3222,16 @@ }); /** - * This method is like `_.assignIn` except that it accepts `customizer` which - * is invoked to produce the assigned values. If `customizer` returns `undefined` - * assignment is handled by the method instead. The `customizer` is invoked - * with five arguments: (objValue, srcValue, key, object, source). + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ + * @since 4.0.0 * @alias extendWith * @category Object * @param {Object} object The destination object. @@ -3098,11 +3254,13 @@ }); /** - * Creates an object that inherits from the `prototype` object. If a `properties` - * object is given its own enumerable properties are assigned to the created object. + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. * * @static * @memberOf _ + * @since 2.3.0 * @category Object * @param {Object} prototype The object to inherit from. * @param {Object} [properties] The properties to assign to the object. @@ -3135,14 +3293,15 @@ } /** - * Assigns own and inherited enumerable properties of source objects to the - * destination object for all destination properties that resolve to `undefined`. - * Source objects are applied from left to right. Once a property is set, - * additional values of the same property are ignored. + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. * * **Note:** This method mutates `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The destination object. @@ -3162,6 +3321,7 @@ * Checks if `path` is a direct property of `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -3169,16 +3329,16 @@ * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * - * var object = { 'a': { 'b': { 'c': 3 } } }; - * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.has(object, 'a'); * // => true * - * _.has(object, 'a.b.c'); + * _.has(object, 'a.b'); * // => true * - * _.has(object, ['a', 'b', 'c']); + * _.has(object, ['a', 'b']); * // => true * * _.has(other, 'a'); @@ -3196,6 +3356,7 @@ * for more details. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -3242,6 +3403,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. @@ -3281,11 +3443,12 @@ * Creates an object composed of the picked `object` properties. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property names to pick, specified - * individually or in arrays. + * @param {...(string|string[])} [props] The property identifiers to pick, + * specified individually or in arrays. * @returns {Object} Returns the new object. * @example * @@ -3295,20 +3458,21 @@ * // => { 'a': 1, 'c': 3 } */ var pick = rest(function(object, props) { - return object == null ? {} : basePick(object, baseFlatten(props)); + return object == null ? {} : basePick(object, baseFlatten(props, 1)); }); /** - * This method is like `_.get` except that if the resolved value is a function - * it's invoked with the `this` binding of its parent object and its result - * is returned. + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * @@ -3335,11 +3499,12 @@ } /** - * Creates an array of the own enumerable property values of `object`. + * Creates an array of the own enumerable string keyed property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -3374,20 +3539,22 @@ * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. - * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in IE < 9, they can break out of * attribute values or HTML comments. See [#59](https://html5sec.org/#59), * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) - * for more details. + * [#133](https://html5sec.org/#133) of the + * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. * - * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) - * to reduce XSS vectors. + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. * * @static + * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The string to escape. @@ -3410,6 +3577,7 @@ * This method returns the first argument given to it. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. @@ -3427,11 +3595,13 @@ /** * Creates a function that invokes `func` with the arguments of the created - * function. If `func` is a property name the created callback returns the - * property value for a given element. If `func` is an object the created - * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * function. If `func` is a property name, the created function returns the + * property value for a given element. If `func` is an array or object, the + * created function returns `true` for elements that contain the equivalent + * source properties, otherwise it returns `false`. * * @static + * @since 4.0.0 * @memberOf _ * @category Util * @param {*} [func=_.identity] The value to convert to a callback. @@ -3439,32 +3609,45 @@ * @example * * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } * ]; * + * // The `_.matches` iteratee shorthand. + * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); + * // => [{ 'user': 'barney', 'age': 36, 'active': true }] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, _.iteratee(['user', 'fred'])); + * // => [{ 'user': 'fred', 'age': 40 }] + * + * // The `_.property` iteratee shorthand. + * _.map(users, _.iteratee('user')); + * // => ['barney', 'fred'] + * * // Create custom iteratee shorthands. - * _.iteratee = _.wrap(_.iteratee, function(callback, func) { - * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); - * return !p ? callback(func) : function(object) { - * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { + * return !_.isRegExp(func) ? iteratee(func) : function(string) { + * return func.test(string); * }; * }); * - * _.filter(users, 'age > 36'); - * // => [{ 'user': 'fred', 'age': 40 }] + * _.filter(['abc', 'def'], /ef/); + * // => ['def'] */ var iteratee = baseIteratee; /** - * Creates a function that performs a deep partial comparison between a given + * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent - * property values, else `false`. + * property values, else `false`. The created function is equivalent to + * `_.isMatch` with a `source` partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. @@ -3483,21 +3666,21 @@ } /** - * Adds all own enumerable function properties of a source object to the - * destination object. If `object` is a function then methods are added to - * its prototype as well. + * Adds all own enumerable string keyed function properties of a source + * object to the destination object. If `object` is a function, then methods + * are added to its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. - * @param {Object} [options] The options object. - * @param {boolean} [options.chain=true] Specify whether the functions added - * are chainable. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.chain=true] Specify whether mixins are chainable. * @returns {Function|Object} Returns `object`. * @example * @@ -3559,6 +3742,7 @@ * the `lodash` function. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @returns {Function} Returns the `lodash` function. @@ -3579,6 +3763,7 @@ * * @static * @memberOf _ + * @since 2.3.0 * @category Util * @example * @@ -3592,12 +3777,13 @@ } /** - * Generates a unique ID. If `prefix` is given the ID is appended to it. + * Generates a unique ID. If `prefix` is given, the ID is appended to it. * * @static + * @since 0.1.0 * @memberOf _ * @category Util - * @param {string} [prefix] The value to prefix the ID with. + * @param {string} [prefix=''] The value to prefix the ID with. * @returns {string} Returns the unique ID. * @example * @@ -3615,10 +3801,11 @@ /*------------------------------------------------------------------------*/ /** - * Computes the maximum value of `array`. If `array` is empty or falsey + * Computes the maximum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. @@ -3638,10 +3825,11 @@ } /** - * Computes the minimum value of `array`. If `array` is empty or falsey + * Computes the minimum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. @@ -3662,10 +3850,7 @@ /*------------------------------------------------------------------------*/ - LodashWrapper.prototype = baseCreate(lodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - // Add functions that return wrapped values when chaining. + // Add methods that return wrapped values in chain sequences. lodash.assignIn = assignIn; lodash.before = before; lodash.bind = bind; @@ -3697,12 +3882,12 @@ // Add aliases. lodash.extend = assignIn; - // Add functions to `lodash.prototype`. + // Add methods to `lodash.prototype`. mixin(lodash, lodash); /*------------------------------------------------------------------------*/ - // Add functions that return unwrapped values when chaining. + // Add methods that return unwrapped values in chain sequences. lodash.clone = clone; lodash.escape = escape; lodash.every = every; @@ -3759,11 +3944,11 @@ * * @static * @memberOf _ - * @type string + * @type {string} */ lodash.VERSION = VERSION; - // Add `Array` and `String` methods to `lodash.prototype`. + // Add `Array` methods to `lodash.prototype`. baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', @@ -3772,15 +3957,16 @@ lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { - return func.apply(this.value(), args); + var value = this.value(); + return func.apply(isArray(value) ? value : [], args); } return this[chainName](function(value) { - return func.apply(value, args); + return func.apply(isArray(value) ? value : [], args); }); }; }); - // Add chaining functions to the `lodash` wrapper. + // Add chain sequence methods to the `lodash` wrapper. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; /*--------------------------------------------------------------------------*/ diff --git a/tools/eslint/node_modules/lodash/core.min.js b/tools/eslint/node_modules/lodash/core.min.js new file mode 100644 index 00000000000000..37cd8bddabac28 --- /dev/null +++ b/tools/eslint/node_modules/lodash/core.min.js @@ -0,0 +1,30 @@ +/** + * @license + * lodash 4.9.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * Build: `lodash core -o ./dist/lodash.core.js` + */ +;(function(){function n(n,t){return n.push.apply(n,t),n}function t(n,t,r){for(var e=-1,u=n.length;++e-1&&0==n%1&&(null==t?9007199254740991:t)>n}function a(n){return n instanceof l?n:new l(n)}function l(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function p(n,t,r,e){var u;return(u=n===pn)||(u=En[r],u=(n===u||n!==n&&u!==u)&&!kn.call(e,r)),u?t:n}function s(n){return Z(n)?Bn(n):{}}function h(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){ +n.apply(pn,r)},t)}function v(n,t){var r=true;return Cn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function y(n,t){var r=[];return Cn(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function g(t,r,e,u,o){var i=-1,c=t.length;for(e||(e=C),o||(o=[]);++i0&&e(f)?r>1?g(f,r-1,e,u,o):n(o,f):u||(o[o.length]=f)}return o}function b(n,t){return n&&Gn(n,t,on)}function _(n,t){return y(t,function(t){return X(n[t])})}function j(n,t,r,e,u){return n===t?true:null==n||null==t||!Z(n)&&!nn(t)?n!==n&&t!==t:d(n,t,j,r,e,u); +}function d(n,t,r,e,u,o){var i=Vn(n),f=Vn(t),a="[object Array]",l="[object Array]";i||(a=Sn.call(n),a="[object Arguments]"==a?"[object Object]":a),f||(l=Sn.call(t),l="[object Arguments]"==l?"[object Object]":l);var p="[object Object]"==a&&!c(n),f="[object Object]"==l&&!c(t),l=a==l;o||(o=[]);var s=M(o,function(t){return t[0]===n});return s&&s[1]?s[1]==t:(o.push([n,t]),l&&!p?(r=i||isTypedArray(n)?I(n,t,r,e,u,o):$(n,t,a),o.pop(),r):2&u||(i=p&&kn.call(n,"__wrapped__"),a=f&&kn.call(t,"__wrapped__"),!i&&!a)?l?(r=q(n,t,r,e,u,o), +o.pop(),r):false:(i=i?n.value():n,t=a?t.value():t,r=r(i,t,e,u,o),o.pop(),r))}function m(n){return typeof n=="function"?n:null==n?an:(typeof n=="object"?x:E)(n)}function O(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function w(n,t){var r=-1,e=W(n)?Array(n.length):[];return Cn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function x(n){var t=on(n);return function(r){var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];if(!(u in r&&j(n[u],r[u],pn,3)))return false}return true}}function A(n,t){ +return n=Object(n),U(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function E(n){return function(t){return null==t?pn:t[n]}}function k(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e1?r[u-1]:pn,o=typeof o=="function"?(u--,o):pn;for(t=Object(t);++ef))return false;for(a=true;++iarguments.length,Cn)}function V(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function"); +return n=Hn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=pn),r}}function H(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");return t=qn(t===pn?n.length-1:Hn(t),0),function(){for(var r=arguments,e=-1,u=qn(r.length-t,0),o=Array(u);++et}function Q(n){return nn(n)&&W(n)&&kn.call(n,"callee")&&(!Dn.call(n,"callee")||"[object Arguments]"==Sn.call(n)); +}function W(n){return null!=n&&Y(Jn(n))&&!X(n)}function X(n){return n=Z(n)?Sn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function Y(n){return typeof n=="number"&&n>-1&&0==n%1&&9007199254740991>=n}function Z(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function nn(n){return!!n&&typeof n=="object"}function tn(n){return typeof n=="number"||nn(n)&&"[object Number]"==Sn.call(n)}function rn(n){return typeof n=="string"||!Vn(n)&&nn(n)&&"[object String]"==Sn.call(n)}function en(n,t){ +return t>n}function un(n){return typeof n=="string"?n:null==n?"":n+""}function on(n){var t=G(n);if(!t&&!W(n))return $n(Object(n));var r,e=z(n),u=!!e,e=e||[],o=e.length;for(r in n)!kn.call(n,r)||u&&("length"==r||f(r,o))||t&&"constructor"==r||e.push(r);return e}function cn(n){for(var t=-1,r=G(n),e=O(n),u=e.length,o=z(n),i=!!o,o=o||[],c=o.length;++t"'`]/g,vn=RegExp(hn.source),yn=/^(?:0|[1-9]\d*)$/,gn={ +"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},bn={"function":true,object:true},_n=bn[typeof exports]&&exports&&!exports.nodeType?exports:pn,jn=bn[typeof module]&&module&&!module.nodeType?module:pn,dn=jn&&jn.exports===_n?_n:pn,mn=o(bn[typeof self]&&self),On=o(bn[typeof window]&&window),wn=o(bn[typeof this]&&this),xn=o(_n&&jn&&typeof global=="object"&&global)||On!==(wn&&wn.window)&&On||mn||wn||Function("return this")(),An=Array.prototype,En=Object.prototype,kn=En.hasOwnProperty,Nn=0,Sn=En.toString,Tn=xn._,Fn=xn.Reflect,Rn=Fn?Fn.f:pn,Bn=Object.create,Dn=En.propertyIsEnumerable,In=xn.isFinite,$n=Object.keys,qn=Math.max,zn=!Dn.call({ +valueOf:1},"valueOf");l.prototype=s(a.prototype),l.prototype.constructor=l;var Cn=function(n,t){return function(r,e){if(null==r)return r;if(!W(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++ot)return t?N(r):[];for(var e=Array(t-1);t--;)e[t-1]=arguments[t];return g(e,1),n(N(r),fn)},a.create=function(n,t){var r=s(n);return t?Ln(r,t):r},a.defaults=Xn,a.defer=Pn,a.delay=Un,a.filter=function(n,t){return y(n,m(t))},a.flatten=function(n){return n&&n.length?g(n,1):[]},a.flattenDeep=function(n){return n&&n.length?g(n,sn):[]},a.iteratee=Zn,a.keys=on,a.map=function(n,t){return w(n,m(t))},a.matches=function(n){ +return x(Ln({},n))},a.mixin=ln,a.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},a.once=function(n){return V(2,n)},a.pick=Yn,a.slice=function(n,t,r){var e=n?n.length:0;return r=r===pn?e:+r,e?k(n,null==t?0:+t,r):[]},a.sortBy=function(n,t){var r=0;return t=m(t),w(w(n,function(n,e,u){return{c:n,b:r++,a:t(n,e,u)}}).sort(function(n,t){var r;n:{r=n.a;var e=t.a;if(r!==e){var u=null===r,o=r===pn,i=r===r,c=null===e,f=e===pn,a=e===e; +if(r>e&&!c||!i||u&&!f&&a||o&&a){r=1;break n}if(e>r&&!u||!a||c&&!o&&i||f&&i){r=-1;break n}}r=0}return r||n.b-t.b}),E("c"))},a.tap=function(n,t){return t(n),n},a.thru=function(n,t){return t(n)},a.toArray=function(n){return W(n)?n.length?N(n):[]:fn(n)},a.values=fn,a.extend=Qn,ln(a,a),a.clone=function(n){return Z(n)?Vn(n)?N(n):F(n,on(n)):n},a.escape=function(n){return(n=un(n))&&vn.test(n)?n.replace(hn,i):n},a.every=function(n,t,r){return t=r?pn:t,v(n,m(t))},a.find=M,a.forEach=P,a.has=function(n,t){return null!=n&&kn.call(n,t); +},a.head=J,a.identity=an,a.indexOf=function(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?qn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r wait) { - complete(trailingCall, maxTimeoutId); - } else { - timeoutId = setTimeout(delayed, remaining); + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + result = wait - timeSinceLastCall; + + return maxWait === false ? result : nativeMin(result, maxWait - timeSinceLastInvoke); + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (!lastCallTime || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); } - function flush() { - if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) { - result = func.apply(thisArg, args); + function trailingEdge(time) { + clearTimeout(timerId); + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); } - cancel(); + lastArgs = lastThis = undefined; return result; } - function maxDelayed() { - complete(trailing, timeoutId); + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastCallTime = lastInvokeTime = 0; + lastArgs = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); } function debounced() { - args = arguments; - stamp = now(); - thisArg = this; - trailingCall = trailing && (timeoutId || !leading); - - if (maxWait === false) { - var leadingCall = leading && !timeoutId; - } else { - if (!lastCalled && !maxTimeoutId && !leading) { - lastCalled = stamp; - } - var remaining = maxWait - (stamp - lastCalled), - isCalled = remaining <= 0 || remaining > maxWait; - - if (isCalled) { - if (maxTimeoutId) { - maxTimeoutId = clearTimeout(maxTimeoutId); - } - lastCalled = stamp; - result = func.apply(thisArg, args); - } - else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(maxDelayed, remaining); + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); } - } - if (isCalled && timeoutId) { - timeoutId = clearTimeout(timeoutId); - } - else if (!timeoutId && wait !== maxWait) { - timeoutId = setTimeout(delayed, wait); - } - if (leadingCall) { - isCalled = true; - result = func.apply(thisArg, args); - } - if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = undefined; + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); } return result; } diff --git a/tools/eslint/node_modules/lodash/deburr.js b/tools/eslint/node_modules/lodash/deburr.js index 7e75034716cb71..6862072121b676 100644 --- a/tools/eslint/node_modules/lodash/deburr.js +++ b/tools/eslint/node_modules/lodash/deburr.js @@ -18,11 +18,14 @@ var rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']'; var reComboMark = RegExp(rsCombo, 'g'); /** - * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * Deburrs `string` by converting + * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * to basic latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. diff --git a/tools/eslint/node_modules/lodash/defaults.js b/tools/eslint/node_modules/lodash/defaults.js index eded2845c53c5e..f35301abcf260d 100644 --- a/tools/eslint/node_modules/lodash/defaults.js +++ b/tools/eslint/node_modules/lodash/defaults.js @@ -4,14 +4,15 @@ var apply = require('./_apply'), rest = require('./rest'); /** - * Assigns own and inherited enumerable properties of source objects to the - * destination object for all destination properties that resolve to `undefined`. - * Source objects are applied from left to right. Once a property is set, - * additional values of the same property are ignored. + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. * * **Note:** This method mutates `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The destination object. diff --git a/tools/eslint/node_modules/lodash/defaultsDeep.js b/tools/eslint/node_modules/lodash/defaultsDeep.js index c495aee4d9e6e6..c12d7293b567c4 100644 --- a/tools/eslint/node_modules/lodash/defaultsDeep.js +++ b/tools/eslint/node_modules/lodash/defaultsDeep.js @@ -11,6 +11,7 @@ var apply = require('./_apply'), * * @static * @memberOf _ + * @since 3.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. diff --git a/tools/eslint/node_modules/lodash/defer.js b/tools/eslint/node_modules/lodash/defer.js index f492b3df7ae851..b096f71b5fa89a 100644 --- a/tools/eslint/node_modules/lodash/defer.js +++ b/tools/eslint/node_modules/lodash/defer.js @@ -7,6 +7,7 @@ var baseDelay = require('./_baseDelay'), * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke `func` with. @@ -16,7 +17,7 @@ var baseDelay = require('./_baseDelay'), * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // => logs 'deferred' after one or more milliseconds + * // => Logs 'deferred' after one or more milliseconds. */ var defer = rest(function(func, args) { return baseDelay(func, 1, args); diff --git a/tools/eslint/node_modules/lodash/delay.js b/tools/eslint/node_modules/lodash/delay.js index 28d070c697f32b..cac90a9bce51ee 100644 --- a/tools/eslint/node_modules/lodash/delay.js +++ b/tools/eslint/node_modules/lodash/delay.js @@ -8,6 +8,7 @@ var baseDelay = require('./_baseDelay'), * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. @@ -18,7 +19,7 @@ var baseDelay = require('./_baseDelay'), * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); - * // => logs 'later' after one second + * // => Logs 'later' after one second. */ var delay = rest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); diff --git a/tools/eslint/node_modules/lodash/difference.js b/tools/eslint/node_modules/lodash/difference.js index 5036d8ef7a50b0..ae34b208bb1884 100644 --- a/tools/eslint/node_modules/lodash/difference.js +++ b/tools/eslint/node_modules/lodash/difference.js @@ -4,12 +4,14 @@ var baseDifference = require('./_baseDifference'), rest = require('./rest'); /** - * Creates an array of unique `array` values not included in the other - * given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. + * Creates an array of unique `array` values not included in the other given + * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. The order of result values is determined by the + * order they occur in the first array. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. @@ -21,7 +23,7 @@ var baseDifference = require('./_baseDifference'), */ var difference = rest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true)) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; }); diff --git a/tools/eslint/node_modules/lodash/differenceBy.js b/tools/eslint/node_modules/lodash/differenceBy.js index 550ccfa0f9d5ba..7ec2ae8a21c8ec 100644 --- a/tools/eslint/node_modules/lodash/differenceBy.js +++ b/tools/eslint/node_modules/lodash/differenceBy.js @@ -8,14 +8,17 @@ var baseDifference = require('./_baseDifference'), /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * by which they're compared. Result values are chosen from the first array. + * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * @@ -32,7 +35,7 @@ var differenceBy = rest(function(array, values) { iteratee = undefined; } return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true), baseIteratee(iteratee)) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : []; }); diff --git a/tools/eslint/node_modules/lodash/differenceWith.js b/tools/eslint/node_modules/lodash/differenceWith.js index b60f3a06811559..6ae89865e82f3f 100644 --- a/tools/eslint/node_modules/lodash/differenceWith.js +++ b/tools/eslint/node_modules/lodash/differenceWith.js @@ -6,11 +6,13 @@ var baseDifference = require('./_baseDifference'), /** * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The comparator - * is invoked with two arguments: (arrVal, othVal). + * which is invoked to compare elements of `array` to `values`. Result values + * are chosen from the first array. The comparator is invoked with two arguments: + * (arrVal, othVal). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. @@ -29,7 +31,7 @@ var differenceWith = rest(function(array, values) { comparator = undefined; } return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true), undefined, comparator) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) : []; }); diff --git a/tools/eslint/node_modules/lodash/divide.js b/tools/eslint/node_modules/lodash/divide.js new file mode 100644 index 00000000000000..2889d79928ede4 --- /dev/null +++ b/tools/eslint/node_modules/lodash/divide.js @@ -0,0 +1,22 @@ +var createMathOperation = require('./_createMathOperation'); + +/** + * Divide two numbers. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Math + * @param {number} dividend The first number in a division. + * @param {number} divisor The second number in a division. + * @returns {number} Returns the quotient. + * @example + * + * _.divide(6, 4); + * // => 1.5 + */ +var divide = createMathOperation(function(dividend, divisor) { + return dividend / divisor; +}); + +module.exports = divide; diff --git a/tools/eslint/node_modules/lodash/drop.js b/tools/eslint/node_modules/lodash/drop.js index 3094995c945f58..6124ef76933fa0 100644 --- a/tools/eslint/node_modules/lodash/drop.js +++ b/tools/eslint/node_modules/lodash/drop.js @@ -6,10 +6,11 @@ var baseSlice = require('./_baseSlice'), * * @static * @memberOf _ + * @since 0.5.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/dropRight.js b/tools/eslint/node_modules/lodash/dropRight.js index 61e12682bc4934..8aa3576e3fb4d0 100644 --- a/tools/eslint/node_modules/lodash/dropRight.js +++ b/tools/eslint/node_modules/lodash/dropRight.js @@ -6,10 +6,11 @@ var baseSlice = require('./_baseSlice'), * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/dropRightWhile.js b/tools/eslint/node_modules/lodash/dropRightWhile.js index 0c04ed25af50c0..98f457b8112a62 100644 --- a/tools/eslint/node_modules/lodash/dropRightWhile.js +++ b/tools/eslint/node_modules/lodash/dropRightWhile.js @@ -8,9 +8,11 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/dropWhile.js b/tools/eslint/node_modules/lodash/dropWhile.js index 72f94484cee278..94f76e01924549 100644 --- a/tools/eslint/node_modules/lodash/dropWhile.js +++ b/tools/eslint/node_modules/lodash/dropWhile.js @@ -8,9 +8,11 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/endsWith.js b/tools/eslint/node_modules/lodash/endsWith.js index 5da6b5e3072a57..204d61e9d4baee 100644 --- a/tools/eslint/node_modules/lodash/endsWith.js +++ b/tools/eslint/node_modules/lodash/endsWith.js @@ -7,11 +7,13 @@ var baseClamp = require('./_baseClamp'), * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to search from. - * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. + * @returns {boolean} Returns `true` if `string` ends with `target`, + * else `false`. * @example * * _.endsWith('abc', 'c'); diff --git a/tools/eslint/node_modules/lodash/entries.js b/tools/eslint/node_modules/lodash/entries.js new file mode 100644 index 00000000000000..7a88df2044638c --- /dev/null +++ b/tools/eslint/node_modules/lodash/entries.js @@ -0,0 +1 @@ +module.exports = require('./toPairs'); diff --git a/tools/eslint/node_modules/lodash/entriesIn.js b/tools/eslint/node_modules/lodash/entriesIn.js new file mode 100644 index 00000000000000..f6c6331c1de93f --- /dev/null +++ b/tools/eslint/node_modules/lodash/entriesIn.js @@ -0,0 +1 @@ +module.exports = require('./toPairsIn'); diff --git a/tools/eslint/node_modules/lodash/eq.js b/tools/eslint/node_modules/lodash/eq.js index 5df222d844d26f..e9445d4fa32237 100644 --- a/tools/eslint/node_modules/lodash/eq.js +++ b/tools/eslint/node_modules/lodash/eq.js @@ -1,9 +1,11 @@ /** - * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. diff --git a/tools/eslint/node_modules/lodash/escape.js b/tools/eslint/node_modules/lodash/escape.js index 62857ed2e5916f..176417c4c1e930 100644 --- a/tools/eslint/node_modules/lodash/escape.js +++ b/tools/eslint/node_modules/lodash/escape.js @@ -14,20 +14,22 @@ var reUnescapedHtml = /[&<>"'`]/g, * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. - * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in IE < 9, they can break out of * attribute values or HTML comments. See [#59](https://html5sec.org/#59), * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) - * for more details. + * [#133](https://html5sec.org/#133) of the + * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. * - * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) - * to reduce XSS vectors. + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. * * @static + * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The string to escape. diff --git a/tools/eslint/node_modules/lodash/escapeRegExp.js b/tools/eslint/node_modules/lodash/escapeRegExp.js index 52878c1d84738e..fe5196046bf19f 100644 --- a/tools/eslint/node_modules/lodash/escapeRegExp.js +++ b/tools/eslint/node_modules/lodash/escapeRegExp.js @@ -1,6 +1,9 @@ var toString = require('./toString'); -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); @@ -10,6 +13,7 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. diff --git a/tools/eslint/node_modules/lodash/every.js b/tools/eslint/node_modules/lodash/every.js index d100d0dbe670a8..14f68e744ff0a8 100644 --- a/tools/eslint/node_modules/lodash/every.js +++ b/tools/eslint/node_modules/lodash/every.js @@ -11,19 +11,22 @@ var arrayEvery = require('./_arrayEvery'), * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false } + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * // The `_.matches` iteratee shorthand. diff --git a/tools/eslint/node_modules/lodash/fill.js b/tools/eslint/node_modules/lodash/fill.js index 4c0119fed30f94..5730b7d1296df4 100644 --- a/tools/eslint/node_modules/lodash/fill.js +++ b/tools/eslint/node_modules/lodash/fill.js @@ -9,6 +9,7 @@ var baseFill = require('./_baseFill'), * * @static * @memberOf _ + * @since 3.2.0 * @category Array * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. diff --git a/tools/eslint/node_modules/lodash/filter.js b/tools/eslint/node_modules/lodash/filter.js index 1df81c4cc7a295..f6a71a58f484fa 100644 --- a/tools/eslint/node_modules/lodash/filter.js +++ b/tools/eslint/node_modules/lodash/filter.js @@ -5,14 +5,16 @@ var arrayFilter = require('./_arrayFilter'), /** * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * diff --git a/tools/eslint/node_modules/lodash/find.js b/tools/eslint/node_modules/lodash/find.js index c2ba356a0e97c4..83f0dbad0d9f11 100644 --- a/tools/eslint/node_modules/lodash/find.js +++ b/tools/eslint/node_modules/lodash/find.js @@ -6,14 +6,16 @@ var baseEach = require('./_baseEach'), /** * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * diff --git a/tools/eslint/node_modules/lodash/findIndex.js b/tools/eslint/node_modules/lodash/findIndex.js index 5343fd124d38c9..84acc7464282ea 100644 --- a/tools/eslint/node_modules/lodash/findIndex.js +++ b/tools/eslint/node_modules/lodash/findIndex.js @@ -7,9 +7,11 @@ var baseFindIndex = require('./_baseFindIndex'), * * @static * @memberOf _ + * @since 1.1.0 * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * diff --git a/tools/eslint/node_modules/lodash/findKey.js b/tools/eslint/node_modules/lodash/findKey.js index 95d01f392507de..16a9fd9ae8ef54 100644 --- a/tools/eslint/node_modules/lodash/findKey.js +++ b/tools/eslint/node_modules/lodash/findKey.js @@ -8,10 +8,13 @@ var baseFind = require('./_baseFind'), * * @static * @memberOf _ + * @since 1.1.0 * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. * @example * * var users = { diff --git a/tools/eslint/node_modules/lodash/findLast.js b/tools/eslint/node_modules/lodash/findLast.js index 0e5d5932badf58..d222a5588fab46 100644 --- a/tools/eslint/node_modules/lodash/findLast.js +++ b/tools/eslint/node_modules/lodash/findLast.js @@ -10,9 +10,11 @@ var baseEachRight = require('./_baseEachRight'), * * @static * @memberOf _ + * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * diff --git a/tools/eslint/node_modules/lodash/findLastIndex.js b/tools/eslint/node_modules/lodash/findLastIndex.js index 2e62b367687b95..bf397d8fff559c 100644 --- a/tools/eslint/node_modules/lodash/findLastIndex.js +++ b/tools/eslint/node_modules/lodash/findLastIndex.js @@ -7,9 +7,11 @@ var baseFindIndex = require('./_baseFindIndex'), * * @static * @memberOf _ + * @since 2.0.0 * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * diff --git a/tools/eslint/node_modules/lodash/findLastKey.js b/tools/eslint/node_modules/lodash/findLastKey.js index 0380b07ce4cd00..fb915df4644b03 100644 --- a/tools/eslint/node_modules/lodash/findLastKey.js +++ b/tools/eslint/node_modules/lodash/findLastKey.js @@ -8,10 +8,13 @@ var baseFind = require('./_baseFind'), * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. * @example * * var users = { diff --git a/tools/eslint/node_modules/lodash/flatMap.js b/tools/eslint/node_modules/lodash/flatMap.js index 1aaf28c4bc793e..f8307495f8cde3 100644 --- a/tools/eslint/node_modules/lodash/flatMap.js +++ b/tools/eslint/node_modules/lodash/flatMap.js @@ -2,15 +2,17 @@ var baseFlatten = require('./_baseFlatten'), map = require('./map'); /** - * Creates an array of flattened values by running each element in `collection` - * through `iteratee` and concating its result to the other mapped values. - * The iteratee is invoked with three arguments: (value, index|key, collection). + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * @@ -22,7 +24,7 @@ var baseFlatten = require('./_baseFlatten'), * // => [1, 1, 2, 2] */ function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee)); + return baseFlatten(map(collection, iteratee), 1); } module.exports = flatMap; diff --git a/tools/eslint/node_modules/lodash/flatMapDeep.js b/tools/eslint/node_modules/lodash/flatMapDeep.js new file mode 100644 index 00000000000000..3808262aab0f80 --- /dev/null +++ b/tools/eslint/node_modules/lodash/flatMapDeep.js @@ -0,0 +1,32 @@ +var baseFlatten = require('./_baseFlatten'), + map = require('./map'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); +} + +module.exports = flatMapDeep; diff --git a/tools/eslint/node_modules/lodash/flatMapDepth.js b/tools/eslint/node_modules/lodash/flatMapDepth.js new file mode 100644 index 00000000000000..d528bff265c493 --- /dev/null +++ b/tools/eslint/node_modules/lodash/flatMapDepth.js @@ -0,0 +1,32 @@ +var baseFlatten = require('./_baseFlatten'), + map = require('./map'), + toInteger = require('./toInteger'); + +/** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ +function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); +} + +module.exports = flatMapDepth; diff --git a/tools/eslint/node_modules/lodash/flatten.js b/tools/eslint/node_modules/lodash/flatten.js index 6a6b8cf7c69698..bd4f439789ac2a 100644 --- a/tools/eslint/node_modules/lodash/flatten.js +++ b/tools/eslint/node_modules/lodash/flatten.js @@ -1,21 +1,22 @@ var baseFlatten = require('./_baseFlatten'); /** - * Flattens `array` a single level. + * Flattens `array` a single level deep. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * - * _.flatten([1, [2, 3, [4]]]); - * // => [1, 2, 3, [4]] + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] */ function flatten(array) { var length = array ? array.length : 0; - return length ? baseFlatten(array) : []; + return length ? baseFlatten(array, 1) : []; } module.exports = flatten; diff --git a/tools/eslint/node_modules/lodash/flattenDeep.js b/tools/eslint/node_modules/lodash/flattenDeep.js index 3daab79e14009e..c20c781a84b6a5 100644 --- a/tools/eslint/node_modules/lodash/flattenDeep.js +++ b/tools/eslint/node_modules/lodash/flattenDeep.js @@ -1,21 +1,25 @@ var baseFlatten = require('./_baseFlatten'); +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + /** - * This method is like `_.flatten` except that it recursively flattens `array`. + * Recursively flattens `array`. * * @static * @memberOf _ + * @since 3.0.0 * @category Array - * @param {Array} array The array to recursively flatten. + * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * - * _.flattenDeep([1, [2, 3, [4]]]); - * // => [1, 2, 3, 4] + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] */ function flattenDeep(array) { var length = array ? array.length : 0; - return length ? baseFlatten(array, true) : []; + return length ? baseFlatten(array, INFINITY) : []; } module.exports = flattenDeep; diff --git a/tools/eslint/node_modules/lodash/flattenDepth.js b/tools/eslint/node_modules/lodash/flattenDepth.js new file mode 100644 index 00000000000000..a0f4b5259a556d --- /dev/null +++ b/tools/eslint/node_modules/lodash/flattenDepth.js @@ -0,0 +1,33 @@ +var baseFlatten = require('./_baseFlatten'), + toInteger = require('./toInteger'); + +/** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ +function flattenDepth(array, depth) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(array, depth); +} + +module.exports = flattenDepth; diff --git a/tools/eslint/node_modules/lodash/flip.js b/tools/eslint/node_modules/lodash/flip.js index 6e14896fa8395e..82f796c240aed9 100644 --- a/tools/eslint/node_modules/lodash/flip.js +++ b/tools/eslint/node_modules/lodash/flip.js @@ -8,6 +8,7 @@ var FLIP_FLAG = 512; * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to flip arguments for. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/floor.js b/tools/eslint/node_modules/lodash/floor.js index 9bbf097b43e69d..ab6dfa28a4c591 100644 --- a/tools/eslint/node_modules/lodash/floor.js +++ b/tools/eslint/node_modules/lodash/floor.js @@ -5,6 +5,7 @@ var createRound = require('./_createRound'); * * @static * @memberOf _ + * @since 3.10.0 * @category Math * @param {number} number The number to round down. * @param {number} [precision=0] The precision to round down to. diff --git a/tools/eslint/node_modules/lodash/flow.js b/tools/eslint/node_modules/lodash/flow.js index b773405f6a9b6b..004cda01a495c8 100644 --- a/tools/eslint/node_modules/lodash/flow.js +++ b/tools/eslint/node_modules/lodash/flow.js @@ -7,6 +7,7 @@ var createFlow = require('./_createFlow'); * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/flowRight.js b/tools/eslint/node_modules/lodash/flowRight.js index e844822bdac2cc..f543f252f1a908 100644 --- a/tools/eslint/node_modules/lodash/flowRight.js +++ b/tools/eslint/node_modules/lodash/flowRight.js @@ -5,6 +5,7 @@ var createFlow = require('./_createFlow'); * invokes the given functions from right to left. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. diff --git a/tools/eslint/node_modules/lodash/forEach.js b/tools/eslint/node_modules/lodash/forEach.js index e7bde6dee8b915..5f8d9b015cda87 100644 --- a/tools/eslint/node_modules/lodash/forEach.js +++ b/tools/eslint/node_modules/lodash/forEach.js @@ -1,19 +1,20 @@ var arrayEach = require('./_arrayEach'), baseEach = require('./_baseEach'), - isArray = require('./isArray'), - toFunction = require('./_toFunction'); + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'); /** * Iterates over elements of `collection` invoking `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * - * **Note:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` - * for object iteration. + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. * * @static * @memberOf _ + * @since 0.1.0 * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. @@ -24,17 +25,17 @@ var arrayEach = require('./_arrayEach'), * _([1, 2]).forEach(function(value) { * console.log(value); * }); - * // => logs `1` then `2` + * // => Logs `1` then `2`. * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEach(collection, iteratee) - : baseEach(collection, toFunction(iteratee)); + : baseEach(collection, baseIteratee(iteratee)); } module.exports = forEach; diff --git a/tools/eslint/node_modules/lodash/forEachRight.js b/tools/eslint/node_modules/lodash/forEachRight.js index 68f2e2f2c5cc6e..17a7137cbd1256 100644 --- a/tools/eslint/node_modules/lodash/forEachRight.js +++ b/tools/eslint/node_modules/lodash/forEachRight.js @@ -1,7 +1,7 @@ var arrayEachRight = require('./_arrayEachRight'), baseEachRight = require('./_baseEachRight'), - isArray = require('./isArray'), - toFunction = require('./_toFunction'); + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'); /** * This method is like `_.forEach` except that it iterates over elements of @@ -9,6 +9,7 @@ var arrayEachRight = require('./_arrayEachRight'), * * @static * @memberOf _ + * @since 2.0.0 * @alias eachRight * @category Collection * @param {Array|Object} collection The collection to iterate over. @@ -19,12 +20,12 @@ var arrayEachRight = require('./_arrayEachRight'), * _.forEachRight([1, 2], function(value) { * console.log(value); * }); - * // => logs `2` then `1` + * // => Logs `2` then `1`. */ function forEachRight(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEachRight(collection, iteratee) - : baseEachRight(collection, toFunction(iteratee)); + : baseEachRight(collection, baseIteratee(iteratee)); } module.exports = forEachRight; diff --git a/tools/eslint/node_modules/lodash/forIn.js b/tools/eslint/node_modules/lodash/forIn.js index d68dd3ada05bfe..811237f6572471 100644 --- a/tools/eslint/node_modules/lodash/forIn.js +++ b/tools/eslint/node_modules/lodash/forIn.js @@ -1,15 +1,16 @@ var baseFor = require('./_baseFor'), - keysIn = require('./keysIn'), - toFunction = require('./_toFunction'); + baseIteratee = require('./_baseIteratee'), + keysIn = require('./keysIn'); /** - * Iterates over own and inherited enumerable properties of an object invoking - * `iteratee` for each property. The iteratee is invoked with three arguments: - * (value, key, object). Iteratee functions may exit iteration early by explicitly - * returning `false`. + * Iterates over own and inherited enumerable string keyed properties of an + * object invoking `iteratee` for each property. The iteratee is invoked with + * three arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. * * @static * @memberOf _ + * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -26,10 +27,12 @@ var baseFor = require('./_baseFor'), * _.forIn(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed) + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). */ function forIn(object, iteratee) { - return object == null ? object : baseFor(object, toFunction(iteratee), keysIn); + return object == null + ? object + : baseFor(object, baseIteratee(iteratee), keysIn); } module.exports = forIn; diff --git a/tools/eslint/node_modules/lodash/forInRight.js b/tools/eslint/node_modules/lodash/forInRight.js index 9dedc259de2753..00b73a7c1a9440 100644 --- a/tools/eslint/node_modules/lodash/forInRight.js +++ b/tools/eslint/node_modules/lodash/forInRight.js @@ -1,6 +1,6 @@ var baseForRight = require('./_baseForRight'), - keysIn = require('./keysIn'), - toFunction = require('./_toFunction'); + baseIteratee = require('./_baseIteratee'), + keysIn = require('./keysIn'); /** * This method is like `_.forIn` except that it iterates over properties of @@ -8,6 +8,7 @@ var baseForRight = require('./_baseForRight'), * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -24,10 +25,12 @@ var baseForRight = require('./_baseForRight'), * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c' + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. */ function forInRight(object, iteratee) { - return object == null ? object : baseForRight(object, toFunction(iteratee), keysIn); + return object == null + ? object + : baseForRight(object, baseIteratee(iteratee), keysIn); } module.exports = forInRight; diff --git a/tools/eslint/node_modules/lodash/forOwn.js b/tools/eslint/node_modules/lodash/forOwn.js index ee066cc7c8416b..a680e53a004bcb 100644 --- a/tools/eslint/node_modules/lodash/forOwn.js +++ b/tools/eslint/node_modules/lodash/forOwn.js @@ -1,14 +1,15 @@ var baseForOwn = require('./_baseForOwn'), - toFunction = require('./_toFunction'); + baseIteratee = require('./_baseIteratee'); /** - * Iterates over own enumerable properties of an object invoking `iteratee` - * for each property. The iteratee is invoked with three arguments: + * Iterates over own enumerable string keyed properties of an object invoking + * `iteratee` for each property. The iteratee is invoked with three arguments: * (value, key, object). Iteratee functions may exit iteration early by * explicitly returning `false`. * * @static * @memberOf _ + * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -25,10 +26,10 @@ var baseForOwn = require('./_baseForOwn'), * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forOwn(object, iteratee) { - return object && baseForOwn(object, toFunction(iteratee)); + return object && baseForOwn(object, baseIteratee(iteratee)); } module.exports = forOwn; diff --git a/tools/eslint/node_modules/lodash/forOwnRight.js b/tools/eslint/node_modules/lodash/forOwnRight.js index 1016195b97b123..5605475f48465b 100644 --- a/tools/eslint/node_modules/lodash/forOwnRight.js +++ b/tools/eslint/node_modules/lodash/forOwnRight.js @@ -1,5 +1,5 @@ var baseForOwnRight = require('./_baseForOwnRight'), - toFunction = require('./_toFunction'); + baseIteratee = require('./_baseIteratee'); /** * This method is like `_.forOwn` except that it iterates over properties of @@ -7,6 +7,7 @@ var baseForOwnRight = require('./_baseForOwnRight'), * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -23,10 +24,10 @@ var baseForOwnRight = require('./_baseForOwnRight'), * _.forOwnRight(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b' + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. */ function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, toFunction(iteratee)); + return object && baseForOwnRight(object, baseIteratee(iteratee)); } module.exports = forOwnRight; diff --git a/tools/eslint/node_modules/lodash/fp.js b/tools/eslint/node_modules/lodash/fp.js index d8887e0fe778ae..e372dbbdf6d539 100644 --- a/tools/eslint/node_modules/lodash/fp.js +++ b/tools/eslint/node_modules/lodash/fp.js @@ -1,2 +1,2 @@ -var _ = require('./lodash').noConflict().runInContext(); -module.exports = require('./fp/convert')(_); +var _ = require('./lodash.min').runInContext(); +module.exports = require('./fp/_baseConvert')(_, _); diff --git a/tools/eslint/node_modules/lodash/fp/__.js b/tools/eslint/node_modules/lodash/fp/__.js new file mode 100644 index 00000000000000..4af98deb4e9cca --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/__.js @@ -0,0 +1 @@ +module.exports = require('./placeholder'); diff --git a/tools/eslint/node_modules/lodash/fp/_baseConvert.js b/tools/eslint/node_modules/lodash/fp/_baseConvert.js index 76cc02ce86388b..e7e631ce4bbb01 100644 --- a/tools/eslint/node_modules/lodash/fp/_baseConvert.js +++ b/tools/eslint/node_modules/lodash/fp/_baseConvert.js @@ -1,14 +1,99 @@ var mapping = require('./_mapping'), mutateMap = mapping.mutate, - placeholder = {}; + fallbackHolder = require('./placeholder'); + +/** + * Creates a function, with an arity of `n`, that invokes `func` with the + * arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} n The arity of the new function. + * @returns {Function} Returns the new function. + */ +function baseArity(func, n) { + return n == 2 + ? function(a, b) { return func.apply(undefined, arguments); } + : function(a) { return func.apply(undefined, arguments); }; +} + +/** + * Creates a function that invokes `func`, with up to `n` arguments, ignoring + * any additional arguments. + * + * @private + * @param {Function} func The function to cap arguments for. + * @param {number} n The arity cap. + * @returns {Function} Returns the new function. + */ +function baseAry(func, n) { + return n == 2 + ? function(a, b) { return func(a, b); } + : function(a) { return func(a); }; +} + +/** + * Creates a clone of `array`. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the cloned array. + */ +function cloneArray(array) { + var length = array ? array.length : 0, + result = Array(length); + + while (length--) { + result[length] = array[length]; + } + return result; +} + +/** + * Creates a function that clones a given object using the assignment `func`. + * + * @private + * @param {Function} func The assignment function. + * @returns {Function} Returns the new cloner function. + */ +function createCloner(func) { + return function(object) { + return func({}, object); + }; +} + +/** + * Creates a function that wraps `func` and uses `cloner` to clone the first + * argument it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} cloner The function to clone arguments. + * @returns {Function} Returns the new immutable function. + */ +function immutWrap(func, cloner) { + return function() { + var length = arguments.length; + if (!length) { + return result; + } + var args = Array(length); + while (length--) { + args[length] = arguments[length]; + } + var result = args[0] = cloner.apply(undefined, args); + func.apply(undefined, args); + return result; + }; +} /** * The base implementation of `convert` which accepts a `util` object of methods * required to perform conversions. * * @param {Object} util The util object. - * @param {string} name The name of the function to wrap. - * @param {Function} func The function to wrap. + * @param {string} name The name of the function to convert. + * @param {Function} func The function to convert. * @param {Object} [options] The options object. * @param {boolean} [options.cap=true] Specify capping iteratee arguments. * @param {boolean} [options.curry=true] Specify currying. @@ -18,15 +103,20 @@ var mapping = require('./_mapping'), * @returns {Function|Object} Returns the converted function or object. */ function baseConvert(util, name, func, options) { - options || (options = {}); + var setPlaceholder, + isLib = typeof name == 'function', + isObj = name === Object(name); - if (typeof func != 'function') { + if (isObj) { + options = func; func = name; name = undefined; } if (func == null) { throw new TypeError; } + options || (options = {}); + var config = { 'cap': 'cap' in options ? options.cap : true, 'curry': 'curry' in options ? options.curry : true, @@ -35,103 +125,62 @@ function baseConvert(util, name, func, options) { 'rearg': 'rearg' in options ? options.rearg : true }; - var forceRearg = ('rearg' in options) && options.rearg; + var forceCurry = ('curry' in options) && options.curry, + forceFixed = ('fixed' in options) && options.fixed, + forceRearg = ('rearg' in options) && options.rearg, + placeholder = isLib ? func : fallbackHolder, + pristine = isLib ? func.runInContext() : undefined; - var isLib = name === undefined && typeof func.VERSION == 'string'; - - var _ = isLib ? func : { + var helpers = isLib ? func : { 'ary': util.ary, - 'cloneDeep': util.cloneDeep, + 'assign': util.assign, + 'clone': util.clone, 'curry': util.curry, 'forEach': util.forEach, + 'isArray': util.isArray, 'isFunction': util.isFunction, 'iteratee': util.iteratee, 'keys': util.keys, 'rearg': util.rearg, - 'spread': util.spread - }; - - var ary = _.ary, - cloneDeep = _.cloneDeep, - curry = _.curry, - each = _.forEach, - isFunction = _.isFunction, - keys = _.keys, - rearg = _.rearg, - spread = _.spread; - - var baseArity = function(func, n) { - return n == 2 - ? function(a, b) { return func.apply(undefined, arguments); } - : function(a) { return func.apply(undefined, arguments); }; - }; - - var baseAry = function(func, n) { - return n == 2 - ? function(a, b) { return func(a, b); } - : function(a) { return func(a); }; - }; - - var cloneArray = function(array) { - var length = array ? array.length : 0, - result = Array(length); - - while (length--) { - result[length] = array[length]; - } - return result; - }; - - var createCloner = function(func) { - return function(object) { - return func({}, object); - }; - }; - - var immutWrap = function(func, cloner) { - return overArg(func, cloner, true); - }; - - var iterateeAry = function(func, n) { - return overArg(func, function(func) { - return baseAry(func, n); - }); - }; - - var iterateeRearg = function(func, indexes) { - return overArg(func, function(func) { - var n = indexes.length; - return baseArity(rearg(baseAry(func, n), indexes), n); - }); + 'spread': util.spread, + 'toPath': util.toPath }; - var overArg = function(func, iteratee, retArg) { - return function() { - var length = arguments.length, - args = Array(length); + var ary = helpers.ary, + assign = helpers.assign, + clone = helpers.clone, + curry = helpers.curry, + each = helpers.forEach, + isArray = helpers.isArray, + isFunction = helpers.isFunction, + keys = helpers.keys, + rearg = helpers.rearg, + spread = helpers.spread, + toPath = helpers.toPath; - while (length--) { - args[length] = arguments[length]; - } - args[0] = iteratee(args[0]); - var result = func.apply(undefined, args); - return retArg ? args[0] : result; - }; - }; + var aryMethodKeys = keys(mapping.aryMethod); var wrappers = { + 'castArray': function(castArray) { + return function() { + var value = arguments[0]; + return isArray(value) + ? castArray(cloneArray(value)) + : castArray.apply(undefined, arguments); + }; + }, 'iteratee': function(iteratee) { return function() { var func = arguments[0], - arity = arguments[1]; + arity = arguments[1], + result = iteratee(func, arity), + length = result.length; - if (!config.cap) { - return iteratee(func, arity); + if (config.cap && typeof arity == 'number') { + arity = arity > 2 ? (arity - 2) : 1; + return (length && length <= arity) ? result : baseAry(result, arity); } - arity = arity > 2 ? (arity - 2) : 1; - func = iteratee(func); - var length = func.length; - return (length && length <= arity) ? func : baseAry(func, arity); + return result; }; }, 'mixin': function(mixin) { @@ -166,19 +215,148 @@ function baseConvert(util, name, func, options) { }, 'runInContext': function(runInContext) { return function(context) { - return baseConvert(util, runInContext(context), undefined, options); + return baseConvert(util, runInContext(context), options); }; } }; - var wrap = function(name, func) { + /*--------------------------------------------------------------------------*/ + + /** + * Creates a clone of `object` by `path`. + * + * @private + * @param {Object} object The object to clone. + * @param {Array|string} path The path to clone by. + * @returns {Object} Returns the cloned object. + */ + function cloneByPath(object, path) { + path = toPath(path); + + var index = -1, + length = path.length, + result = clone(Object(object)), + nested = result; + + while (nested != null && ++index < length) { + var key = path[index], + value = nested[key]; + + if (value != null) { + nested[key] = clone(Object(value)); + } + nested = nested[key]; + } + return result; + } + + /** + * Converts `lodash` to an immutable auto-curried iteratee-first data-last + * version with conversion `options` applied. + * + * @param {Object} [options] The options object. See `baseConvert` for more details. + * @returns {Function} Returns the converted `lodash`. + */ + function convertLib(options) { + return _.runInContext.convert(options)(undefined); + } + + /** + * Create a converter function for `func` of `name`. + * + * @param {string} name The name of the function to convert. + * @param {Function} func The function to convert. + * @returns {Function} Returns the new converter function. + */ + function createConverter(name, func) { + var oldOptions = options; + return function(options) { + var newUtil = isLib ? pristine : helpers, + newFunc = isLib ? pristine[name] : func, + newOptions = assign(assign({}, oldOptions), options); + + return baseConvert(newUtil, name, newFunc, newOptions); + }; + } + + /** + * Creates a function that wraps `func` to invoke its iteratee, with up to `n` + * arguments, ignoring any additional arguments. + * + * @private + * @param {Function} func The function to cap iteratee arguments for. + * @param {number} n The arity cap. + * @returns {Function} Returns the new function. + */ + function iterateeAry(func, n) { + return overArg(func, function(func) { + return typeof func == 'function' ? baseAry(func, n) : func; + }); + } + + /** + * Creates a function that wraps `func` to invoke its iteratee with arguments + * arranged according to the specified `indexes` where the argument value at + * the first index is provided as the first argument, the argument value at + * the second index is provided as the second argument, and so on. + * + * @private + * @param {Function} func The function to rearrange iteratee arguments for. + * @param {number[]} indexes The arranged argument indexes. + * @returns {Function} Returns the new function. + */ + function iterateeRearg(func, indexes) { + return overArg(func, function(func) { + var n = indexes.length; + return baseArity(rearg(baseAry(func, n), indexes), n); + }); + } + + /** + * Creates a function that invokes `func` with its first argument passed + * thru `transform`. + * + * @private + * @param {Function} func The function to wrap. + * @param {...Function} transform The functions to transform the first argument. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function() { + var length = arguments.length; + if (!length) { + return func(); + } + var args = Array(length); + while (length--) { + args[length] = arguments[length]; + } + var index = config.rearg ? 0 : (length - 1); + args[index] = transform(args[index]); + return func.apply(undefined, args); + }; + } + + /** + * Creates a function that wraps `func` and applys the conversions + * rules by `name`. + * + * @private + * @param {string} name The name of the function to wrap. + * @param {Function} func The function to wrap. + * @returns {Function} Returns the converted function. + */ + function wrap(name, func) { name = mapping.aliasToReal[name] || name; - var wrapper = wrappers[name]; + + var result, + wrapped = func, + wrapper = wrappers[name]; + if (wrapper) { - return wrapper(func); + wrapped = wrapper(func); } - var wrapped = func; - if (config.immutable) { + else if (config.immutable) { if (mutateMap.array[name]) { wrapped = immutWrap(func, cloneArray); } @@ -186,24 +364,24 @@ function baseConvert(util, name, func, options) { wrapped = immutWrap(func, createCloner(func)); } else if (mutateMap.set[name]) { - wrapped = immutWrap(func, cloneDeep); + wrapped = immutWrap(func, cloneByPath); } } - var result; - each(mapping.caps, function(cap) { - each(mapping.aryMethod[cap], function(otherName) { + each(aryMethodKeys, function(aryKey) { + each(mapping.aryMethod[aryKey], function(otherName) { if (name == otherName) { var aryN = !isLib && mapping.iterateeAry[name], reargIndexes = mapping.iterateeRearg[name], spreadStart = mapping.methodSpread[name]; - if (config.fixed) { + result = wrapped; + if (config.fixed && (forceFixed || !mapping.skipFixed[name])) { result = spreadStart === undefined - ? ary(wrapped, cap) - : spread(wrapped, spreadStart); + ? ary(result, aryKey) + : spread(result, spreadStart); } - if (config.rearg && cap > 1 && (forceRearg || !mapping.skipRearg[name])) { - result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]); + if (config.rearg && aryKey > 1 && (forceRearg || !mapping.skipRearg[name])) { + result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[aryKey]); } if (config.cap) { if (reargIndexes) { @@ -212,8 +390,9 @@ function baseConvert(util, name, func, options) { result = iterateeAry(result, aryN); } } - if (config.curry && cap > 1) { - result = curry(result, cap); + if (forceCurry || (config.curry && aryKey > 1)) { + forceCurry && console.log(forceCurry, name); + result = curry(result, aryKey); } return false; } @@ -221,36 +400,63 @@ function baseConvert(util, name, func, options) { return !result; }); - result || (result = func); + result || (result = wrapped); + if (result == func) { + result = forceCurry ? curry(result, 1) : function() { + return func.apply(this, arguments); + }; + } + result.convert = createConverter(name, func); if (mapping.placeholder[name]) { - func.placeholder = result.placeholder = placeholder; + setPlaceholder = true; + result.placeholder = func.placeholder = placeholder; } return result; - }; + } - if (!isLib) { + /*--------------------------------------------------------------------------*/ + + if (!isObj) { return wrap(name, func); } - // Add placeholder. - _.placeholder = placeholder; + var _ = func; - // Iterate over methods for the current ary cap. + // Convert methods by ary cap. var pairs = []; - each(mapping.caps, function(cap) { - each(mapping.aryMethod[cap], function(key) { - var func = _[mapping.rename[key] || key]; + each(aryMethodKeys, function(aryKey) { + each(mapping.aryMethod[aryKey], function(key) { + var func = _[mapping.remap[key] || key]; if (func) { pairs.push([key, wrap(key, func)]); } }); }); + // Convert remaining methods. + each(keys(_), function(key) { + var func = _[key]; + if (typeof func == 'function') { + var length = pairs.length; + while (length--) { + if (pairs[length][0] == key) { + return; + } + } + func.convert = createConverter(key, func); + pairs.push([key, func]); + } + }); + // Assign to `_` leaving `_.prototype` unchanged to allow chaining. each(pairs, function(pair) { _[pair[0]] = pair[1]; }); - // Wrap the lodash method and its aliases. + _.convert = convertLib; + if (setPlaceholder) { + _.placeholder = placeholder; + } + // Assign aliases. each(keys(_), function(key) { each(mapping.realToAlias[key] || [], function(alias) { _[alias] = _[key]; diff --git a/tools/eslint/node_modules/lodash/fp/_convertBrowser.js b/tools/eslint/node_modules/lodash/fp/_convertBrowser.js index 0e69e66cda6c94..1874a5423cccb5 100644 --- a/tools/eslint/node_modules/lodash/fp/_convertBrowser.js +++ b/tools/eslint/node_modules/lodash/fp/_convertBrowser.js @@ -1,14 +1,18 @@ var baseConvert = require('./_baseConvert'); /** - * Converts `lodash` to an immutable auto-curried iteratee-first data-last version. + * Converts `lodash` to an immutable auto-curried iteratee-first data-last + * version with conversion `options` applied. * - * @param {Function} lodash The lodash function. + * @param {Function} lodash The lodash function to convert. * @param {Object} [options] The options object. See `baseConvert` for more details. * @returns {Function} Returns the converted `lodash`. */ function browserConvert(lodash, options) { - return baseConvert(lodash, lodash, undefined, options); + return baseConvert(lodash, lodash, options); } +if (typeof _ == 'function') { + _ = browserConvert(_.runInContext()); +} module.exports = browserConvert; diff --git a/tools/eslint/node_modules/lodash/fp/_falseOptions.js b/tools/eslint/node_modules/lodash/fp/_falseOptions.js new file mode 100644 index 00000000000000..773235e3437296 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/_falseOptions.js @@ -0,0 +1,7 @@ +module.exports = { + 'cap': false, + 'curry': false, + 'fixed': false, + 'immutable': false, + 'rearg': false +}; diff --git a/tools/eslint/node_modules/lodash/fp/_mapping.js b/tools/eslint/node_modules/lodash/fp/_mapping.js index 75f0babaa65b9a..d9d43fd93805e7 100644 --- a/tools/eslint/node_modules/lodash/fp/_mapping.js +++ b/tools/eslint/node_modules/lodash/fp/_mapping.js @@ -1,22 +1,35 @@ /** Used to map aliases to their real names. */ exports.aliasToReal = { + + // Lodash aliases. + 'each': 'forEach', + 'eachRight': 'forEachRight', + 'entries': 'toPairs', + 'entriesIn': 'toPairsIn', + 'extend': 'assignIn', + 'extendWith': 'assignInWith', + 'first': 'head', + + // Ramda aliases. '__': 'placeholder', - 'all': 'some', + 'all': 'every', 'allPass': 'overEvery', + 'always': 'constant', + 'any': 'some', + 'anyPass': 'overSome', 'apply': 'spread', 'assoc': 'set', 'assocPath': 'set', + 'complement': 'negate', 'compose': 'flowRight', 'contains': 'includes', 'dissoc': 'unset', 'dissocPath': 'unset', - 'each': 'forEach', - 'eachRight': 'forEachRight', 'equals': 'isEqual', - 'extend': 'assignIn', - 'extendWith': 'assignInWith', - 'first': 'head', + 'identical': 'eq', 'init': 'initial', + 'invertObj': 'invert', + 'juxt': 'over', 'mapObj': 'mapValues', 'omitAll': 'omit', 'nAry': 'ary', @@ -28,7 +41,6 @@ exports.aliasToReal = { 'prop': 'get', 'propOf': 'propertyOf', 'propOr': 'getOr', - 'somePass': 'overSome', 'unapply': 'rest', 'unnest': 'flatten', 'useWith': 'overArgs', @@ -38,61 +50,58 @@ exports.aliasToReal = { /** Used to map ary to method names. */ exports.aryMethod = { - 1: [ - 'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs', - 'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over', - 'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext', - 'spread', 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words' - ], - 2: [ - 'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindKey', - 'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN', - 'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference', - 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', 'every', - 'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex', - 'findLastKey', 'flatMap', 'forEach', 'forEachRight', 'forIn', 'forInRight', - 'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn', - 'includes', 'indexOf', 'intersection', 'invertBy', 'invoke', 'invokeMap', - 'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map', - 'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit', - 'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', - 'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll', - 'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove', - 'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex', - 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy', - 'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile', - 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd', - 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset', - 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep' - ], - 3: [ - 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', - 'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith', - 'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace', - 'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', - 'unionWith', 'xorBy', 'xorWith', 'zipWith' - ], - 4: [ - 'fill', 'setWith' - ] + '1': [ + 'attempt', 'castArray', 'ceil', 'create', 'curry', 'curryRight', 'floor', + 'flow', 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', + 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest', 'reverse', + 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart', + 'uniqueId', 'words' + ], + '2': [ + 'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindAll', + 'bindKey', 'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN', + 'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference', + 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', + 'eq', 'every', 'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', + 'findLastIndex', 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', + 'forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', + 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', + 'intersection', 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', + 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', + 'matchesProperty', 'maxBy', 'meanBy', 'merge', 'minBy', 'multiply', 'omit', 'omitBy', + 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial', 'partialRight', + 'partition', 'pick', 'pickBy', 'pull', 'pullAll', 'pullAt', 'random', 'range', + 'rangeRight', 'rearg', 'reject', 'remove', 'repeat', 'restFrom', 'result', + 'sampleSize', 'some', 'sortBy', 'sortedIndex', 'sortedIndexOf', 'sortedLastIndex', + 'sortedLastIndexOf', 'sortedUniqBy', 'split', 'spreadFrom', 'startsWith', + 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile', 'takeWhile', 'tap', + 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd', 'trimCharsStart', + 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset', 'unzipWith', 'without', + 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep' + ], + '3': [ + 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', + 'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'invokeArgs', + 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth', 'mergeWith', + 'orderBy', 'padChars', 'padCharsEnd', 'padCharsStart', 'pullAllBy', + 'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set', 'slice', + 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', + 'update', 'xorBy', 'xorWith', 'zipWith' + ], + '4': [ + 'fill', 'setWith', 'updateWith' + ] }; /** Used to map ary to rearg configs. */ exports.aryRearg = { - 2: [1, 0], - 3: [2, 1, 0], - 4: [3, 2, 0, 1] + '2': [1, 0], + '3': [2, 0, 1], + '4': [3, 2, 0, 1] }; -/** Used to iterate `mapping.aryMethod` keys. */ -exports.caps = [1, 2, 3, 4]; - /** Used to map method names to their iteratee ary. */ exports.iterateeAry = { - 'assignWith': 2, - 'assignInWith': 2, - 'cloneDeepWith': 1, - 'cloneWith': 1, 'dropRightWhile': 1, 'dropWhile': 1, 'every': 1, @@ -104,14 +113,14 @@ exports.iterateeAry = { 'findLastIndex': 1, 'findLastKey': 1, 'flatMap': 1, + 'flatMapDeep': 1, + 'flatMapDepth': 1, 'forEach': 1, 'forEachRight': 1, 'forIn': 1, 'forInRight': 1, 'forOwn': 1, 'forOwnRight': 1, - 'isEqualWith': 2, - 'isMatchWith': 2, 'map': 1, 'mapKeys': 1, 'mapValues': 1, @@ -129,8 +138,6 @@ exports.iterateeAry = { /** Used to map method names to iteratee rearg configs. */ exports.iterateeRearg = { - 'findKey': [1], - 'findLastKey': [1], 'mapKeys': [1] }; @@ -138,20 +145,29 @@ exports.iterateeRearg = { exports.methodRearg = { 'assignInWith': [1, 2, 0], 'assignWith': [1, 2, 0], - 'clamp': [2, 0, 1], + 'getOr': [2, 1, 0], + 'isEqualWith': [1, 2, 0], + 'isMatchWith': [2, 1, 0], 'mergeWith': [1, 2, 0], - 'reduce': [2, 0, 1], - 'reduceRight': [2, 0, 1], - 'set': [2, 0, 1], + 'padChars': [2, 1, 0], + 'padCharsEnd': [2, 1, 0], + 'padCharsStart': [2, 1, 0], + 'pullAllBy': [2, 1, 0], + 'pullAllWith': [2, 1, 0], 'setWith': [3, 1, 2, 0], - 'slice': [2, 0, 1], - 'transform': [2, 0, 1] + 'sortedIndexBy': [2, 1, 0], + 'sortedLastIndexBy': [2, 1, 0], + 'updateWith': [3, 1, 2, 0], + 'zipWith': [1, 2, 0] }; /** Used to map method names to spread configs. */ exports.methodSpread = { + 'invokeArgs': 2, + 'invokeArgsMap': 2, 'partial': 1, - 'partialRight': 1 + 'partialRight': 1, + 'without': 1 }; /** Used to identify methods which mutate arrays or objects. */ @@ -161,6 +177,7 @@ exports.mutate = { 'pull': true, 'pullAll': true, 'pullAllBy': true, + 'pullAllWith': true, 'pullAt': true, 'remove': true, 'reverse': true @@ -178,7 +195,9 @@ exports.mutate = { 'set': { 'set': true, 'setWith': true, - 'unset': true + 'unset': true, + 'update': true, + 'updateWith': true } }; @@ -210,34 +229,59 @@ exports.realToAlias = (function() { }()); /** Used to map method names to other names. */ -exports.rename = { +exports.remap = { 'curryN': 'curry', 'curryRightN': 'curryRight', 'getOr': 'get', + 'invokeArgs': 'invoke', + 'invokeArgsMap': 'invokeMap', + 'padChars': 'pad', + 'padCharsEnd': 'padEnd', + 'padCharsStart': 'padStart', + 'restFrom': 'rest', + 'spreadFrom': 'spread', 'trimChars': 'trim', 'trimCharsEnd': 'trimEnd', 'trimCharsStart': 'trimStart' }; -/** Used to track methods that skip `_.rearg`. */ +/** Used to track methods that skip fixing their arity. */ +exports.skipFixed = { + 'castArray': true, + 'flow': true, + 'flowRight': true, + 'iteratee': true, + 'mixin': true, + 'runInContext': true +}; + +/** Used to track methods that skip rearranging arguments. */ exports.skipRearg = { 'add': true, 'assign': true, 'assignIn': true, + 'bind': true, + 'bindKey': true, 'concat': true, 'difference': true, + 'divide': true, + 'eq': true, 'gt': true, 'gte': true, + 'isEqual': true, 'lt': true, 'lte': true, 'matchesProperty': true, 'merge': true, + 'multiply': true, + 'overArgs': true, 'partial': true, 'partialRight': true, 'random': true, 'range': true, 'rangeRight': true, 'subtract': true, + 'without': true, 'zip': true, 'zipObject': true }; diff --git a/tools/eslint/node_modules/lodash/fp/_util.js b/tools/eslint/node_modules/lodash/fp/_util.js index e1baf3b0a05caa..d450396fc44804 100644 --- a/tools/eslint/node_modules/lodash/fp/_util.js +++ b/tools/eslint/node_modules/lodash/fp/_util.js @@ -1,11 +1,14 @@ module.exports = { 'ary': require('../ary'), - 'cloneDeep': require('../cloneDeep'), + 'assign': require('../_baseAssign'), + 'clone': require('../clone'), 'curry': require('../curry'), 'forEach': require('../_arrayEach'), + 'isArray': require('../isArray'), 'isFunction': require('../isFunction'), 'iteratee': require('../iteratee'), 'keys': require('../_baseKeys'), 'rearg': require('../rearg'), - 'spread': require('../spread') + 'spread': require('../spread'), + 'toPath': require('../toPath') }; diff --git a/tools/eslint/node_modules/lodash/fp/add.js b/tools/eslint/node_modules/lodash/fp/add.js index c51b8fa6a6f434..816eeece34bf25 100644 --- a/tools/eslint/node_modules/lodash/fp/add.js +++ b/tools/eslint/node_modules/lodash/fp/add.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('add', require('../add')); +var convert = require('./convert'), + func = convert('add', require('../add')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/after.js b/tools/eslint/node_modules/lodash/fp/after.js index 83691b7a59aecc..21a0167ab2dba5 100644 --- a/tools/eslint/node_modules/lodash/fp/after.js +++ b/tools/eslint/node_modules/lodash/fp/after.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('after', require('../after')); +var convert = require('./convert'), + func = convert('after', require('../after')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/all.js b/tools/eslint/node_modules/lodash/fp/all.js index 900ac25e836b2c..d0839f77ed712b 100644 --- a/tools/eslint/node_modules/lodash/fp/all.js +++ b/tools/eslint/node_modules/lodash/fp/all.js @@ -1 +1 @@ -module.exports = require('./some'); +module.exports = require('./every'); diff --git a/tools/eslint/node_modules/lodash/fp/always.js b/tools/eslint/node_modules/lodash/fp/always.js new file mode 100644 index 00000000000000..988770307bc639 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/always.js @@ -0,0 +1 @@ +module.exports = require('./constant'); diff --git a/tools/eslint/node_modules/lodash/fp/any.js b/tools/eslint/node_modules/lodash/fp/any.js new file mode 100644 index 00000000000000..900ac25e836b2c --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/any.js @@ -0,0 +1 @@ +module.exports = require('./some'); diff --git a/tools/eslint/node_modules/lodash/fp/somePass.js b/tools/eslint/node_modules/lodash/fp/anyPass.js similarity index 100% rename from tools/eslint/node_modules/lodash/fp/somePass.js rename to tools/eslint/node_modules/lodash/fp/anyPass.js diff --git a/tools/eslint/node_modules/lodash/fp/ary.js b/tools/eslint/node_modules/lodash/fp/ary.js index 0f75d18a316d79..8edf18778da3da 100644 --- a/tools/eslint/node_modules/lodash/fp/ary.js +++ b/tools/eslint/node_modules/lodash/fp/ary.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('ary', require('../ary')); +var convert = require('./convert'), + func = convert('ary', require('../ary')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/assign.js b/tools/eslint/node_modules/lodash/fp/assign.js index ad02bcb84ed5bd..23f47af17e13f9 100644 --- a/tools/eslint/node_modules/lodash/fp/assign.js +++ b/tools/eslint/node_modules/lodash/fp/assign.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('assign', require('../assign')); +var convert = require('./convert'), + func = convert('assign', require('../assign')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/assignIn.js b/tools/eslint/node_modules/lodash/fp/assignIn.js index 1ed4f0d7e6c589..6e7c65fad8e312 100644 --- a/tools/eslint/node_modules/lodash/fp/assignIn.js +++ b/tools/eslint/node_modules/lodash/fp/assignIn.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('assignIn', require('../assignIn')); +var convert = require('./convert'), + func = convert('assignIn', require('../assignIn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/assignInWith.js b/tools/eslint/node_modules/lodash/fp/assignInWith.js index 882145d9146db5..acb5923675eed7 100644 --- a/tools/eslint/node_modules/lodash/fp/assignInWith.js +++ b/tools/eslint/node_modules/lodash/fp/assignInWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('assignInWith', require('../assignInWith')); +var convert = require('./convert'), + func = convert('assignInWith', require('../assignInWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/assignWith.js b/tools/eslint/node_modules/lodash/fp/assignWith.js index 1ff052782f66b6..eb925212d522b5 100644 --- a/tools/eslint/node_modules/lodash/fp/assignWith.js +++ b/tools/eslint/node_modules/lodash/fp/assignWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('assignWith', require('../assignWith')); +var convert = require('./convert'), + func = convert('assignWith', require('../assignWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/at.js b/tools/eslint/node_modules/lodash/fp/at.js index 5da35250e07446..cc39d257c6bf88 100644 --- a/tools/eslint/node_modules/lodash/fp/at.js +++ b/tools/eslint/node_modules/lodash/fp/at.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('at', require('../at')); +var convert = require('./convert'), + func = convert('at', require('../at')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/attempt.js b/tools/eslint/node_modules/lodash/fp/attempt.js index d8a3be5234a696..26ca42ea04d354 100644 --- a/tools/eslint/node_modules/lodash/fp/attempt.js +++ b/tools/eslint/node_modules/lodash/fp/attempt.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('attempt', require('../attempt')); +var convert = require('./convert'), + func = convert('attempt', require('../attempt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/before.js b/tools/eslint/node_modules/lodash/fp/before.js index f2954a62e3df89..7a2de65d27ecc1 100644 --- a/tools/eslint/node_modules/lodash/fp/before.js +++ b/tools/eslint/node_modules/lodash/fp/before.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('before', require('../before')); +var convert = require('./convert'), + func = convert('before', require('../before')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/bind.js b/tools/eslint/node_modules/lodash/fp/bind.js index e054a486dad6fd..5cbe4f302fed07 100644 --- a/tools/eslint/node_modules/lodash/fp/bind.js +++ b/tools/eslint/node_modules/lodash/fp/bind.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('bind', require('../bind')); +var convert = require('./convert'), + func = convert('bind', require('../bind')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/bindAll.js b/tools/eslint/node_modules/lodash/fp/bindAll.js index 495b75c6e4960d..6b4a4a0f270266 100644 --- a/tools/eslint/node_modules/lodash/fp/bindAll.js +++ b/tools/eslint/node_modules/lodash/fp/bindAll.js @@ -1 +1,5 @@ -module.exports = require('../bindAll'); +var convert = require('./convert'), + func = convert('bindAll', require('../bindAll')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/bindKey.js b/tools/eslint/node_modules/lodash/fp/bindKey.js index 0b588c7a3ba247..6a46c6b19c5b75 100644 --- a/tools/eslint/node_modules/lodash/fp/bindKey.js +++ b/tools/eslint/node_modules/lodash/fp/bindKey.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('bindKey', require('../bindKey')); +var convert = require('./convert'), + func = convert('bindKey', require('../bindKey')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/camelCase.js b/tools/eslint/node_modules/lodash/fp/camelCase.js index 328041ec3b661a..87b77b49376e32 100644 --- a/tools/eslint/node_modules/lodash/fp/camelCase.js +++ b/tools/eslint/node_modules/lodash/fp/camelCase.js @@ -1 +1,5 @@ -module.exports = require('../camelCase'); +var convert = require('./convert'), + func = convert('camelCase', require('../camelCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/capitalize.js b/tools/eslint/node_modules/lodash/fp/capitalize.js index 186e6d98137e74..cac74e14f8ac58 100644 --- a/tools/eslint/node_modules/lodash/fp/capitalize.js +++ b/tools/eslint/node_modules/lodash/fp/capitalize.js @@ -1 +1,5 @@ -module.exports = require('../capitalize'); +var convert = require('./convert'), + func = convert('capitalize', require('../capitalize'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/castArray.js b/tools/eslint/node_modules/lodash/fp/castArray.js new file mode 100644 index 00000000000000..8681c099eaded1 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/castArray.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('castArray', require('../castArray')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/ceil.js b/tools/eslint/node_modules/lodash/fp/ceil.js index 7c3774bb506c70..f416b7294c453c 100644 --- a/tools/eslint/node_modules/lodash/fp/ceil.js +++ b/tools/eslint/node_modules/lodash/fp/ceil.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('ceil', require('../ceil')); +var convert = require('./convert'), + func = convert('ceil', require('../ceil')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/chain.js b/tools/eslint/node_modules/lodash/fp/chain.js index 2f139cc00ba0ca..604fe398b100c6 100644 --- a/tools/eslint/node_modules/lodash/fp/chain.js +++ b/tools/eslint/node_modules/lodash/fp/chain.js @@ -1 +1,5 @@ -module.exports = require('../chain'); +var convert = require('./convert'), + func = convert('chain', require('../chain'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/chunk.js b/tools/eslint/node_modules/lodash/fp/chunk.js index 9d32b8a31226fd..871ab08580b35e 100644 --- a/tools/eslint/node_modules/lodash/fp/chunk.js +++ b/tools/eslint/node_modules/lodash/fp/chunk.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('chunk', require('../chunk')); +var convert = require('./convert'), + func = convert('chunk', require('../chunk')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/clamp.js b/tools/eslint/node_modules/lodash/fp/clamp.js index 8ec3d9de54dd75..3b06c01ce139aa 100644 --- a/tools/eslint/node_modules/lodash/fp/clamp.js +++ b/tools/eslint/node_modules/lodash/fp/clamp.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('clamp', require('../clamp')); +var convert = require('./convert'), + func = convert('clamp', require('../clamp')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/clone.js b/tools/eslint/node_modules/lodash/fp/clone.js index afd2c156e6bea7..cadb59c917f86c 100644 --- a/tools/eslint/node_modules/lodash/fp/clone.js +++ b/tools/eslint/node_modules/lodash/fp/clone.js @@ -1 +1,5 @@ -module.exports = require('../clone'); +var convert = require('./convert'), + func = convert('clone', require('../clone'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/cloneDeep.js b/tools/eslint/node_modules/lodash/fp/cloneDeep.js index a17a6f801dde7c..a6107aac9480c3 100644 --- a/tools/eslint/node_modules/lodash/fp/cloneDeep.js +++ b/tools/eslint/node_modules/lodash/fp/cloneDeep.js @@ -1 +1,5 @@ -module.exports = require('../cloneDeep'); +var convert = require('./convert'), + func = convert('cloneDeep', require('../cloneDeep'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/cloneDeepWith.js b/tools/eslint/node_modules/lodash/fp/cloneDeepWith.js index 01c7fefdd53439..6f01e44a346d70 100644 --- a/tools/eslint/node_modules/lodash/fp/cloneDeepWith.js +++ b/tools/eslint/node_modules/lodash/fp/cloneDeepWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('cloneDeepWith', require('../cloneDeepWith')); +var convert = require('./convert'), + func = convert('cloneDeepWith', require('../cloneDeepWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/cloneWith.js b/tools/eslint/node_modules/lodash/fp/cloneWith.js index 9e9d7838ef2320..aa8857810e783d 100644 --- a/tools/eslint/node_modules/lodash/fp/cloneWith.js +++ b/tools/eslint/node_modules/lodash/fp/cloneWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('cloneWith', require('../cloneWith')); +var convert = require('./convert'), + func = convert('cloneWith', require('../cloneWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/commit.js b/tools/eslint/node_modules/lodash/fp/commit.js index 04e9eb94324ae9..130a894f89412a 100644 --- a/tools/eslint/node_modules/lodash/fp/commit.js +++ b/tools/eslint/node_modules/lodash/fp/commit.js @@ -1 +1,5 @@ -module.exports = require('../commit'); +var convert = require('./convert'), + func = convert('commit', require('../commit'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/compact.js b/tools/eslint/node_modules/lodash/fp/compact.js index b2ed9c7d812be8..ce8f7a1ac3e823 100644 --- a/tools/eslint/node_modules/lodash/fp/compact.js +++ b/tools/eslint/node_modules/lodash/fp/compact.js @@ -1 +1,5 @@ -module.exports = require('../compact'); +var convert = require('./convert'), + func = convert('compact', require('../compact'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/complement.js b/tools/eslint/node_modules/lodash/fp/complement.js new file mode 100644 index 00000000000000..93eb462b353923 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/complement.js @@ -0,0 +1 @@ +module.exports = require('./negate'); diff --git a/tools/eslint/node_modules/lodash/fp/concat.js b/tools/eslint/node_modules/lodash/fp/concat.js index c13a92abd9dcb3..e59346ad9834ff 100644 --- a/tools/eslint/node_modules/lodash/fp/concat.js +++ b/tools/eslint/node_modules/lodash/fp/concat.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('concat', require('../concat')); +var convert = require('./convert'), + func = convert('concat', require('../concat')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/cond.js b/tools/eslint/node_modules/lodash/fp/cond.js index a150a89eb99afa..6a0120efd408d0 100644 --- a/tools/eslint/node_modules/lodash/fp/cond.js +++ b/tools/eslint/node_modules/lodash/fp/cond.js @@ -1 +1,5 @@ -module.exports = require('../cond'); +var convert = require('./convert'), + func = convert('cond', require('../cond'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/conforms.js b/tools/eslint/node_modules/lodash/fp/conforms.js index 387dde1844d110..e193cd6c1fdec0 100644 --- a/tools/eslint/node_modules/lodash/fp/conforms.js +++ b/tools/eslint/node_modules/lodash/fp/conforms.js @@ -1 +1,5 @@ -module.exports = require('../conforms'); +var convert = require('./convert'), + func = convert('conforms', require('../conforms'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/constant.js b/tools/eslint/node_modules/lodash/fp/constant.js index 3bcd276866fec8..9e406fc09c1b10 100644 --- a/tools/eslint/node_modules/lodash/fp/constant.js +++ b/tools/eslint/node_modules/lodash/fp/constant.js @@ -1 +1,5 @@ -module.exports = require('../constant'); +var convert = require('./convert'), + func = convert('constant', require('../constant'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/convert.js b/tools/eslint/node_modules/lodash/fp/convert.js index a1d266fa6428c3..4795dc42460855 100644 --- a/tools/eslint/node_modules/lodash/fp/convert.js +++ b/tools/eslint/node_modules/lodash/fp/convert.js @@ -3,7 +3,8 @@ var baseConvert = require('./_baseConvert'), /** * Converts `func` of `name` to an immutable auto-curried iteratee-first data-last - * version. If `name` is an object its methods will be converted. + * version with conversion `options` applied. If `name` is an object its methods + * will be converted. * * @param {string} name The name of the function to wrap. * @param {Function} [func] The function to wrap. diff --git a/tools/eslint/node_modules/lodash/fp/countBy.js b/tools/eslint/node_modules/lodash/fp/countBy.js index ee4b942850e27e..dfa464326fe8dc 100644 --- a/tools/eslint/node_modules/lodash/fp/countBy.js +++ b/tools/eslint/node_modules/lodash/fp/countBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('countBy', require('../countBy')); +var convert = require('./convert'), + func = convert('countBy', require('../countBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/create.js b/tools/eslint/node_modules/lodash/fp/create.js index bdad77148c6321..752025fb83bb4c 100644 --- a/tools/eslint/node_modules/lodash/fp/create.js +++ b/tools/eslint/node_modules/lodash/fp/create.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('create', require('../create')); +var convert = require('./convert'), + func = convert('create', require('../create')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/curry.js b/tools/eslint/node_modules/lodash/fp/curry.js index d64722c1321514..b0b4168c500134 100644 --- a/tools/eslint/node_modules/lodash/fp/curry.js +++ b/tools/eslint/node_modules/lodash/fp/curry.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('curry', require('../curry')); +var convert = require('./convert'), + func = convert('curry', require('../curry')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/curryN.js b/tools/eslint/node_modules/lodash/fp/curryN.js index f33f7fc3fe9171..2ae7d00a62a578 100644 --- a/tools/eslint/node_modules/lodash/fp/curryN.js +++ b/tools/eslint/node_modules/lodash/fp/curryN.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('curryN', require('../curry')); +var convert = require('./convert'), + func = convert('curryN', require('../curry')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/curryRight.js b/tools/eslint/node_modules/lodash/fp/curryRight.js index 2e0470912cc216..cb619eb5d98b94 100644 --- a/tools/eslint/node_modules/lodash/fp/curryRight.js +++ b/tools/eslint/node_modules/lodash/fp/curryRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('curryRight', require('../curryRight')); +var convert = require('./convert'), + func = convert('curryRight', require('../curryRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/curryRightN.js b/tools/eslint/node_modules/lodash/fp/curryRightN.js index 510e4e40336576..2495afc89c3fce 100644 --- a/tools/eslint/node_modules/lodash/fp/curryRightN.js +++ b/tools/eslint/node_modules/lodash/fp/curryRightN.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('curryRightN', require('../curryRight')); +var convert = require('./convert'), + func = convert('curryRightN', require('../curryRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/debounce.js b/tools/eslint/node_modules/lodash/fp/debounce.js index a6b0407a2c605e..26122293af3a6f 100644 --- a/tools/eslint/node_modules/lodash/fp/debounce.js +++ b/tools/eslint/node_modules/lodash/fp/debounce.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('debounce', require('../debounce')); +var convert = require('./convert'), + func = convert('debounce', require('../debounce')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/deburr.js b/tools/eslint/node_modules/lodash/fp/deburr.js index f8e1a49393677e..96463ab88e7e5a 100644 --- a/tools/eslint/node_modules/lodash/fp/deburr.js +++ b/tools/eslint/node_modules/lodash/fp/deburr.js @@ -1 +1,5 @@ -module.exports = require('../deburr'); +var convert = require('./convert'), + func = convert('deburr', require('../deburr'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/defaults.js b/tools/eslint/node_modules/lodash/fp/defaults.js index 7c3b3ab96b430c..e1a8e6e7dbe936 100644 --- a/tools/eslint/node_modules/lodash/fp/defaults.js +++ b/tools/eslint/node_modules/lodash/fp/defaults.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('defaults', require('../defaults')); +var convert = require('./convert'), + func = convert('defaults', require('../defaults')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/defaultsDeep.js b/tools/eslint/node_modules/lodash/fp/defaultsDeep.js index c7480e217976dc..1f172ff9442840 100644 --- a/tools/eslint/node_modules/lodash/fp/defaultsDeep.js +++ b/tools/eslint/node_modules/lodash/fp/defaultsDeep.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('defaultsDeep', require('../defaultsDeep')); +var convert = require('./convert'), + func = convert('defaultsDeep', require('../defaultsDeep')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/defer.js b/tools/eslint/node_modules/lodash/fp/defer.js index 4126727cd6a405..ec7990fe224281 100644 --- a/tools/eslint/node_modules/lodash/fp/defer.js +++ b/tools/eslint/node_modules/lodash/fp/defer.js @@ -1 +1,5 @@ -module.exports = require('../defer'); +var convert = require('./convert'), + func = convert('defer', require('../defer'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/delay.js b/tools/eslint/node_modules/lodash/fp/delay.js index cd3b1c329437fa..556dbd568ee475 100644 --- a/tools/eslint/node_modules/lodash/fp/delay.js +++ b/tools/eslint/node_modules/lodash/fp/delay.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('delay', require('../delay')); +var convert = require('./convert'), + func = convert('delay', require('../delay')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/difference.js b/tools/eslint/node_modules/lodash/fp/difference.js index aea9ab8d16568a..2d0376542a7c24 100644 --- a/tools/eslint/node_modules/lodash/fp/difference.js +++ b/tools/eslint/node_modules/lodash/fp/difference.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('difference', require('../difference')); +var convert = require('./convert'), + func = convert('difference', require('../difference')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/differenceBy.js b/tools/eslint/node_modules/lodash/fp/differenceBy.js index ab65554afa176e..2f914910a987da 100644 --- a/tools/eslint/node_modules/lodash/fp/differenceBy.js +++ b/tools/eslint/node_modules/lodash/fp/differenceBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('differenceBy', require('../differenceBy')); +var convert = require('./convert'), + func = convert('differenceBy', require('../differenceBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/differenceWith.js b/tools/eslint/node_modules/lodash/fp/differenceWith.js index f932a2e478b685..bcf5ad2e1192c8 100644 --- a/tools/eslint/node_modules/lodash/fp/differenceWith.js +++ b/tools/eslint/node_modules/lodash/fp/differenceWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('differenceWith', require('../differenceWith')); +var convert = require('./convert'), + func = convert('differenceWith', require('../differenceWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/divide.js b/tools/eslint/node_modules/lodash/fp/divide.js new file mode 100644 index 00000000000000..82048c5e02a2ea --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/divide.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('divide', require('../divide')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/drop.js b/tools/eslint/node_modules/lodash/fp/drop.js index ccca2d0dad4a95..2fa9b4faa587f0 100644 --- a/tools/eslint/node_modules/lodash/fp/drop.js +++ b/tools/eslint/node_modules/lodash/fp/drop.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('drop', require('../drop')); +var convert = require('./convert'), + func = convert('drop', require('../drop')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/dropRight.js b/tools/eslint/node_modules/lodash/fp/dropRight.js index bd9a2bd7bd95b2..e98881fcd4479f 100644 --- a/tools/eslint/node_modules/lodash/fp/dropRight.js +++ b/tools/eslint/node_modules/lodash/fp/dropRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('dropRight', require('../dropRight')); +var convert = require('./convert'), + func = convert('dropRight', require('../dropRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/dropRightWhile.js b/tools/eslint/node_modules/lodash/fp/dropRightWhile.js index 2dbb2a3b665cd1..cacaa7019106cb 100644 --- a/tools/eslint/node_modules/lodash/fp/dropRightWhile.js +++ b/tools/eslint/node_modules/lodash/fp/dropRightWhile.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('dropRightWhile', require('../dropRightWhile')); +var convert = require('./convert'), + func = convert('dropRightWhile', require('../dropRightWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/dropWhile.js b/tools/eslint/node_modules/lodash/fp/dropWhile.js index 17e46ff4ef429e..285f864d127a25 100644 --- a/tools/eslint/node_modules/lodash/fp/dropWhile.js +++ b/tools/eslint/node_modules/lodash/fp/dropWhile.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('dropWhile', require('../dropWhile')); +var convert = require('./convert'), + func = convert('dropWhile', require('../dropWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/endsWith.js b/tools/eslint/node_modules/lodash/fp/endsWith.js index cbe8f8ca2aea07..17dc2a49511b3b 100644 --- a/tools/eslint/node_modules/lodash/fp/endsWith.js +++ b/tools/eslint/node_modules/lodash/fp/endsWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('endsWith', require('../endsWith')); +var convert = require('./convert'), + func = convert('endsWith', require('../endsWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/entries.js b/tools/eslint/node_modules/lodash/fp/entries.js new file mode 100644 index 00000000000000..7a88df2044638c --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/entries.js @@ -0,0 +1 @@ +module.exports = require('./toPairs'); diff --git a/tools/eslint/node_modules/lodash/fp/entriesIn.js b/tools/eslint/node_modules/lodash/fp/entriesIn.js new file mode 100644 index 00000000000000..f6c6331c1de93f --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/entriesIn.js @@ -0,0 +1 @@ +module.exports = require('./toPairsIn'); diff --git a/tools/eslint/node_modules/lodash/fp/eq.js b/tools/eslint/node_modules/lodash/fp/eq.js index 518a54df7d1c89..9a3d21bf1d1114 100644 --- a/tools/eslint/node_modules/lodash/fp/eq.js +++ b/tools/eslint/node_modules/lodash/fp/eq.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('eq', require('../eq')); +var convert = require('./convert'), + func = convert('eq', require('../eq')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/escape.js b/tools/eslint/node_modules/lodash/fp/escape.js index e5de9f23100dac..52c1fbba609036 100644 --- a/tools/eslint/node_modules/lodash/fp/escape.js +++ b/tools/eslint/node_modules/lodash/fp/escape.js @@ -1 +1,5 @@ -module.exports = require('../escape'); +var convert = require('./convert'), + func = convert('escape', require('../escape'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/escapeRegExp.js b/tools/eslint/node_modules/lodash/fp/escapeRegExp.js index ab18963a16714d..369b2eff6e1216 100644 --- a/tools/eslint/node_modules/lodash/fp/escapeRegExp.js +++ b/tools/eslint/node_modules/lodash/fp/escapeRegExp.js @@ -1 +1,5 @@ -module.exports = require('../escapeRegExp'); +var convert = require('./convert'), + func = convert('escapeRegExp', require('../escapeRegExp'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/every.js b/tools/eslint/node_modules/lodash/fp/every.js index 965f889b6b055c..95c2776c33e06c 100644 --- a/tools/eslint/node_modules/lodash/fp/every.js +++ b/tools/eslint/node_modules/lodash/fp/every.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('every', require('../every')); +var convert = require('./convert'), + func = convert('every', require('../every')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/fill.js b/tools/eslint/node_modules/lodash/fp/fill.js index e16f8bf336a114..b2d47e84eb159b 100644 --- a/tools/eslint/node_modules/lodash/fp/fill.js +++ b/tools/eslint/node_modules/lodash/fp/fill.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('fill', require('../fill')); +var convert = require('./convert'), + func = convert('fill', require('../fill')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/filter.js b/tools/eslint/node_modules/lodash/fp/filter.js index 7191a822380532..796d501ce827ca 100644 --- a/tools/eslint/node_modules/lodash/fp/filter.js +++ b/tools/eslint/node_modules/lodash/fp/filter.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('filter', require('../filter')); +var convert = require('./convert'), + func = convert('filter', require('../filter')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/find.js b/tools/eslint/node_modules/lodash/fp/find.js index 5915bbd04d56dc..f805d336aa148e 100644 --- a/tools/eslint/node_modules/lodash/fp/find.js +++ b/tools/eslint/node_modules/lodash/fp/find.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('find', require('../find')); +var convert = require('./convert'), + func = convert('find', require('../find')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/findIndex.js b/tools/eslint/node_modules/lodash/fp/findIndex.js index 6bf435c783d7f1..8c15fd11606166 100644 --- a/tools/eslint/node_modules/lodash/fp/findIndex.js +++ b/tools/eslint/node_modules/lodash/fp/findIndex.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('findIndex', require('../findIndex')); +var convert = require('./convert'), + func = convert('findIndex', require('../findIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/findKey.js b/tools/eslint/node_modules/lodash/fp/findKey.js index 3ff9844c1eea12..475bcfa8a5bc02 100644 --- a/tools/eslint/node_modules/lodash/fp/findKey.js +++ b/tools/eslint/node_modules/lodash/fp/findKey.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('findKey', require('../findKey')); +var convert = require('./convert'), + func = convert('findKey', require('../findKey')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/findLast.js b/tools/eslint/node_modules/lodash/fp/findLast.js index 31e169b382bfe5..093fe94e745e76 100644 --- a/tools/eslint/node_modules/lodash/fp/findLast.js +++ b/tools/eslint/node_modules/lodash/fp/findLast.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('findLast', require('../findLast')); +var convert = require('./convert'), + func = convert('findLast', require('../findLast')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/findLastIndex.js b/tools/eslint/node_modules/lodash/fp/findLastIndex.js index db41e8843006da..36986df0b8ae62 100644 --- a/tools/eslint/node_modules/lodash/fp/findLastIndex.js +++ b/tools/eslint/node_modules/lodash/fp/findLastIndex.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('findLastIndex', require('../findLastIndex')); +var convert = require('./convert'), + func = convert('findLastIndex', require('../findLastIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/findLastKey.js b/tools/eslint/node_modules/lodash/fp/findLastKey.js index ffe9e2a11e3b3d..5f81b604e8174b 100644 --- a/tools/eslint/node_modules/lodash/fp/findLastKey.js +++ b/tools/eslint/node_modules/lodash/fp/findLastKey.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('findLastKey', require('../findLastKey')); +var convert = require('./convert'), + func = convert('findLastKey', require('../findLastKey')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flatMap.js b/tools/eslint/node_modules/lodash/fp/flatMap.js index da249a883f43f4..d01dc4d0481c5b 100644 --- a/tools/eslint/node_modules/lodash/fp/flatMap.js +++ b/tools/eslint/node_modules/lodash/fp/flatMap.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('flatMap', require('../flatMap')); +var convert = require('./convert'), + func = convert('flatMap', require('../flatMap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flatMapDeep.js b/tools/eslint/node_modules/lodash/fp/flatMapDeep.js new file mode 100644 index 00000000000000..569c42eb9fa565 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/flatMapDeep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flatMapDeep', require('../flatMapDeep')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flatMapDepth.js b/tools/eslint/node_modules/lodash/fp/flatMapDepth.js new file mode 100644 index 00000000000000..6eb68fdeed81fe --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/flatMapDepth.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flatMapDepth', require('../flatMapDepth')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flatten.js b/tools/eslint/node_modules/lodash/fp/flatten.js index f1c1a6223a567d..30425d896232d7 100644 --- a/tools/eslint/node_modules/lodash/fp/flatten.js +++ b/tools/eslint/node_modules/lodash/fp/flatten.js @@ -1 +1,5 @@ -module.exports = require('../flatten'); +var convert = require('./convert'), + func = convert('flatten', require('../flatten'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flattenDeep.js b/tools/eslint/node_modules/lodash/fp/flattenDeep.js index c2ff9879b44681..aed5db27c09f37 100644 --- a/tools/eslint/node_modules/lodash/fp/flattenDeep.js +++ b/tools/eslint/node_modules/lodash/fp/flattenDeep.js @@ -1 +1,5 @@ -module.exports = require('../flattenDeep'); +var convert = require('./convert'), + func = convert('flattenDeep', require('../flattenDeep'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flattenDepth.js b/tools/eslint/node_modules/lodash/fp/flattenDepth.js new file mode 100644 index 00000000000000..ad65e378eff98d --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/flattenDepth.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flattenDepth', require('../flattenDepth')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flip.js b/tools/eslint/node_modules/lodash/fp/flip.js index 730bbd1bb6b488..0547e7b4eade18 100644 --- a/tools/eslint/node_modules/lodash/fp/flip.js +++ b/tools/eslint/node_modules/lodash/fp/flip.js @@ -1 +1,5 @@ -module.exports = require('../flip'); +var convert = require('./convert'), + func = convert('flip', require('../flip'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/floor.js b/tools/eslint/node_modules/lodash/fp/floor.js index f130f8b5941f8f..a6cf3358ed315a 100644 --- a/tools/eslint/node_modules/lodash/fp/floor.js +++ b/tools/eslint/node_modules/lodash/fp/floor.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('floor', require('../floor')); +var convert = require('./convert'), + func = convert('floor', require('../floor')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flow.js b/tools/eslint/node_modules/lodash/fp/flow.js index d9943c6d0340ac..cd83677a62ca36 100644 --- a/tools/eslint/node_modules/lodash/fp/flow.js +++ b/tools/eslint/node_modules/lodash/fp/flow.js @@ -1 +1,5 @@ -module.exports = require('../flow'); +var convert = require('./convert'), + func = convert('flow', require('../flow')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/flowRight.js b/tools/eslint/node_modules/lodash/fp/flowRight.js index 556dc378fb3965..972a5b9b1c2c06 100644 --- a/tools/eslint/node_modules/lodash/fp/flowRight.js +++ b/tools/eslint/node_modules/lodash/fp/flowRight.js @@ -1 +1,5 @@ -module.exports = require('../flowRight'); +var convert = require('./convert'), + func = convert('flowRight', require('../flowRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/forEach.js b/tools/eslint/node_modules/lodash/fp/forEach.js index d715ea662e59a2..2f494521c86f42 100644 --- a/tools/eslint/node_modules/lodash/fp/forEach.js +++ b/tools/eslint/node_modules/lodash/fp/forEach.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('forEach', require('../forEach')); +var convert = require('./convert'), + func = convert('forEach', require('../forEach')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/forEachRight.js b/tools/eslint/node_modules/lodash/fp/forEachRight.js index 90dd8dd29aac48..3ff97336bbf2b9 100644 --- a/tools/eslint/node_modules/lodash/fp/forEachRight.js +++ b/tools/eslint/node_modules/lodash/fp/forEachRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('forEachRight', require('../forEachRight')); +var convert = require('./convert'), + func = convert('forEachRight', require('../forEachRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/forIn.js b/tools/eslint/node_modules/lodash/fp/forIn.js index 90a8f07bb19e71..9341749b1f7198 100644 --- a/tools/eslint/node_modules/lodash/fp/forIn.js +++ b/tools/eslint/node_modules/lodash/fp/forIn.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('forIn', require('../forIn')); +var convert = require('./convert'), + func = convert('forIn', require('../forIn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/forInRight.js b/tools/eslint/node_modules/lodash/fp/forInRight.js index 505258f4426065..cecf8bbfa6cf82 100644 --- a/tools/eslint/node_modules/lodash/fp/forInRight.js +++ b/tools/eslint/node_modules/lodash/fp/forInRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('forInRight', require('../forInRight')); +var convert = require('./convert'), + func = convert('forInRight', require('../forInRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/forOwn.js b/tools/eslint/node_modules/lodash/fp/forOwn.js index 6fef1e3d508439..246449e9a832df 100644 --- a/tools/eslint/node_modules/lodash/fp/forOwn.js +++ b/tools/eslint/node_modules/lodash/fp/forOwn.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('forOwn', require('../forOwn')); +var convert = require('./convert'), + func = convert('forOwn', require('../forOwn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/forOwnRight.js b/tools/eslint/node_modules/lodash/fp/forOwnRight.js index 11ff1fdaf88a98..c5e826e0d7dc8f 100644 --- a/tools/eslint/node_modules/lodash/fp/forOwnRight.js +++ b/tools/eslint/node_modules/lodash/fp/forOwnRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('forOwnRight', require('../forOwnRight')); +var convert = require('./convert'), + func = convert('forOwnRight', require('../forOwnRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/fromPairs.js b/tools/eslint/node_modules/lodash/fp/fromPairs.js index f5c3cb8d774763..f8cc5968cd2cff 100644 --- a/tools/eslint/node_modules/lodash/fp/fromPairs.js +++ b/tools/eslint/node_modules/lodash/fp/fromPairs.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('fromPairs', require('../fromPairs')); +var convert = require('./convert'), + func = convert('fromPairs', require('../fromPairs')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/functions.js b/tools/eslint/node_modules/lodash/fp/functions.js index bb1cb93b2c0ad0..09d1bb1baaebfe 100644 --- a/tools/eslint/node_modules/lodash/fp/functions.js +++ b/tools/eslint/node_modules/lodash/fp/functions.js @@ -1 +1,5 @@ -module.exports = require('../functions'); +var convert = require('./convert'), + func = convert('functions', require('../functions'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/functionsIn.js b/tools/eslint/node_modules/lodash/fp/functionsIn.js index d375213c4f683f..2cfeb83ebbc8e2 100644 --- a/tools/eslint/node_modules/lodash/fp/functionsIn.js +++ b/tools/eslint/node_modules/lodash/fp/functionsIn.js @@ -1 +1,5 @@ -module.exports = require('../functionsIn'); +var convert = require('./convert'), + func = convert('functionsIn', require('../functionsIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/get.js b/tools/eslint/node_modules/lodash/fp/get.js index a054c9d22cc74c..6d3a32863e72b5 100644 --- a/tools/eslint/node_modules/lodash/fp/get.js +++ b/tools/eslint/node_modules/lodash/fp/get.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('get', require('../get')); +var convert = require('./convert'), + func = convert('get', require('../get')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/getOr.js b/tools/eslint/node_modules/lodash/fp/getOr.js index c46f2e9e05791a..7dbf771f0c6b09 100644 --- a/tools/eslint/node_modules/lodash/fp/getOr.js +++ b/tools/eslint/node_modules/lodash/fp/getOr.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('getOr', require('../get')); +var convert = require('./convert'), + func = convert('getOr', require('../get')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/groupBy.js b/tools/eslint/node_modules/lodash/fp/groupBy.js index 6588856a9c9cb8..fc0bc78a57b930 100644 --- a/tools/eslint/node_modules/lodash/fp/groupBy.js +++ b/tools/eslint/node_modules/lodash/fp/groupBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('groupBy', require('../groupBy')); +var convert = require('./convert'), + func = convert('groupBy', require('../groupBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/gt.js b/tools/eslint/node_modules/lodash/fp/gt.js index 5b92de949d777a..9e57c8085a05e4 100644 --- a/tools/eslint/node_modules/lodash/fp/gt.js +++ b/tools/eslint/node_modules/lodash/fp/gt.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('gt', require('../gt')); +var convert = require('./convert'), + func = convert('gt', require('../gt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/gte.js b/tools/eslint/node_modules/lodash/fp/gte.js index 3a4025067b6725..45847863894a29 100644 --- a/tools/eslint/node_modules/lodash/fp/gte.js +++ b/tools/eslint/node_modules/lodash/fp/gte.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('gte', require('../gte')); +var convert = require('./convert'), + func = convert('gte', require('../gte')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/has.js b/tools/eslint/node_modules/lodash/fp/has.js index e37db9ab5e3630..b901298398e4f7 100644 --- a/tools/eslint/node_modules/lodash/fp/has.js +++ b/tools/eslint/node_modules/lodash/fp/has.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('has', require('../has')); +var convert = require('./convert'), + func = convert('has', require('../has')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/hasIn.js b/tools/eslint/node_modules/lodash/fp/hasIn.js index 84d7815648228a..b3c3d1a3f3b375 100644 --- a/tools/eslint/node_modules/lodash/fp/hasIn.js +++ b/tools/eslint/node_modules/lodash/fp/hasIn.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('hasIn', require('../hasIn')); +var convert = require('./convert'), + func = convert('hasIn', require('../hasIn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/head.js b/tools/eslint/node_modules/lodash/fp/head.js index bd97a7b2cc5050..2694f0a21d681e 100644 --- a/tools/eslint/node_modules/lodash/fp/head.js +++ b/tools/eslint/node_modules/lodash/fp/head.js @@ -1 +1,5 @@ -module.exports = require('../head'); +var convert = require('./convert'), + func = convert('head', require('../head'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/identical.js b/tools/eslint/node_modules/lodash/fp/identical.js new file mode 100644 index 00000000000000..85563f4a469964 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/identical.js @@ -0,0 +1 @@ +module.exports = require('./eq'); diff --git a/tools/eslint/node_modules/lodash/fp/identity.js b/tools/eslint/node_modules/lodash/fp/identity.js index 6d007dc10ebd66..096415a5dec4a6 100644 --- a/tools/eslint/node_modules/lodash/fp/identity.js +++ b/tools/eslint/node_modules/lodash/fp/identity.js @@ -1 +1,5 @@ -module.exports = require('../identity'); +var convert = require('./convert'), + func = convert('identity', require('../identity'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/inRange.js b/tools/eslint/node_modules/lodash/fp/inRange.js index fc55e1c1ffcde6..202d940bae8d83 100644 --- a/tools/eslint/node_modules/lodash/fp/inRange.js +++ b/tools/eslint/node_modules/lodash/fp/inRange.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('inRange', require('../inRange')); +var convert = require('./convert'), + func = convert('inRange', require('../inRange')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/includes.js b/tools/eslint/node_modules/lodash/fp/includes.js index 91f1eec4d95491..11467805ce1e72 100644 --- a/tools/eslint/node_modules/lodash/fp/includes.js +++ b/tools/eslint/node_modules/lodash/fp/includes.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('includes', require('../includes')); +var convert = require('./convert'), + func = convert('includes', require('../includes')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/indexOf.js b/tools/eslint/node_modules/lodash/fp/indexOf.js index 65345cedc484ce..524658eb95f983 100644 --- a/tools/eslint/node_modules/lodash/fp/indexOf.js +++ b/tools/eslint/node_modules/lodash/fp/indexOf.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('indexOf', require('../indexOf')); +var convert = require('./convert'), + func = convert('indexOf', require('../indexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/initial.js b/tools/eslint/node_modules/lodash/fp/initial.js index 9fc94e060fd4c7..b732ba0bd69f24 100644 --- a/tools/eslint/node_modules/lodash/fp/initial.js +++ b/tools/eslint/node_modules/lodash/fp/initial.js @@ -1 +1,5 @@ -module.exports = require('../initial'); +var convert = require('./convert'), + func = convert('initial', require('../initial'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/intersection.js b/tools/eslint/node_modules/lodash/fp/intersection.js index 784f4d1c3657da..52936d560c7cb6 100644 --- a/tools/eslint/node_modules/lodash/fp/intersection.js +++ b/tools/eslint/node_modules/lodash/fp/intersection.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('intersection', require('../intersection')); +var convert = require('./convert'), + func = convert('intersection', require('../intersection')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/intersectionBy.js b/tools/eslint/node_modules/lodash/fp/intersectionBy.js index 4aa93b6357205e..72629f277d7f82 100644 --- a/tools/eslint/node_modules/lodash/fp/intersectionBy.js +++ b/tools/eslint/node_modules/lodash/fp/intersectionBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('intersectionBy', require('../intersectionBy')); +var convert = require('./convert'), + func = convert('intersectionBy', require('../intersectionBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/intersectionWith.js b/tools/eslint/node_modules/lodash/fp/intersectionWith.js index 879fe9d44be4ff..e064f400f88bcc 100644 --- a/tools/eslint/node_modules/lodash/fp/intersectionWith.js +++ b/tools/eslint/node_modules/lodash/fp/intersectionWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('intersectionWith', require('../intersectionWith')); +var convert = require('./convert'), + func = convert('intersectionWith', require('../intersectionWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/invert.js b/tools/eslint/node_modules/lodash/fp/invert.js index 231d5caf8102a1..2d5d1f0d45ba03 100644 --- a/tools/eslint/node_modules/lodash/fp/invert.js +++ b/tools/eslint/node_modules/lodash/fp/invert.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('invert', require('../invert')); +var convert = require('./convert'), + func = convert('invert', require('../invert')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/invertBy.js b/tools/eslint/node_modules/lodash/fp/invertBy.js index 90820e6c379f96..63ca97ecb28ab7 100644 --- a/tools/eslint/node_modules/lodash/fp/invertBy.js +++ b/tools/eslint/node_modules/lodash/fp/invertBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('invertBy', require('../invertBy')); +var convert = require('./convert'), + func = convert('invertBy', require('../invertBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/invertObj.js b/tools/eslint/node_modules/lodash/fp/invertObj.js new file mode 100644 index 00000000000000..f1d842e49b8eda --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/invertObj.js @@ -0,0 +1 @@ +module.exports = require('./invert'); diff --git a/tools/eslint/node_modules/lodash/fp/invoke.js b/tools/eslint/node_modules/lodash/fp/invoke.js index a8635e8c38a9bf..fcf17f0d5721b8 100644 --- a/tools/eslint/node_modules/lodash/fp/invoke.js +++ b/tools/eslint/node_modules/lodash/fp/invoke.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('invoke', require('../invoke')); +var convert = require('./convert'), + func = convert('invoke', require('../invoke')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/invokeArgs.js b/tools/eslint/node_modules/lodash/fp/invokeArgs.js new file mode 100644 index 00000000000000..d3f2953fa3b921 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/invokeArgs.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invokeArgs', require('../invoke')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/invokeArgsMap.js b/tools/eslint/node_modules/lodash/fp/invokeArgsMap.js new file mode 100644 index 00000000000000..eaa9f84ffbb7f0 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/invokeArgsMap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invokeArgsMap', require('../invokeMap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/invokeMap.js b/tools/eslint/node_modules/lodash/fp/invokeMap.js index 2691ae36ec80ba..6515fd73f16e75 100644 --- a/tools/eslint/node_modules/lodash/fp/invokeMap.js +++ b/tools/eslint/node_modules/lodash/fp/invokeMap.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('invokeMap', require('../invokeMap')); +var convert = require('./convert'), + func = convert('invokeMap', require('../invokeMap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isArguments.js b/tools/eslint/node_modules/lodash/fp/isArguments.js index 093aa354cf0e75..1d93c9e5994c86 100644 --- a/tools/eslint/node_modules/lodash/fp/isArguments.js +++ b/tools/eslint/node_modules/lodash/fp/isArguments.js @@ -1 +1,5 @@ -module.exports = require('../isArguments'); +var convert = require('./convert'), + func = convert('isArguments', require('../isArguments'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isArray.js b/tools/eslint/node_modules/lodash/fp/isArray.js index ec7fad3c36dea5..ba7ade8ddc0a13 100644 --- a/tools/eslint/node_modules/lodash/fp/isArray.js +++ b/tools/eslint/node_modules/lodash/fp/isArray.js @@ -1 +1,5 @@ -module.exports = require('../isArray'); +var convert = require('./convert'), + func = convert('isArray', require('../isArray'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isArrayBuffer.js b/tools/eslint/node_modules/lodash/fp/isArrayBuffer.js index 655e85bac7fc51..5088513faf3e83 100644 --- a/tools/eslint/node_modules/lodash/fp/isArrayBuffer.js +++ b/tools/eslint/node_modules/lodash/fp/isArrayBuffer.js @@ -1 +1,5 @@ -module.exports = require('../isArrayBuffer'); +var convert = require('./convert'), + func = convert('isArrayBuffer', require('../isArrayBuffer'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isArrayLike.js b/tools/eslint/node_modules/lodash/fp/isArrayLike.js index 1595b2f181891b..8f1856bf6f6b38 100644 --- a/tools/eslint/node_modules/lodash/fp/isArrayLike.js +++ b/tools/eslint/node_modules/lodash/fp/isArrayLike.js @@ -1 +1,5 @@ -module.exports = require('../isArrayLike'); +var convert = require('./convert'), + func = convert('isArrayLike', require('../isArrayLike'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isArrayLikeObject.js b/tools/eslint/node_modules/lodash/fp/isArrayLikeObject.js index 4d1d2028933dba..21084984bcecdd 100644 --- a/tools/eslint/node_modules/lodash/fp/isArrayLikeObject.js +++ b/tools/eslint/node_modules/lodash/fp/isArrayLikeObject.js @@ -1 +1,5 @@ -module.exports = require('../isArrayLikeObject'); +var convert = require('./convert'), + func = convert('isArrayLikeObject', require('../isArrayLikeObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isBoolean.js b/tools/eslint/node_modules/lodash/fp/isBoolean.js index 30d4a4aa02fc28..9339f75b1f198a 100644 --- a/tools/eslint/node_modules/lodash/fp/isBoolean.js +++ b/tools/eslint/node_modules/lodash/fp/isBoolean.js @@ -1 +1,5 @@ -module.exports = require('../isBoolean'); +var convert = require('./convert'), + func = convert('isBoolean', require('../isBoolean'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isBuffer.js b/tools/eslint/node_modules/lodash/fp/isBuffer.js index 15af9b634a28e4..e60b123818d12c 100644 --- a/tools/eslint/node_modules/lodash/fp/isBuffer.js +++ b/tools/eslint/node_modules/lodash/fp/isBuffer.js @@ -1 +1,5 @@ -module.exports = require('../isBuffer'); +var convert = require('./convert'), + func = convert('isBuffer', require('../isBuffer'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isDate.js b/tools/eslint/node_modules/lodash/fp/isDate.js index ac002f459060f5..dc41d089ec8b84 100644 --- a/tools/eslint/node_modules/lodash/fp/isDate.js +++ b/tools/eslint/node_modules/lodash/fp/isDate.js @@ -1 +1,5 @@ -module.exports = require('../isDate'); +var convert = require('./convert'), + func = convert('isDate', require('../isDate'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isElement.js b/tools/eslint/node_modules/lodash/fp/isElement.js index 458a3484d34376..18ee039a2da96f 100644 --- a/tools/eslint/node_modules/lodash/fp/isElement.js +++ b/tools/eslint/node_modules/lodash/fp/isElement.js @@ -1 +1,5 @@ -module.exports = require('../isElement'); +var convert = require('./convert'), + func = convert('isElement', require('../isElement'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isEmpty.js b/tools/eslint/node_modules/lodash/fp/isEmpty.js index b1a04cd88324dd..0f4ae841e214f3 100644 --- a/tools/eslint/node_modules/lodash/fp/isEmpty.js +++ b/tools/eslint/node_modules/lodash/fp/isEmpty.js @@ -1 +1,5 @@ -module.exports = require('../isEmpty'); +var convert = require('./convert'), + func = convert('isEmpty', require('../isEmpty'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isEqual.js b/tools/eslint/node_modules/lodash/fp/isEqual.js index 91b7d6654e94a2..41383865f28757 100644 --- a/tools/eslint/node_modules/lodash/fp/isEqual.js +++ b/tools/eslint/node_modules/lodash/fp/isEqual.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('isEqual', require('../isEqual')); +var convert = require('./convert'), + func = convert('isEqual', require('../isEqual')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isEqualWith.js b/tools/eslint/node_modules/lodash/fp/isEqualWith.js index 37a6e3506c0920..029ff5cdaa0f33 100644 --- a/tools/eslint/node_modules/lodash/fp/isEqualWith.js +++ b/tools/eslint/node_modules/lodash/fp/isEqualWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('isEqualWith', require('../isEqualWith')); +var convert = require('./convert'), + func = convert('isEqualWith', require('../isEqualWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isError.js b/tools/eslint/node_modules/lodash/fp/isError.js index da2710c26199de..3dfd81ccc211cb 100644 --- a/tools/eslint/node_modules/lodash/fp/isError.js +++ b/tools/eslint/node_modules/lodash/fp/isError.js @@ -1 +1,5 @@ -module.exports = require('../isError'); +var convert = require('./convert'), + func = convert('isError', require('../isError'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isFinite.js b/tools/eslint/node_modules/lodash/fp/isFinite.js index a71e53de45b2e0..0b647b841ecc17 100644 --- a/tools/eslint/node_modules/lodash/fp/isFinite.js +++ b/tools/eslint/node_modules/lodash/fp/isFinite.js @@ -1 +1,5 @@ -module.exports = require('../isFinite'); +var convert = require('./convert'), + func = convert('isFinite', require('../isFinite'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isFunction.js b/tools/eslint/node_modules/lodash/fp/isFunction.js index 1fc73f62f00fe9..ff8e5c45853aba 100644 --- a/tools/eslint/node_modules/lodash/fp/isFunction.js +++ b/tools/eslint/node_modules/lodash/fp/isFunction.js @@ -1 +1,5 @@ -module.exports = require('../isFunction'); +var convert = require('./convert'), + func = convert('isFunction', require('../isFunction'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isInteger.js b/tools/eslint/node_modules/lodash/fp/isInteger.js index f990b011c53a1c..67af4ff6dbb05e 100644 --- a/tools/eslint/node_modules/lodash/fp/isInteger.js +++ b/tools/eslint/node_modules/lodash/fp/isInteger.js @@ -1 +1,5 @@ -module.exports = require('../isInteger'); +var convert = require('./convert'), + func = convert('isInteger', require('../isInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isLength.js b/tools/eslint/node_modules/lodash/fp/isLength.js index f40c36235331d5..fc101c5a64b4e8 100644 --- a/tools/eslint/node_modules/lodash/fp/isLength.js +++ b/tools/eslint/node_modules/lodash/fp/isLength.js @@ -1 +1,5 @@ -module.exports = require('../isLength'); +var convert = require('./convert'), + func = convert('isLength', require('../isLength'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isMap.js b/tools/eslint/node_modules/lodash/fp/isMap.js index 51fb7e2e9a1df2..a209aa66fcbae5 100644 --- a/tools/eslint/node_modules/lodash/fp/isMap.js +++ b/tools/eslint/node_modules/lodash/fp/isMap.js @@ -1 +1,5 @@ -module.exports = require('../isMap'); +var convert = require('./convert'), + func = convert('isMap', require('../isMap'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isMatch.js b/tools/eslint/node_modules/lodash/fp/isMatch.js index 749c9033197b33..6264ca17fac37a 100644 --- a/tools/eslint/node_modules/lodash/fp/isMatch.js +++ b/tools/eslint/node_modules/lodash/fp/isMatch.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('isMatch', require('../isMatch')); +var convert = require('./convert'), + func = convert('isMatch', require('../isMatch')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isMatchWith.js b/tools/eslint/node_modules/lodash/fp/isMatchWith.js index b1311fcf329c61..d95f319353fb80 100644 --- a/tools/eslint/node_modules/lodash/fp/isMatchWith.js +++ b/tools/eslint/node_modules/lodash/fp/isMatchWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('isMatchWith', require('../isMatchWith')); +var convert = require('./convert'), + func = convert('isMatchWith', require('../isMatchWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isNaN.js b/tools/eslint/node_modules/lodash/fp/isNaN.js index 74daf0a08c2564..66a978f11194fc 100644 --- a/tools/eslint/node_modules/lodash/fp/isNaN.js +++ b/tools/eslint/node_modules/lodash/fp/isNaN.js @@ -1 +1,5 @@ -module.exports = require('../isNaN'); +var convert = require('./convert'), + func = convert('isNaN', require('../isNaN'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isNative.js b/tools/eslint/node_modules/lodash/fp/isNative.js index 9eeded4a886a20..3d775ba953152e 100644 --- a/tools/eslint/node_modules/lodash/fp/isNative.js +++ b/tools/eslint/node_modules/lodash/fp/isNative.js @@ -1 +1,5 @@ -module.exports = require('../isNative'); +var convert = require('./convert'), + func = convert('isNative', require('../isNative'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isNil.js b/tools/eslint/node_modules/lodash/fp/isNil.js index beace9db042520..5952c028a9bcdd 100644 --- a/tools/eslint/node_modules/lodash/fp/isNil.js +++ b/tools/eslint/node_modules/lodash/fp/isNil.js @@ -1 +1,5 @@ -module.exports = require('../isNil'); +var convert = require('./convert'), + func = convert('isNil', require('../isNil'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isNull.js b/tools/eslint/node_modules/lodash/fp/isNull.js index 44689a783ce419..f201a354b43789 100644 --- a/tools/eslint/node_modules/lodash/fp/isNull.js +++ b/tools/eslint/node_modules/lodash/fp/isNull.js @@ -1 +1,5 @@ -module.exports = require('../isNull'); +var convert = require('./convert'), + func = convert('isNull', require('../isNull'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isNumber.js b/tools/eslint/node_modules/lodash/fp/isNumber.js index d7e86155de17de..a2b5fa049fe9f7 100644 --- a/tools/eslint/node_modules/lodash/fp/isNumber.js +++ b/tools/eslint/node_modules/lodash/fp/isNumber.js @@ -1 +1,5 @@ -module.exports = require('../isNumber'); +var convert = require('./convert'), + func = convert('isNumber', require('../isNumber'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isObject.js b/tools/eslint/node_modules/lodash/fp/isObject.js index bb486300255110..231ace03bc50ed 100644 --- a/tools/eslint/node_modules/lodash/fp/isObject.js +++ b/tools/eslint/node_modules/lodash/fp/isObject.js @@ -1 +1,5 @@ -module.exports = require('../isObject'); +var convert = require('./convert'), + func = convert('isObject', require('../isObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isObjectLike.js b/tools/eslint/node_modules/lodash/fp/isObjectLike.js index 5ef6f62b1f5b7e..f16082e6fee9ee 100644 --- a/tools/eslint/node_modules/lodash/fp/isObjectLike.js +++ b/tools/eslint/node_modules/lodash/fp/isObjectLike.js @@ -1 +1,5 @@ -module.exports = require('../isObjectLike'); +var convert = require('./convert'), + func = convert('isObjectLike', require('../isObjectLike'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isPlainObject.js b/tools/eslint/node_modules/lodash/fp/isPlainObject.js index 2d34d86a4e3823..b5bea90d3a7f26 100644 --- a/tools/eslint/node_modules/lodash/fp/isPlainObject.js +++ b/tools/eslint/node_modules/lodash/fp/isPlainObject.js @@ -1 +1,5 @@ -module.exports = require('../isPlainObject'); +var convert = require('./convert'), + func = convert('isPlainObject', require('../isPlainObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isRegExp.js b/tools/eslint/node_modules/lodash/fp/isRegExp.js index 4d0727becd2c4b..12a1a3d71852e9 100644 --- a/tools/eslint/node_modules/lodash/fp/isRegExp.js +++ b/tools/eslint/node_modules/lodash/fp/isRegExp.js @@ -1 +1,5 @@ -module.exports = require('../isRegExp'); +var convert = require('./convert'), + func = convert('isRegExp', require('../isRegExp'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isSafeInteger.js b/tools/eslint/node_modules/lodash/fp/isSafeInteger.js index ed08cab6645942..7230f5520aa776 100644 --- a/tools/eslint/node_modules/lodash/fp/isSafeInteger.js +++ b/tools/eslint/node_modules/lodash/fp/isSafeInteger.js @@ -1 +1,5 @@ -module.exports = require('../isSafeInteger'); +var convert = require('./convert'), + func = convert('isSafeInteger', require('../isSafeInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isSet.js b/tools/eslint/node_modules/lodash/fp/isSet.js index f8a0a498c23b50..35c01f6fa19338 100644 --- a/tools/eslint/node_modules/lodash/fp/isSet.js +++ b/tools/eslint/node_modules/lodash/fp/isSet.js @@ -1 +1,5 @@ -module.exports = require('../isSet'); +var convert = require('./convert'), + func = convert('isSet', require('../isSet'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isString.js b/tools/eslint/node_modules/lodash/fp/isString.js index 2f22d0e44baf98..1fd0679ef865e9 100644 --- a/tools/eslint/node_modules/lodash/fp/isString.js +++ b/tools/eslint/node_modules/lodash/fp/isString.js @@ -1 +1,5 @@ -module.exports = require('../isString'); +var convert = require('./convert'), + func = convert('isString', require('../isString'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isSymbol.js b/tools/eslint/node_modules/lodash/fp/isSymbol.js index 9ce6731ec57e7a..38676956dac9dd 100644 --- a/tools/eslint/node_modules/lodash/fp/isSymbol.js +++ b/tools/eslint/node_modules/lodash/fp/isSymbol.js @@ -1 +1,5 @@ -module.exports = require('../isSymbol'); +var convert = require('./convert'), + func = convert('isSymbol', require('../isSymbol'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isTypedArray.js b/tools/eslint/node_modules/lodash/fp/isTypedArray.js index 72349c5f08dfbf..8567953875ffc4 100644 --- a/tools/eslint/node_modules/lodash/fp/isTypedArray.js +++ b/tools/eslint/node_modules/lodash/fp/isTypedArray.js @@ -1 +1,5 @@ -module.exports = require('../isTypedArray'); +var convert = require('./convert'), + func = convert('isTypedArray', require('../isTypedArray'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isUndefined.js b/tools/eslint/node_modules/lodash/fp/isUndefined.js index a65c5bec9c73fc..ddbca31ca70f09 100644 --- a/tools/eslint/node_modules/lodash/fp/isUndefined.js +++ b/tools/eslint/node_modules/lodash/fp/isUndefined.js @@ -1 +1,5 @@ -module.exports = require('../isUndefined'); +var convert = require('./convert'), + func = convert('isUndefined', require('../isUndefined'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isWeakMap.js b/tools/eslint/node_modules/lodash/fp/isWeakMap.js index dc622014ed6037..ef60c613c4bdc9 100644 --- a/tools/eslint/node_modules/lodash/fp/isWeakMap.js +++ b/tools/eslint/node_modules/lodash/fp/isWeakMap.js @@ -1 +1,5 @@ -module.exports = require('../isWeakMap'); +var convert = require('./convert'), + func = convert('isWeakMap', require('../isWeakMap'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/isWeakSet.js b/tools/eslint/node_modules/lodash/fp/isWeakSet.js index 7646ca884187b1..c99bfaa6d9d288 100644 --- a/tools/eslint/node_modules/lodash/fp/isWeakSet.js +++ b/tools/eslint/node_modules/lodash/fp/isWeakSet.js @@ -1 +1,5 @@ -module.exports = require('../isWeakSet'); +var convert = require('./convert'), + func = convert('isWeakSet', require('../isWeakSet'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/iteratee.js b/tools/eslint/node_modules/lodash/fp/iteratee.js index 2884465d5ac17f..9f0f71738a01ba 100644 --- a/tools/eslint/node_modules/lodash/fp/iteratee.js +++ b/tools/eslint/node_modules/lodash/fp/iteratee.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('iteratee', require('../iteratee')); +var convert = require('./convert'), + func = convert('iteratee', require('../iteratee')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/join.js b/tools/eslint/node_modules/lodash/fp/join.js index fdaa488e39268c..a220e003c4009f 100644 --- a/tools/eslint/node_modules/lodash/fp/join.js +++ b/tools/eslint/node_modules/lodash/fp/join.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('join', require('../join')); +var convert = require('./convert'), + func = convert('join', require('../join')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/juxt.js b/tools/eslint/node_modules/lodash/fp/juxt.js new file mode 100644 index 00000000000000..f71e04e00028f5 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/juxt.js @@ -0,0 +1 @@ +module.exports = require('./over'); diff --git a/tools/eslint/node_modules/lodash/fp/kebabCase.js b/tools/eslint/node_modules/lodash/fp/kebabCase.js index f251a4d4813f35..60737f17cdbc85 100644 --- a/tools/eslint/node_modules/lodash/fp/kebabCase.js +++ b/tools/eslint/node_modules/lodash/fp/kebabCase.js @@ -1 +1,5 @@ -module.exports = require('../kebabCase'); +var convert = require('./convert'), + func = convert('kebabCase', require('../kebabCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/keyBy.js b/tools/eslint/node_modules/lodash/fp/keyBy.js index ad9abacb1b051b..9a6a85d4226045 100644 --- a/tools/eslint/node_modules/lodash/fp/keyBy.js +++ b/tools/eslint/node_modules/lodash/fp/keyBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('keyBy', require('../keyBy')); +var convert = require('./convert'), + func = convert('keyBy', require('../keyBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/keys.js b/tools/eslint/node_modules/lodash/fp/keys.js index 23dc6b7d96c5dd..e12bb07f13022e 100644 --- a/tools/eslint/node_modules/lodash/fp/keys.js +++ b/tools/eslint/node_modules/lodash/fp/keys.js @@ -1 +1,5 @@ -module.exports = require('../keys'); +var convert = require('./convert'), + func = convert('keys', require('../keys'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/keysIn.js b/tools/eslint/node_modules/lodash/fp/keysIn.js index 2b738b99f099c0..f3eb36a8d20d6c 100644 --- a/tools/eslint/node_modules/lodash/fp/keysIn.js +++ b/tools/eslint/node_modules/lodash/fp/keysIn.js @@ -1 +1,5 @@ -module.exports = require('../keysIn'); +var convert = require('./convert'), + func = convert('keysIn', require('../keysIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/last.js b/tools/eslint/node_modules/lodash/fp/last.js index 222be23aaee39d..0f716993fc80d9 100644 --- a/tools/eslint/node_modules/lodash/fp/last.js +++ b/tools/eslint/node_modules/lodash/fp/last.js @@ -1 +1,5 @@ -module.exports = require('../last'); +var convert = require('./convert'), + func = convert('last', require('../last'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/lastIndexOf.js b/tools/eslint/node_modules/lodash/fp/lastIndexOf.js index e27480e3739852..ddf39c30135edd 100644 --- a/tools/eslint/node_modules/lodash/fp/lastIndexOf.js +++ b/tools/eslint/node_modules/lodash/fp/lastIndexOf.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('lastIndexOf', require('../lastIndexOf')); +var convert = require('./convert'), + func = convert('lastIndexOf', require('../lastIndexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/lowerCase.js b/tools/eslint/node_modules/lodash/fp/lowerCase.js index 4da15cea6f656a..ea64bc15d6f337 100644 --- a/tools/eslint/node_modules/lodash/fp/lowerCase.js +++ b/tools/eslint/node_modules/lodash/fp/lowerCase.js @@ -1 +1,5 @@ -module.exports = require('../lowerCase'); +var convert = require('./convert'), + func = convert('lowerCase', require('../lowerCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/lowerFirst.js b/tools/eslint/node_modules/lodash/fp/lowerFirst.js index afd1ba5472c80b..539720a3da3e0e 100644 --- a/tools/eslint/node_modules/lodash/fp/lowerFirst.js +++ b/tools/eslint/node_modules/lodash/fp/lowerFirst.js @@ -1 +1,5 @@ -module.exports = require('../lowerFirst'); +var convert = require('./convert'), + func = convert('lowerFirst', require('../lowerFirst'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/lt.js b/tools/eslint/node_modules/lodash/fp/lt.js index dd4cba04f6fe11..a31d21ecc660da 100644 --- a/tools/eslint/node_modules/lodash/fp/lt.js +++ b/tools/eslint/node_modules/lodash/fp/lt.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('lt', require('../lt')); +var convert = require('./convert'), + func = convert('lt', require('../lt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/lte.js b/tools/eslint/node_modules/lodash/fp/lte.js index f9bf7254ffd24e..d795d10ee7c78f 100644 --- a/tools/eslint/node_modules/lodash/fp/lte.js +++ b/tools/eslint/node_modules/lodash/fp/lte.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('lte', require('../lte')); +var convert = require('./convert'), + func = convert('lte', require('../lte')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/map.js b/tools/eslint/node_modules/lodash/fp/map.js index b74c1a1cea15ba..cf98794362808b 100644 --- a/tools/eslint/node_modules/lodash/fp/map.js +++ b/tools/eslint/node_modules/lodash/fp/map.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('map', require('../map')); +var convert = require('./convert'), + func = convert('map', require('../map')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/mapKeys.js b/tools/eslint/node_modules/lodash/fp/mapKeys.js index a8156c104dbd62..1684587099e281 100644 --- a/tools/eslint/node_modules/lodash/fp/mapKeys.js +++ b/tools/eslint/node_modules/lodash/fp/mapKeys.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('mapKeys', require('../mapKeys')); +var convert = require('./convert'), + func = convert('mapKeys', require('../mapKeys')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/mapValues.js b/tools/eslint/node_modules/lodash/fp/mapValues.js index 9375d73e34ff4b..4004972751db88 100644 --- a/tools/eslint/node_modules/lodash/fp/mapValues.js +++ b/tools/eslint/node_modules/lodash/fp/mapValues.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('mapValues', require('../mapValues')); +var convert = require('./convert'), + func = convert('mapValues', require('../mapValues')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/matches.js b/tools/eslint/node_modules/lodash/fp/matches.js index eea59164369847..629399cb8dc93f 100644 --- a/tools/eslint/node_modules/lodash/fp/matches.js +++ b/tools/eslint/node_modules/lodash/fp/matches.js @@ -1 +1,5 @@ -module.exports = require('../matches'); +var convert = require('./convert'), + func = convert('matches', require('../matches'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/matchesProperty.js b/tools/eslint/node_modules/lodash/fp/matchesProperty.js index c4343a1710ba35..4575bd2431b7e4 100644 --- a/tools/eslint/node_modules/lodash/fp/matchesProperty.js +++ b/tools/eslint/node_modules/lodash/fp/matchesProperty.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('matchesProperty', require('../matchesProperty')); +var convert = require('./convert'), + func = convert('matchesProperty', require('../matchesProperty')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/max.js b/tools/eslint/node_modules/lodash/fp/max.js index f7258c6ec30ac0..a66acac220717a 100644 --- a/tools/eslint/node_modules/lodash/fp/max.js +++ b/tools/eslint/node_modules/lodash/fp/max.js @@ -1 +1,5 @@ -module.exports = require('../max'); +var convert = require('./convert'), + func = convert('max', require('../max'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/maxBy.js b/tools/eslint/node_modules/lodash/fp/maxBy.js index b81243fabcb67c..d083fd64fd2d59 100644 --- a/tools/eslint/node_modules/lodash/fp/maxBy.js +++ b/tools/eslint/node_modules/lodash/fp/maxBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('maxBy', require('../maxBy')); +var convert = require('./convert'), + func = convert('maxBy', require('../maxBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/mean.js b/tools/eslint/node_modules/lodash/fp/mean.js index b78e427a9e4217..31172460c3b44a 100644 --- a/tools/eslint/node_modules/lodash/fp/mean.js +++ b/tools/eslint/node_modules/lodash/fp/mean.js @@ -1 +1,5 @@ -module.exports = require('../mean'); +var convert = require('./convert'), + func = convert('mean', require('../mean'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/meanBy.js b/tools/eslint/node_modules/lodash/fp/meanBy.js new file mode 100644 index 00000000000000..556f25edfe912f --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/meanBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('meanBy', require('../meanBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/memoize.js b/tools/eslint/node_modules/lodash/fp/memoize.js index 1a45e09eb8ac29..638eec63bad1bb 100644 --- a/tools/eslint/node_modules/lodash/fp/memoize.js +++ b/tools/eslint/node_modules/lodash/fp/memoize.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('memoize', require('../memoize')); +var convert = require('./convert'), + func = convert('memoize', require('../memoize')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/merge.js b/tools/eslint/node_modules/lodash/fp/merge.js index 3dca64191add42..ac66adde1221e6 100644 --- a/tools/eslint/node_modules/lodash/fp/merge.js +++ b/tools/eslint/node_modules/lodash/fp/merge.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('merge', require('../merge')); +var convert = require('./convert'), + func = convert('merge', require('../merge')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/mergeWith.js b/tools/eslint/node_modules/lodash/fp/mergeWith.js index ba456444d86868..00d44d5e1a2711 100644 --- a/tools/eslint/node_modules/lodash/fp/mergeWith.js +++ b/tools/eslint/node_modules/lodash/fp/mergeWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('mergeWith', require('../mergeWith')); +var convert = require('./convert'), + func = convert('mergeWith', require('../mergeWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/method.js b/tools/eslint/node_modules/lodash/fp/method.js index c2f95c3f17281e..f4060c6878e9be 100644 --- a/tools/eslint/node_modules/lodash/fp/method.js +++ b/tools/eslint/node_modules/lodash/fp/method.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('method', require('../method')); +var convert = require('./convert'), + func = convert('method', require('../method')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/methodOf.js b/tools/eslint/node_modules/lodash/fp/methodOf.js index 223f6516e266d9..61399056f36858 100644 --- a/tools/eslint/node_modules/lodash/fp/methodOf.js +++ b/tools/eslint/node_modules/lodash/fp/methodOf.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('methodOf', require('../methodOf')); +var convert = require('./convert'), + func = convert('methodOf', require('../methodOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/min.js b/tools/eslint/node_modules/lodash/fp/min.js index 10db02c0e9665f..d12c6b40d38285 100644 --- a/tools/eslint/node_modules/lodash/fp/min.js +++ b/tools/eslint/node_modules/lodash/fp/min.js @@ -1 +1,5 @@ -module.exports = require('../min'); +var convert = require('./convert'), + func = convert('min', require('../min'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/minBy.js b/tools/eslint/node_modules/lodash/fp/minBy.js index 10edfd40d9e715..fdb9e24d8adcf1 100644 --- a/tools/eslint/node_modules/lodash/fp/minBy.js +++ b/tools/eslint/node_modules/lodash/fp/minBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('minBy', require('../minBy')); +var convert = require('./convert'), + func = convert('minBy', require('../minBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/mixin.js b/tools/eslint/node_modules/lodash/fp/mixin.js index 965f1808c90111..332e6fbfddadf1 100644 --- a/tools/eslint/node_modules/lodash/fp/mixin.js +++ b/tools/eslint/node_modules/lodash/fp/mixin.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('mixin', require('../mixin')); +var convert = require('./convert'), + func = convert('mixin', require('../mixin')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/multiply.js b/tools/eslint/node_modules/lodash/fp/multiply.js new file mode 100644 index 00000000000000..4dcf0b0d4afb64 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/multiply.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('multiply', require('../multiply')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/negate.js b/tools/eslint/node_modules/lodash/fp/negate.js index 345b4250e6f7a4..8b6dc7c5b882c3 100644 --- a/tools/eslint/node_modules/lodash/fp/negate.js +++ b/tools/eslint/node_modules/lodash/fp/negate.js @@ -1 +1,5 @@ -module.exports = require('../negate'); +var convert = require('./convert'), + func = convert('negate', require('../negate'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/next.js b/tools/eslint/node_modules/lodash/fp/next.js index 5cad70e44bd312..140155e2321f8b 100644 --- a/tools/eslint/node_modules/lodash/fp/next.js +++ b/tools/eslint/node_modules/lodash/fp/next.js @@ -1 +1,5 @@ -module.exports = require('../next'); +var convert = require('./convert'), + func = convert('next', require('../next'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/noop.js b/tools/eslint/node_modules/lodash/fp/noop.js index ca1005047a3af6..b9e32cc8cd8729 100644 --- a/tools/eslint/node_modules/lodash/fp/noop.js +++ b/tools/eslint/node_modules/lodash/fp/noop.js @@ -1 +1,5 @@ -module.exports = require('../noop'); +var convert = require('./convert'), + func = convert('noop', require('../noop'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/now.js b/tools/eslint/node_modules/lodash/fp/now.js index aa5ed67a7bf33d..6de2068aacc53b 100644 --- a/tools/eslint/node_modules/lodash/fp/now.js +++ b/tools/eslint/node_modules/lodash/fp/now.js @@ -1 +1,5 @@ -module.exports = require('../now'); +var convert = require('./convert'), + func = convert('now', require('../now'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/nthArg.js b/tools/eslint/node_modules/lodash/fp/nthArg.js index dd47ac66672f60..8ccd8e60b1a812 100644 --- a/tools/eslint/node_modules/lodash/fp/nthArg.js +++ b/tools/eslint/node_modules/lodash/fp/nthArg.js @@ -1 +1,5 @@ -module.exports = require('../nthArg'); +var convert = require('./convert'), + func = convert('nthArg', require('../nthArg'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/omit.js b/tools/eslint/node_modules/lodash/fp/omit.js index 404b5516075e56..fd685291e64e29 100644 --- a/tools/eslint/node_modules/lodash/fp/omit.js +++ b/tools/eslint/node_modules/lodash/fp/omit.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('omit', require('../omit')); +var convert = require('./convert'), + func = convert('omit', require('../omit')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/omitBy.js b/tools/eslint/node_modules/lodash/fp/omitBy.js index 745efa54f03071..90df7380269d9b 100644 --- a/tools/eslint/node_modules/lodash/fp/omitBy.js +++ b/tools/eslint/node_modules/lodash/fp/omitBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('omitBy', require('../omitBy')); +var convert = require('./convert'), + func = convert('omitBy', require('../omitBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/once.js b/tools/eslint/node_modules/lodash/fp/once.js index 6bd0beb20f93ac..f8f0a5c73ecf0c 100644 --- a/tools/eslint/node_modules/lodash/fp/once.js +++ b/tools/eslint/node_modules/lodash/fp/once.js @@ -1 +1,5 @@ -module.exports = require('../once'); +var convert = require('./convert'), + func = convert('once', require('../once'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/orderBy.js b/tools/eslint/node_modules/lodash/fp/orderBy.js index b32244f18150ec..848e210754641a 100644 --- a/tools/eslint/node_modules/lodash/fp/orderBy.js +++ b/tools/eslint/node_modules/lodash/fp/orderBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('orderBy', require('../orderBy')); +var convert = require('./convert'), + func = convert('orderBy', require('../orderBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/over.js b/tools/eslint/node_modules/lodash/fp/over.js index 0a5a797a74dec0..01eba7b9847805 100644 --- a/tools/eslint/node_modules/lodash/fp/over.js +++ b/tools/eslint/node_modules/lodash/fp/over.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('over', require('../over')); +var convert = require('./convert'), + func = convert('over', require('../over')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/overArgs.js b/tools/eslint/node_modules/lodash/fp/overArgs.js index 818838745d21a9..738556f0c0da92 100644 --- a/tools/eslint/node_modules/lodash/fp/overArgs.js +++ b/tools/eslint/node_modules/lodash/fp/overArgs.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('overArgs', require('../overArgs')); +var convert = require('./convert'), + func = convert('overArgs', require('../overArgs')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/overEvery.js b/tools/eslint/node_modules/lodash/fp/overEvery.js index 36dc552b370b21..9f5a032dc7782c 100644 --- a/tools/eslint/node_modules/lodash/fp/overEvery.js +++ b/tools/eslint/node_modules/lodash/fp/overEvery.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('overEvery', require('../overEvery')); +var convert = require('./convert'), + func = convert('overEvery', require('../overEvery')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/overSome.js b/tools/eslint/node_modules/lodash/fp/overSome.js index b02d464ac5f79d..15939d5865a2b4 100644 --- a/tools/eslint/node_modules/lodash/fp/overSome.js +++ b/tools/eslint/node_modules/lodash/fp/overSome.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('overSome', require('../overSome')); +var convert = require('./convert'), + func = convert('overSome', require('../overSome')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pad.js b/tools/eslint/node_modules/lodash/fp/pad.js index e59cfc93577099..f1dea4a98f6447 100644 --- a/tools/eslint/node_modules/lodash/fp/pad.js +++ b/tools/eslint/node_modules/lodash/fp/pad.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('pad', require('../pad')); +var convert = require('./convert'), + func = convert('pad', require('../pad')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/padChars.js b/tools/eslint/node_modules/lodash/fp/padChars.js new file mode 100644 index 00000000000000..d6e0804cd6ca96 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/padChars.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padChars', require('../pad')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/padCharsEnd.js b/tools/eslint/node_modules/lodash/fp/padCharsEnd.js new file mode 100644 index 00000000000000..d4ab79ad305f58 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/padCharsEnd.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padCharsEnd', require('../padEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/padCharsStart.js b/tools/eslint/node_modules/lodash/fp/padCharsStart.js new file mode 100644 index 00000000000000..a08a30000a6617 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/padCharsStart.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padCharsStart', require('../padStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/padEnd.js b/tools/eslint/node_modules/lodash/fp/padEnd.js index 0b6dbb786f80b7..a8522ec36a5fb6 100644 --- a/tools/eslint/node_modules/lodash/fp/padEnd.js +++ b/tools/eslint/node_modules/lodash/fp/padEnd.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('padEnd', require('../padEnd')); +var convert = require('./convert'), + func = convert('padEnd', require('../padEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/padStart.js b/tools/eslint/node_modules/lodash/fp/padStart.js index c97f098976d7d9..f4ca79d4af8ebd 100644 --- a/tools/eslint/node_modules/lodash/fp/padStart.js +++ b/tools/eslint/node_modules/lodash/fp/padStart.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('padStart', require('../padStart')); +var convert = require('./convert'), + func = convert('padStart', require('../padStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/parseInt.js b/tools/eslint/node_modules/lodash/fp/parseInt.js index 35be7137ea2457..27314ccbca67b4 100644 --- a/tools/eslint/node_modules/lodash/fp/parseInt.js +++ b/tools/eslint/node_modules/lodash/fp/parseInt.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('parseInt', require('../parseInt')); +var convert = require('./convert'), + func = convert('parseInt', require('../parseInt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/partial.js b/tools/eslint/node_modules/lodash/fp/partial.js index a687d0c8c39610..5d4601598bf83c 100644 --- a/tools/eslint/node_modules/lodash/fp/partial.js +++ b/tools/eslint/node_modules/lodash/fp/partial.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('partial', require('../partial')); +var convert = require('./convert'), + func = convert('partial', require('../partial')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/partialRight.js b/tools/eslint/node_modules/lodash/fp/partialRight.js index 28428c0339cbc0..7f05fed0ab3bb8 100644 --- a/tools/eslint/node_modules/lodash/fp/partialRight.js +++ b/tools/eslint/node_modules/lodash/fp/partialRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('partialRight', require('../partialRight')); +var convert = require('./convert'), + func = convert('partialRight', require('../partialRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/partition.js b/tools/eslint/node_modules/lodash/fp/partition.js index b1495e6760b817..2ebcacc1f4d5f3 100644 --- a/tools/eslint/node_modules/lodash/fp/partition.js +++ b/tools/eslint/node_modules/lodash/fp/partition.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('partition', require('../partition')); +var convert = require('./convert'), + func = convert('partition', require('../partition')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pick.js b/tools/eslint/node_modules/lodash/fp/pick.js index e84b366d765ca5..197393de1d2241 100644 --- a/tools/eslint/node_modules/lodash/fp/pick.js +++ b/tools/eslint/node_modules/lodash/fp/pick.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('pick', require('../pick')); +var convert = require('./convert'), + func = convert('pick', require('../pick')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pickBy.js b/tools/eslint/node_modules/lodash/fp/pickBy.js index 4d14a0b586c99f..d832d16b6c2b04 100644 --- a/tools/eslint/node_modules/lodash/fp/pickBy.js +++ b/tools/eslint/node_modules/lodash/fp/pickBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('pickBy', require('../pickBy')); +var convert = require('./convert'), + func = convert('pickBy', require('../pickBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/placeholder.js b/tools/eslint/node_modules/lodash/fp/placeholder.js new file mode 100644 index 00000000000000..1ce17393b99c34 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/placeholder.js @@ -0,0 +1,6 @@ +/** + * The default argument placeholder value for methods. + * + * @type {Object} + */ +module.exports = {}; diff --git a/tools/eslint/node_modules/lodash/fp/plant.js b/tools/eslint/node_modules/lodash/fp/plant.js index c85596a0c4618c..eca8f32b4afa9f 100644 --- a/tools/eslint/node_modules/lodash/fp/plant.js +++ b/tools/eslint/node_modules/lodash/fp/plant.js @@ -1 +1,5 @@ -module.exports = require('../plant'); +var convert = require('./convert'), + func = convert('plant', require('../plant'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/property.js b/tools/eslint/node_modules/lodash/fp/property.js index fab6f239f83fb3..d832fbba322ad3 100644 --- a/tools/eslint/node_modules/lodash/fp/property.js +++ b/tools/eslint/node_modules/lodash/fp/property.js @@ -1 +1,5 @@ -module.exports = require('../property'); +var convert = require('./convert'), + func = convert('property', require('../property'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/propertyOf.js b/tools/eslint/node_modules/lodash/fp/propertyOf.js index d941cdbf55fc78..3cfdef790a9e46 100644 --- a/tools/eslint/node_modules/lodash/fp/propertyOf.js +++ b/tools/eslint/node_modules/lodash/fp/propertyOf.js @@ -1 +1,5 @@ -module.exports = require('../propertyOf'); +var convert = require('./convert'), + func = convert('propertyOf', require('../propertyOf'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pull.js b/tools/eslint/node_modules/lodash/fp/pull.js index 47f49aefcd03cd..8d7084f0795aca 100644 --- a/tools/eslint/node_modules/lodash/fp/pull.js +++ b/tools/eslint/node_modules/lodash/fp/pull.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('pull', require('../pull')); +var convert = require('./convert'), + func = convert('pull', require('../pull')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pullAll.js b/tools/eslint/node_modules/lodash/fp/pullAll.js index ffb663bc6db55d..98d5c9a73a9c03 100644 --- a/tools/eslint/node_modules/lodash/fp/pullAll.js +++ b/tools/eslint/node_modules/lodash/fp/pullAll.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('pullAll', require('../pullAll')); +var convert = require('./convert'), + func = convert('pullAll', require('../pullAll')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pullAllBy.js b/tools/eslint/node_modules/lodash/fp/pullAllBy.js index 23b11b7b3e3ed1..876bc3bf1cda84 100644 --- a/tools/eslint/node_modules/lodash/fp/pullAllBy.js +++ b/tools/eslint/node_modules/lodash/fp/pullAllBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('pullAllBy', require('../pullAllBy')); +var convert = require('./convert'), + func = convert('pullAllBy', require('../pullAllBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pullAllWith.js b/tools/eslint/node_modules/lodash/fp/pullAllWith.js new file mode 100644 index 00000000000000..f71ba4d73db312 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/pullAllWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pullAllWith', require('../pullAllWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/pullAt.js b/tools/eslint/node_modules/lodash/fp/pullAt.js index 5836d2ddac431d..e8b3bb6125965d 100644 --- a/tools/eslint/node_modules/lodash/fp/pullAt.js +++ b/tools/eslint/node_modules/lodash/fp/pullAt.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('pullAt', require('../pullAt')); +var convert = require('./convert'), + func = convert('pullAt', require('../pullAt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/random.js b/tools/eslint/node_modules/lodash/fp/random.js index 607d63a194d6af..99d852e4ab2436 100644 --- a/tools/eslint/node_modules/lodash/fp/random.js +++ b/tools/eslint/node_modules/lodash/fp/random.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('random', require('../random')); +var convert = require('./convert'), + func = convert('random', require('../random')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/range.js b/tools/eslint/node_modules/lodash/fp/range.js index 1142304e5f155c..a6bb59118b4490 100644 --- a/tools/eslint/node_modules/lodash/fp/range.js +++ b/tools/eslint/node_modules/lodash/fp/range.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('range', require('../range')); +var convert = require('./convert'), + func = convert('range', require('../range')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/rangeRight.js b/tools/eslint/node_modules/lodash/fp/rangeRight.js index 22482877d0d618..fdb712f94e1e9a 100644 --- a/tools/eslint/node_modules/lodash/fp/rangeRight.js +++ b/tools/eslint/node_modules/lodash/fp/rangeRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('rangeRight', require('../rangeRight')); +var convert = require('./convert'), + func = convert('rangeRight', require('../rangeRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/rearg.js b/tools/eslint/node_modules/lodash/fp/rearg.js index b2753e9e003456..678e02a32a8941 100644 --- a/tools/eslint/node_modules/lodash/fp/rearg.js +++ b/tools/eslint/node_modules/lodash/fp/rearg.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('rearg', require('../rearg')); +var convert = require('./convert'), + func = convert('rearg', require('../rearg')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/reduce.js b/tools/eslint/node_modules/lodash/fp/reduce.js index 2f1b42510217e3..4cef0a0083ca58 100644 --- a/tools/eslint/node_modules/lodash/fp/reduce.js +++ b/tools/eslint/node_modules/lodash/fp/reduce.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('reduce', require('../reduce')); +var convert = require('./convert'), + func = convert('reduce', require('../reduce')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/reduceRight.js b/tools/eslint/node_modules/lodash/fp/reduceRight.js index b110e9e9b96a44..caf5bb5155d9f7 100644 --- a/tools/eslint/node_modules/lodash/fp/reduceRight.js +++ b/tools/eslint/node_modules/lodash/fp/reduceRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('reduceRight', require('../reduceRight')); +var convert = require('./convert'), + func = convert('reduceRight', require('../reduceRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/reject.js b/tools/eslint/node_modules/lodash/fp/reject.js index 30bd3bc7d2c3c7..c1632738619eae 100644 --- a/tools/eslint/node_modules/lodash/fp/reject.js +++ b/tools/eslint/node_modules/lodash/fp/reject.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('reject', require('../reject')); +var convert = require('./convert'), + func = convert('reject', require('../reject')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/remove.js b/tools/eslint/node_modules/lodash/fp/remove.js index 4b67a943159362..e9d13273680413 100644 --- a/tools/eslint/node_modules/lodash/fp/remove.js +++ b/tools/eslint/node_modules/lodash/fp/remove.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('remove', require('../remove')); +var convert = require('./convert'), + func = convert('remove', require('../remove')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/repeat.js b/tools/eslint/node_modules/lodash/fp/repeat.js index bc0704b3ab91b3..08470f247a36a3 100644 --- a/tools/eslint/node_modules/lodash/fp/repeat.js +++ b/tools/eslint/node_modules/lodash/fp/repeat.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('repeat', require('../repeat')); +var convert = require('./convert'), + func = convert('repeat', require('../repeat')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/replace.js b/tools/eslint/node_modules/lodash/fp/replace.js index a4462e7d858a39..2227db62571126 100644 --- a/tools/eslint/node_modules/lodash/fp/replace.js +++ b/tools/eslint/node_modules/lodash/fp/replace.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('replace', require('../replace')); +var convert = require('./convert'), + func = convert('replace', require('../replace')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/rest.js b/tools/eslint/node_modules/lodash/fp/rest.js index 69dfc18a7d5cb5..c1f3d64bdceee0 100644 --- a/tools/eslint/node_modules/lodash/fp/rest.js +++ b/tools/eslint/node_modules/lodash/fp/rest.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('rest', require('../rest')); +var convert = require('./convert'), + func = convert('rest', require('../rest')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/restFrom.js b/tools/eslint/node_modules/lodash/fp/restFrom.js new file mode 100644 index 00000000000000..714e42b5d6632a --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/restFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('restFrom', require('../rest')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/result.js b/tools/eslint/node_modules/lodash/fp/result.js index 1d3fb58ffa0e93..f86ce071264248 100644 --- a/tools/eslint/node_modules/lodash/fp/result.js +++ b/tools/eslint/node_modules/lodash/fp/result.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('result', require('../result')); +var convert = require('./convert'), + func = convert('result', require('../result')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/reverse.js b/tools/eslint/node_modules/lodash/fp/reverse.js index a6d960de0d7dab..07c9f5e4933056 100644 --- a/tools/eslint/node_modules/lodash/fp/reverse.js +++ b/tools/eslint/node_modules/lodash/fp/reverse.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('reverse', require('../reverse')); +var convert = require('./convert'), + func = convert('reverse', require('../reverse')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/round.js b/tools/eslint/node_modules/lodash/fp/round.js index 9eb69b18ed8ef8..4c0e5c829983d1 100644 --- a/tools/eslint/node_modules/lodash/fp/round.js +++ b/tools/eslint/node_modules/lodash/fp/round.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('round', require('../round')); +var convert = require('./convert'), + func = convert('round', require('../round')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sample.js b/tools/eslint/node_modules/lodash/fp/sample.js index 008cb0683151e6..6bea1254de6069 100644 --- a/tools/eslint/node_modules/lodash/fp/sample.js +++ b/tools/eslint/node_modules/lodash/fp/sample.js @@ -1 +1,5 @@ -module.exports = require('../sample'); +var convert = require('./convert'), + func = convert('sample', require('../sample'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sampleSize.js b/tools/eslint/node_modules/lodash/fp/sampleSize.js index 920c075ff999fd..359ed6fcda1501 100644 --- a/tools/eslint/node_modules/lodash/fp/sampleSize.js +++ b/tools/eslint/node_modules/lodash/fp/sampleSize.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sampleSize', require('../sampleSize')); +var convert = require('./convert'), + func = convert('sampleSize', require('../sampleSize')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/set.js b/tools/eslint/node_modules/lodash/fp/set.js index fc2a75b3665aff..0b56a56c8a8d3c 100644 --- a/tools/eslint/node_modules/lodash/fp/set.js +++ b/tools/eslint/node_modules/lodash/fp/set.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('set', require('../set')); +var convert = require('./convert'), + func = convert('set', require('../set')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/setWith.js b/tools/eslint/node_modules/lodash/fp/setWith.js index fd836ea40e7c87..0b584952b6c469 100644 --- a/tools/eslint/node_modules/lodash/fp/setWith.js +++ b/tools/eslint/node_modules/lodash/fp/setWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('setWith', require('../setWith')); +var convert = require('./convert'), + func = convert('setWith', require('../setWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/shuffle.js b/tools/eslint/node_modules/lodash/fp/shuffle.js index 85d569921a35dc..aa3a1ca5be95d8 100644 --- a/tools/eslint/node_modules/lodash/fp/shuffle.js +++ b/tools/eslint/node_modules/lodash/fp/shuffle.js @@ -1 +1,5 @@ -module.exports = require('../shuffle'); +var convert = require('./convert'), + func = convert('shuffle', require('../shuffle'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/size.js b/tools/eslint/node_modules/lodash/fp/size.js index efba2ca65d473b..7490136e1cb4d8 100644 --- a/tools/eslint/node_modules/lodash/fp/size.js +++ b/tools/eslint/node_modules/lodash/fp/size.js @@ -1 +1,5 @@ -module.exports = require('../size'); +var convert = require('./convert'), + func = convert('size', require('../size'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/slice.js b/tools/eslint/node_modules/lodash/fp/slice.js index 6fb1898f94a0f3..15945d321f78d2 100644 --- a/tools/eslint/node_modules/lodash/fp/slice.js +++ b/tools/eslint/node_modules/lodash/fp/slice.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('slice', require('../slice')); +var convert = require('./convert'), + func = convert('slice', require('../slice')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/snakeCase.js b/tools/eslint/node_modules/lodash/fp/snakeCase.js index 2893f7bdaa3c46..a0ff7808eb9223 100644 --- a/tools/eslint/node_modules/lodash/fp/snakeCase.js +++ b/tools/eslint/node_modules/lodash/fp/snakeCase.js @@ -1 +1,5 @@ -module.exports = require('../snakeCase'); +var convert = require('./convert'), + func = convert('snakeCase', require('../snakeCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/some.js b/tools/eslint/node_modules/lodash/fp/some.js index 64727fe3899614..a4fa2d00602861 100644 --- a/tools/eslint/node_modules/lodash/fp/some.js +++ b/tools/eslint/node_modules/lodash/fp/some.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('some', require('../some')); +var convert = require('./convert'), + func = convert('some', require('../some')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortBy.js b/tools/eslint/node_modules/lodash/fp/sortBy.js index 80fe4dd37ca72b..e0790ad5b70ff9 100644 --- a/tools/eslint/node_modules/lodash/fp/sortBy.js +++ b/tools/eslint/node_modules/lodash/fp/sortBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortBy', require('../sortBy')); +var convert = require('./convert'), + func = convert('sortBy', require('../sortBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedIndex.js b/tools/eslint/node_modules/lodash/fp/sortedIndex.js index 509dcb87917208..364a05435e7714 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedIndex.js +++ b/tools/eslint/node_modules/lodash/fp/sortedIndex.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortedIndex', require('../sortedIndex')); +var convert = require('./convert'), + func = convert('sortedIndex', require('../sortedIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedIndexBy.js b/tools/eslint/node_modules/lodash/fp/sortedIndexBy.js index aa2d219695c9c6..9593dbd13d6fd2 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedIndexBy.js +++ b/tools/eslint/node_modules/lodash/fp/sortedIndexBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortedIndexBy', require('../sortedIndexBy')); +var convert = require('./convert'), + func = convert('sortedIndexBy', require('../sortedIndexBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedIndexOf.js b/tools/eslint/node_modules/lodash/fp/sortedIndexOf.js index c1274201097cae..c9084cab6a0319 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedIndexOf.js +++ b/tools/eslint/node_modules/lodash/fp/sortedIndexOf.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortedIndexOf', require('../sortedIndexOf')); +var convert = require('./convert'), + func = convert('sortedIndexOf', require('../sortedIndexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedLastIndex.js b/tools/eslint/node_modules/lodash/fp/sortedLastIndex.js index 7ec9e335940d48..47fe241af7d989 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedLastIndex.js +++ b/tools/eslint/node_modules/lodash/fp/sortedLastIndex.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortedLastIndex', require('../sortedLastIndex')); +var convert = require('./convert'), + func = convert('sortedLastIndex', require('../sortedLastIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedLastIndexBy.js b/tools/eslint/node_modules/lodash/fp/sortedLastIndexBy.js index e03f1853e0da88..0f9a3473267398 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedLastIndexBy.js +++ b/tools/eslint/node_modules/lodash/fp/sortedLastIndexBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortedLastIndexBy', require('../sortedLastIndexBy')); +var convert = require('./convert'), + func = convert('sortedLastIndexBy', require('../sortedLastIndexBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedLastIndexOf.js b/tools/eslint/node_modules/lodash/fp/sortedLastIndexOf.js index 0130801e94b782..0d4d93278f906e 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedLastIndexOf.js +++ b/tools/eslint/node_modules/lodash/fp/sortedLastIndexOf.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortedLastIndexOf', require('../sortedLastIndexOf')); +var convert = require('./convert'), + func = convert('sortedLastIndexOf', require('../sortedLastIndexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedUniq.js b/tools/eslint/node_modules/lodash/fp/sortedUniq.js index c0df750eec6250..882d283702cd2f 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedUniq.js +++ b/tools/eslint/node_modules/lodash/fp/sortedUniq.js @@ -1 +1,5 @@ -module.exports = require('../sortedUniq'); +var convert = require('./convert'), + func = convert('sortedUniq', require('../sortedUniq'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sortedUniqBy.js b/tools/eslint/node_modules/lodash/fp/sortedUniqBy.js index f5c65ad6b086ac..033db91ca9de25 100644 --- a/tools/eslint/node_modules/lodash/fp/sortedUniqBy.js +++ b/tools/eslint/node_modules/lodash/fp/sortedUniqBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sortedUniqBy', require('../sortedUniqBy')); +var convert = require('./convert'), + func = convert('sortedUniqBy', require('../sortedUniqBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/split.js b/tools/eslint/node_modules/lodash/fp/split.js index 79f26939318636..14de1a7efda4ed 100644 --- a/tools/eslint/node_modules/lodash/fp/split.js +++ b/tools/eslint/node_modules/lodash/fp/split.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('split', require('../split')); +var convert = require('./convert'), + func = convert('split', require('../split')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/spread.js b/tools/eslint/node_modules/lodash/fp/spread.js index 0348df25ce7720..2d11b70722dc83 100644 --- a/tools/eslint/node_modules/lodash/fp/spread.js +++ b/tools/eslint/node_modules/lodash/fp/spread.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('spread', require('../spread')); +var convert = require('./convert'), + func = convert('spread', require('../spread')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/spreadFrom.js b/tools/eslint/node_modules/lodash/fp/spreadFrom.js new file mode 100644 index 00000000000000..0b630df1b38bef --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/spreadFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('spreadFrom', require('../spread')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/startCase.js b/tools/eslint/node_modules/lodash/fp/startCase.js index 2a6a66ef15c2ea..ada98c943dee83 100644 --- a/tools/eslint/node_modules/lodash/fp/startCase.js +++ b/tools/eslint/node_modules/lodash/fp/startCase.js @@ -1 +1,5 @@ -module.exports = require('../startCase'); +var convert = require('./convert'), + func = convert('startCase', require('../startCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/startsWith.js b/tools/eslint/node_modules/lodash/fp/startsWith.js index 730a141f6d7faa..985e2f2948ca34 100644 --- a/tools/eslint/node_modules/lodash/fp/startsWith.js +++ b/tools/eslint/node_modules/lodash/fp/startsWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('startsWith', require('../startsWith')); +var convert = require('./convert'), + func = convert('startsWith', require('../startsWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/subtract.js b/tools/eslint/node_modules/lodash/fp/subtract.js index 46b83db36316e1..d32b16d4797310 100644 --- a/tools/eslint/node_modules/lodash/fp/subtract.js +++ b/tools/eslint/node_modules/lodash/fp/subtract.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('subtract', require('../subtract')); +var convert = require('./convert'), + func = convert('subtract', require('../subtract')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sum.js b/tools/eslint/node_modules/lodash/fp/sum.js index e8a59c5d039501..5cce12b325c41c 100644 --- a/tools/eslint/node_modules/lodash/fp/sum.js +++ b/tools/eslint/node_modules/lodash/fp/sum.js @@ -1 +1,5 @@ -module.exports = require('../sum'); +var convert = require('./convert'), + func = convert('sum', require('../sum'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/sumBy.js b/tools/eslint/node_modules/lodash/fp/sumBy.js index 2692dc1e4ad2ac..c8826565f988d6 100644 --- a/tools/eslint/node_modules/lodash/fp/sumBy.js +++ b/tools/eslint/node_modules/lodash/fp/sumBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('sumBy', require('../sumBy')); +var convert = require('./convert'), + func = convert('sumBy', require('../sumBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/tail.js b/tools/eslint/node_modules/lodash/fp/tail.js index 36c6494a61d693..f122f0ac3476e6 100644 --- a/tools/eslint/node_modules/lodash/fp/tail.js +++ b/tools/eslint/node_modules/lodash/fp/tail.js @@ -1 +1,5 @@ -module.exports = require('../tail'); +var convert = require('./convert'), + func = convert('tail', require('../tail'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/take.js b/tools/eslint/node_modules/lodash/fp/take.js index e0984a4d2da6b7..9af98a7bdb6dd9 100644 --- a/tools/eslint/node_modules/lodash/fp/take.js +++ b/tools/eslint/node_modules/lodash/fp/take.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('take', require('../take')); +var convert = require('./convert'), + func = convert('take', require('../take')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/takeRight.js b/tools/eslint/node_modules/lodash/fp/takeRight.js index 7b7c3ce70ed971..b82950a696ca12 100644 --- a/tools/eslint/node_modules/lodash/fp/takeRight.js +++ b/tools/eslint/node_modules/lodash/fp/takeRight.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('takeRight', require('../takeRight')); +var convert = require('./convert'), + func = convert('takeRight', require('../takeRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/takeRightWhile.js b/tools/eslint/node_modules/lodash/fp/takeRightWhile.js index 305b254a163552..8ffb0a285768e0 100644 --- a/tools/eslint/node_modules/lodash/fp/takeRightWhile.js +++ b/tools/eslint/node_modules/lodash/fp/takeRightWhile.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('takeRightWhile', require('../takeRightWhile')); +var convert = require('./convert'), + func = convert('takeRightWhile', require('../takeRightWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/takeWhile.js b/tools/eslint/node_modules/lodash/fp/takeWhile.js index a90126db08edda..28136644fe6ac2 100644 --- a/tools/eslint/node_modules/lodash/fp/takeWhile.js +++ b/tools/eslint/node_modules/lodash/fp/takeWhile.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('takeWhile', require('../takeWhile')); +var convert = require('./convert'), + func = convert('takeWhile', require('../takeWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/tap.js b/tools/eslint/node_modules/lodash/fp/tap.js index 3bec2bdb2cd5cc..d33ad6ec1e2a4e 100644 --- a/tools/eslint/node_modules/lodash/fp/tap.js +++ b/tools/eslint/node_modules/lodash/fp/tap.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('tap', require('../tap')); +var convert = require('./convert'), + func = convert('tap', require('../tap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/template.js b/tools/eslint/node_modules/lodash/fp/template.js index 0130d14503b23b..74857e1c8411b5 100644 --- a/tools/eslint/node_modules/lodash/fp/template.js +++ b/tools/eslint/node_modules/lodash/fp/template.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('template', require('../template')); +var convert = require('./convert'), + func = convert('template', require('../template')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/templateSettings.js b/tools/eslint/node_modules/lodash/fp/templateSettings.js index ddbbb5861c584c..7bcc0a82b908fb 100644 --- a/tools/eslint/node_modules/lodash/fp/templateSettings.js +++ b/tools/eslint/node_modules/lodash/fp/templateSettings.js @@ -1 +1,5 @@ -module.exports = require('../templateSettings'); +var convert = require('./convert'), + func = convert('templateSettings', require('../templateSettings'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/throttle.js b/tools/eslint/node_modules/lodash/fp/throttle.js index 36f76d6df03b1e..77fff142840d74 100644 --- a/tools/eslint/node_modules/lodash/fp/throttle.js +++ b/tools/eslint/node_modules/lodash/fp/throttle.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('throttle', require('../throttle')); +var convert = require('./convert'), + func = convert('throttle', require('../throttle')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/thru.js b/tools/eslint/node_modules/lodash/fp/thru.js index 05ddaefd8243d5..d42b3b1d8404d9 100644 --- a/tools/eslint/node_modules/lodash/fp/thru.js +++ b/tools/eslint/node_modules/lodash/fp/thru.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('thru', require('../thru')); +var convert = require('./convert'), + func = convert('thru', require('../thru')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/times.js b/tools/eslint/node_modules/lodash/fp/times.js index 02fd3b70c6346c..0dab06dad16c86 100644 --- a/tools/eslint/node_modules/lodash/fp/times.js +++ b/tools/eslint/node_modules/lodash/fp/times.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('times', require('../times')); +var convert = require('./convert'), + func = convert('times', require('../times')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toArray.js b/tools/eslint/node_modules/lodash/fp/toArray.js index 1ea0b52103e57a..f0c360aca317da 100644 --- a/tools/eslint/node_modules/lodash/fp/toArray.js +++ b/tools/eslint/node_modules/lodash/fp/toArray.js @@ -1 +1,5 @@ -module.exports = require('../toArray'); +var convert = require('./convert'), + func = convert('toArray', require('../toArray'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toInteger.js b/tools/eslint/node_modules/lodash/fp/toInteger.js index 17e59a3d916fe4..e0af6a750e3963 100644 --- a/tools/eslint/node_modules/lodash/fp/toInteger.js +++ b/tools/eslint/node_modules/lodash/fp/toInteger.js @@ -1 +1,5 @@ -module.exports = require('../toInteger'); +var convert = require('./convert'), + func = convert('toInteger', require('../toInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toIterator.js b/tools/eslint/node_modules/lodash/fp/toIterator.js index 13bf21c2ae5634..65e6baa9ddedf8 100644 --- a/tools/eslint/node_modules/lodash/fp/toIterator.js +++ b/tools/eslint/node_modules/lodash/fp/toIterator.js @@ -1 +1,5 @@ -module.exports = require('../toIterator'); +var convert = require('./convert'), + func = convert('toIterator', require('../toIterator'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toJSON.js b/tools/eslint/node_modules/lodash/fp/toJSON.js index 5f6cb9268f9688..2d718d0bc1beae 100644 --- a/tools/eslint/node_modules/lodash/fp/toJSON.js +++ b/tools/eslint/node_modules/lodash/fp/toJSON.js @@ -1 +1,5 @@ -module.exports = require('../toJSON'); +var convert = require('./convert'), + func = convert('toJSON', require('../toJSON'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toLength.js b/tools/eslint/node_modules/lodash/fp/toLength.js index 38529fb0a00244..b97cdd935144be 100644 --- a/tools/eslint/node_modules/lodash/fp/toLength.js +++ b/tools/eslint/node_modules/lodash/fp/toLength.js @@ -1 +1,5 @@ -module.exports = require('../toLength'); +var convert = require('./convert'), + func = convert('toLength', require('../toLength'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toLower.js b/tools/eslint/node_modules/lodash/fp/toLower.js index 01d343248a1ce1..616ef36ada145a 100644 --- a/tools/eslint/node_modules/lodash/fp/toLower.js +++ b/tools/eslint/node_modules/lodash/fp/toLower.js @@ -1 +1,5 @@ -module.exports = require('../toLower'); +var convert = require('./convert'), + func = convert('toLower', require('../toLower'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toNumber.js b/tools/eslint/node_modules/lodash/fp/toNumber.js index 071e320a170f70..d0c6f4d3d6449f 100644 --- a/tools/eslint/node_modules/lodash/fp/toNumber.js +++ b/tools/eslint/node_modules/lodash/fp/toNumber.js @@ -1 +1,5 @@ -module.exports = require('../toNumber'); +var convert = require('./convert'), + func = convert('toNumber', require('../toNumber'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toPairs.js b/tools/eslint/node_modules/lodash/fp/toPairs.js index 4b4dcb767a3384..af783786ee1d6d 100644 --- a/tools/eslint/node_modules/lodash/fp/toPairs.js +++ b/tools/eslint/node_modules/lodash/fp/toPairs.js @@ -1 +1,5 @@ -module.exports = require('../toPairs'); +var convert = require('./convert'), + func = convert('toPairs', require('../toPairs'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toPairsIn.js b/tools/eslint/node_modules/lodash/fp/toPairsIn.js index 53076cc6a96dfe..66504abf1f196c 100644 --- a/tools/eslint/node_modules/lodash/fp/toPairsIn.js +++ b/tools/eslint/node_modules/lodash/fp/toPairsIn.js @@ -1 +1,5 @@ -module.exports = require('../toPairsIn'); +var convert = require('./convert'), + func = convert('toPairsIn', require('../toPairsIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toPath.js b/tools/eslint/node_modules/lodash/fp/toPath.js index 62762ecfab14bd..b4d5e50fb70249 100644 --- a/tools/eslint/node_modules/lodash/fp/toPath.js +++ b/tools/eslint/node_modules/lodash/fp/toPath.js @@ -1 +1,5 @@ -module.exports = require('../toPath'); +var convert = require('./convert'), + func = convert('toPath', require('../toPath'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toPlainObject.js b/tools/eslint/node_modules/lodash/fp/toPlainObject.js index 6a6aebd042e36b..278bb86398d020 100644 --- a/tools/eslint/node_modules/lodash/fp/toPlainObject.js +++ b/tools/eslint/node_modules/lodash/fp/toPlainObject.js @@ -1 +1,5 @@ -module.exports = require('../toPlainObject'); +var convert = require('./convert'), + func = convert('toPlainObject', require('../toPlainObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toSafeInteger.js b/tools/eslint/node_modules/lodash/fp/toSafeInteger.js index 3f5b8174d3c3df..367a26fddc7411 100644 --- a/tools/eslint/node_modules/lodash/fp/toSafeInteger.js +++ b/tools/eslint/node_modules/lodash/fp/toSafeInteger.js @@ -1 +1,5 @@ -module.exports = require('../toSafeInteger'); +var convert = require('./convert'), + func = convert('toSafeInteger', require('../toSafeInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toString.js b/tools/eslint/node_modules/lodash/fp/toString.js index c309058c0166e1..cec4f8e2233261 100644 --- a/tools/eslint/node_modules/lodash/fp/toString.js +++ b/tools/eslint/node_modules/lodash/fp/toString.js @@ -1 +1,5 @@ -module.exports = require('../[object Object]'); +var convert = require('./convert'), + func = convert('toString', require('../toString'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/toUpper.js b/tools/eslint/node_modules/lodash/fp/toUpper.js index 428eb338500ed8..54f9a560585561 100644 --- a/tools/eslint/node_modules/lodash/fp/toUpper.js +++ b/tools/eslint/node_modules/lodash/fp/toUpper.js @@ -1 +1,5 @@ -module.exports = require('../toUpper'); +var convert = require('./convert'), + func = convert('toUpper', require('../toUpper'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/transform.js b/tools/eslint/node_modules/lodash/fp/transform.js index 30bed49a92953b..759d088f1a35f0 100644 --- a/tools/eslint/node_modules/lodash/fp/transform.js +++ b/tools/eslint/node_modules/lodash/fp/transform.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('transform', require('../transform')); +var convert = require('./convert'), + func = convert('transform', require('../transform')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/trim.js b/tools/eslint/node_modules/lodash/fp/trim.js index b7cafe9679786e..e6319a741c7689 100644 --- a/tools/eslint/node_modules/lodash/fp/trim.js +++ b/tools/eslint/node_modules/lodash/fp/trim.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('trim', require('../trim')); +var convert = require('./convert'), + func = convert('trim', require('../trim')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/trimChars.js b/tools/eslint/node_modules/lodash/fp/trimChars.js index 051ea1e6e65772..c9294de48c756f 100644 --- a/tools/eslint/node_modules/lodash/fp/trimChars.js +++ b/tools/eslint/node_modules/lodash/fp/trimChars.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('trimChars', require('../trim')); +var convert = require('./convert'), + func = convert('trimChars', require('../trim')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/trimCharsEnd.js b/tools/eslint/node_modules/lodash/fp/trimCharsEnd.js index 54c5cff72a1326..284bc2f813e897 100644 --- a/tools/eslint/node_modules/lodash/fp/trimCharsEnd.js +++ b/tools/eslint/node_modules/lodash/fp/trimCharsEnd.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('trimCharsEnd', require('../trimEnd')); +var convert = require('./convert'), + func = convert('trimCharsEnd', require('../trimEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/trimCharsStart.js b/tools/eslint/node_modules/lodash/fp/trimCharsStart.js index 44f986650ce928..ff0ee65dfbadc7 100644 --- a/tools/eslint/node_modules/lodash/fp/trimCharsStart.js +++ b/tools/eslint/node_modules/lodash/fp/trimCharsStart.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('trimCharsStart', require('../trimStart')); +var convert = require('./convert'), + func = convert('trimCharsStart', require('../trimStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/trimEnd.js b/tools/eslint/node_modules/lodash/fp/trimEnd.js index 166659666158ac..71908805fceeee 100644 --- a/tools/eslint/node_modules/lodash/fp/trimEnd.js +++ b/tools/eslint/node_modules/lodash/fp/trimEnd.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('trimEnd', require('../trimEnd')); +var convert = require('./convert'), + func = convert('trimEnd', require('../trimEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/trimStart.js b/tools/eslint/node_modules/lodash/fp/trimStart.js index 4921b0342965a0..fda902c3893a8b 100644 --- a/tools/eslint/node_modules/lodash/fp/trimStart.js +++ b/tools/eslint/node_modules/lodash/fp/trimStart.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('trimStart', require('../trimStart')); +var convert = require('./convert'), + func = convert('trimStart', require('../trimStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/truncate.js b/tools/eslint/node_modules/lodash/fp/truncate.js index 0c4d158f87bcaf..d265c1decb397d 100644 --- a/tools/eslint/node_modules/lodash/fp/truncate.js +++ b/tools/eslint/node_modules/lodash/fp/truncate.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('truncate', require('../truncate')); +var convert = require('./convert'), + func = convert('truncate', require('../truncate')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/unary.js b/tools/eslint/node_modules/lodash/fp/unary.js index 3bc648376a003d..286c945fb638dd 100644 --- a/tools/eslint/node_modules/lodash/fp/unary.js +++ b/tools/eslint/node_modules/lodash/fp/unary.js @@ -1 +1,5 @@ -module.exports = require('../unary'); +var convert = require('./convert'), + func = convert('unary', require('../unary'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/unescape.js b/tools/eslint/node_modules/lodash/fp/unescape.js index 4233b155fc20a4..fddcb46e2ddb93 100644 --- a/tools/eslint/node_modules/lodash/fp/unescape.js +++ b/tools/eslint/node_modules/lodash/fp/unescape.js @@ -1 +1,5 @@ -module.exports = require('../unescape'); +var convert = require('./convert'), + func = convert('unescape', require('../unescape'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/union.js b/tools/eslint/node_modules/lodash/fp/union.js index 9deef123523dea..ef8228d74c751c 100644 --- a/tools/eslint/node_modules/lodash/fp/union.js +++ b/tools/eslint/node_modules/lodash/fp/union.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('union', require('../union')); +var convert = require('./convert'), + func = convert('union', require('../union')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/unionBy.js b/tools/eslint/node_modules/lodash/fp/unionBy.js index 029b359618a7e0..603687a188edb2 100644 --- a/tools/eslint/node_modules/lodash/fp/unionBy.js +++ b/tools/eslint/node_modules/lodash/fp/unionBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('unionBy', require('../unionBy')); +var convert = require('./convert'), + func = convert('unionBy', require('../unionBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/unionWith.js b/tools/eslint/node_modules/lodash/fp/unionWith.js index 631eda089086b8..65bb3a79287031 100644 --- a/tools/eslint/node_modules/lodash/fp/unionWith.js +++ b/tools/eslint/node_modules/lodash/fp/unionWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('unionWith', require('../unionWith')); +var convert = require('./convert'), + func = convert('unionWith', require('../unionWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/uniq.js b/tools/eslint/node_modules/lodash/fp/uniq.js index c64510f0987d17..bc1852490ba9d1 100644 --- a/tools/eslint/node_modules/lodash/fp/uniq.js +++ b/tools/eslint/node_modules/lodash/fp/uniq.js @@ -1 +1,5 @@ -module.exports = require('../uniq'); +var convert = require('./convert'), + func = convert('uniq', require('../uniq'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/uniqBy.js b/tools/eslint/node_modules/lodash/fp/uniqBy.js index 1b6c03ff9e734e..634c6a8bb3d7aa 100644 --- a/tools/eslint/node_modules/lodash/fp/uniqBy.js +++ b/tools/eslint/node_modules/lodash/fp/uniqBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('uniqBy', require('../uniqBy')); +var convert = require('./convert'), + func = convert('uniqBy', require('../uniqBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/uniqWith.js b/tools/eslint/node_modules/lodash/fp/uniqWith.js index be4c48def48257..0ec601a910f5f0 100644 --- a/tools/eslint/node_modules/lodash/fp/uniqWith.js +++ b/tools/eslint/node_modules/lodash/fp/uniqWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('uniqWith', require('../uniqWith')); +var convert = require('./convert'), + func = convert('uniqWith', require('../uniqWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/uniqueId.js b/tools/eslint/node_modules/lodash/fp/uniqueId.js index daa41cb0983a28..aa8fc2f73980d9 100644 --- a/tools/eslint/node_modules/lodash/fp/uniqueId.js +++ b/tools/eslint/node_modules/lodash/fp/uniqueId.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('uniqueId', require('../uniqueId')); +var convert = require('./convert'), + func = convert('uniqueId', require('../uniqueId')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/unset.js b/tools/eslint/node_modules/lodash/fp/unset.js index 0c4c1a690fcf25..ea203a0f39fb59 100644 --- a/tools/eslint/node_modules/lodash/fp/unset.js +++ b/tools/eslint/node_modules/lodash/fp/unset.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('unset', require('../unset')); +var convert = require('./convert'), + func = convert('unset', require('../unset')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/unzip.js b/tools/eslint/node_modules/lodash/fp/unzip.js index e0ac2dbf5a8d70..cc364b3c5a40ad 100644 --- a/tools/eslint/node_modules/lodash/fp/unzip.js +++ b/tools/eslint/node_modules/lodash/fp/unzip.js @@ -1 +1,5 @@ -module.exports = require('../unzip'); +var convert = require('./convert'), + func = convert('unzip', require('../unzip'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/unzipWith.js b/tools/eslint/node_modules/lodash/fp/unzipWith.js index de25cf7a8c2fcb..182eaa10424f3e 100644 --- a/tools/eslint/node_modules/lodash/fp/unzipWith.js +++ b/tools/eslint/node_modules/lodash/fp/unzipWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('unzipWith', require('../unzipWith')); +var convert = require('./convert'), + func = convert('unzipWith', require('../unzipWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/update.js b/tools/eslint/node_modules/lodash/fp/update.js new file mode 100644 index 00000000000000..b8ce2cc9e1fcc4 --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/update.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('update', require('../update')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/updateWith.js b/tools/eslint/node_modules/lodash/fp/updateWith.js new file mode 100644 index 00000000000000..d5e8282d94fdcd --- /dev/null +++ b/tools/eslint/node_modules/lodash/fp/updateWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('updateWith', require('../updateWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/upperCase.js b/tools/eslint/node_modules/lodash/fp/upperCase.js index ddcb3695c4e38b..c886f202162a09 100644 --- a/tools/eslint/node_modules/lodash/fp/upperCase.js +++ b/tools/eslint/node_modules/lodash/fp/upperCase.js @@ -1 +1,5 @@ -module.exports = require('../upperCase'); +var convert = require('./convert'), + func = convert('upperCase', require('../upperCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/upperFirst.js b/tools/eslint/node_modules/lodash/fp/upperFirst.js index 34f1e20f9f6102..d8c04df54bb33b 100644 --- a/tools/eslint/node_modules/lodash/fp/upperFirst.js +++ b/tools/eslint/node_modules/lodash/fp/upperFirst.js @@ -1 +1,5 @@ -module.exports = require('../upperFirst'); +var convert = require('./convert'), + func = convert('upperFirst', require('../upperFirst'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/value.js b/tools/eslint/node_modules/lodash/fp/value.js index 4dc0e7e9639912..555eec7a38db21 100644 --- a/tools/eslint/node_modules/lodash/fp/value.js +++ b/tools/eslint/node_modules/lodash/fp/value.js @@ -1 +1,5 @@ -module.exports = require('../value'); +var convert = require('./convert'), + func = convert('value', require('../value'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/valueOf.js b/tools/eslint/node_modules/lodash/fp/valueOf.js index c309058c0166e1..f968807d701e97 100644 --- a/tools/eslint/node_modules/lodash/fp/valueOf.js +++ b/tools/eslint/node_modules/lodash/fp/valueOf.js @@ -1 +1,5 @@ -module.exports = require('../[object Object]'); +var convert = require('./convert'), + func = convert('valueOf', require('../valueOf'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/values.js b/tools/eslint/node_modules/lodash/fp/values.js index 38431709150748..2dfc56136b6ee1 100644 --- a/tools/eslint/node_modules/lodash/fp/values.js +++ b/tools/eslint/node_modules/lodash/fp/values.js @@ -1 +1,5 @@ -module.exports = require('../values'); +var convert = require('./convert'), + func = convert('values', require('../values'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/valuesIn.js b/tools/eslint/node_modules/lodash/fp/valuesIn.js index f81c171c4ee22d..a1b2bb8725e3e9 100644 --- a/tools/eslint/node_modules/lodash/fp/valuesIn.js +++ b/tools/eslint/node_modules/lodash/fp/valuesIn.js @@ -1 +1,5 @@ -module.exports = require('../valuesIn'); +var convert = require('./convert'), + func = convert('valuesIn', require('../valuesIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/without.js b/tools/eslint/node_modules/lodash/fp/without.js index 5238e940f7038a..bad9e125bc93a2 100644 --- a/tools/eslint/node_modules/lodash/fp/without.js +++ b/tools/eslint/node_modules/lodash/fp/without.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('without', require('../without')); +var convert = require('./convert'), + func = convert('without', require('../without')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/words.js b/tools/eslint/node_modules/lodash/fp/words.js index b58a485b9d1ee5..4a901414b8e0ad 100644 --- a/tools/eslint/node_modules/lodash/fp/words.js +++ b/tools/eslint/node_modules/lodash/fp/words.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('words', require('../words')); +var convert = require('./convert'), + func = convert('words', require('../words')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/wrap.js b/tools/eslint/node_modules/lodash/fp/wrap.js index 56465a22629120..e93bd8a1de6f41 100644 --- a/tools/eslint/node_modules/lodash/fp/wrap.js +++ b/tools/eslint/node_modules/lodash/fp/wrap.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('wrap', require('../wrap')); +var convert = require('./convert'), + func = convert('wrap', require('../wrap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/wrapperAt.js b/tools/eslint/node_modules/lodash/fp/wrapperAt.js index f8d37a194e108d..8f0a310feacb1f 100644 --- a/tools/eslint/node_modules/lodash/fp/wrapperAt.js +++ b/tools/eslint/node_modules/lodash/fp/wrapperAt.js @@ -1 +1,5 @@ -module.exports = require('../wrapperAt'); +var convert = require('./convert'), + func = convert('wrapperAt', require('../wrapperAt'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/wrapperChain.js b/tools/eslint/node_modules/lodash/fp/wrapperChain.js index 964a846c84e58d..2a48ea2b5b7dfa 100644 --- a/tools/eslint/node_modules/lodash/fp/wrapperChain.js +++ b/tools/eslint/node_modules/lodash/fp/wrapperChain.js @@ -1 +1,5 @@ -module.exports = require('../wrapperChain'); +var convert = require('./convert'), + func = convert('wrapperChain', require('../wrapperChain'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/wrapperFlatMap.js b/tools/eslint/node_modules/lodash/fp/wrapperFlatMap.js deleted file mode 100644 index fa030c0dace84e..00000000000000 --- a/tools/eslint/node_modules/lodash/fp/wrapperFlatMap.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../wrapperFlatMap'); diff --git a/tools/eslint/node_modules/lodash/fp/wrapperLodash.js b/tools/eslint/node_modules/lodash/fp/wrapperLodash.js index d62a9969ffa62a..a7162d084c884f 100644 --- a/tools/eslint/node_modules/lodash/fp/wrapperLodash.js +++ b/tools/eslint/node_modules/lodash/fp/wrapperLodash.js @@ -1 +1,5 @@ -module.exports = require('../wrapperLodash'); +var convert = require('./convert'), + func = convert('wrapperLodash', require('../wrapperLodash'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/wrapperReverse.js b/tools/eslint/node_modules/lodash/fp/wrapperReverse.js index cf703886c25c36..e1481aab9171a5 100644 --- a/tools/eslint/node_modules/lodash/fp/wrapperReverse.js +++ b/tools/eslint/node_modules/lodash/fp/wrapperReverse.js @@ -1 +1,5 @@ -module.exports = require('../wrapperReverse'); +var convert = require('./convert'), + func = convert('wrapperReverse', require('../wrapperReverse'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/wrapperValue.js b/tools/eslint/node_modules/lodash/fp/wrapperValue.js index 494dfb107f641b..8eb9112f613785 100644 --- a/tools/eslint/node_modules/lodash/fp/wrapperValue.js +++ b/tools/eslint/node_modules/lodash/fp/wrapperValue.js @@ -1 +1,5 @@ -module.exports = require('../wrapperValue'); +var convert = require('./convert'), + func = convert('wrapperValue', require('../wrapperValue'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/xor.js b/tools/eslint/node_modules/lodash/fp/xor.js index 0f3e025fed4ea1..29e2819489386c 100644 --- a/tools/eslint/node_modules/lodash/fp/xor.js +++ b/tools/eslint/node_modules/lodash/fp/xor.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('xor', require('../xor')); +var convert = require('./convert'), + func = convert('xor', require('../xor')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/xorBy.js b/tools/eslint/node_modules/lodash/fp/xorBy.js index e48fc41c70dd52..b355686db652c1 100644 --- a/tools/eslint/node_modules/lodash/fp/xorBy.js +++ b/tools/eslint/node_modules/lodash/fp/xorBy.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('xorBy', require('../xorBy')); +var convert = require('./convert'), + func = convert('xorBy', require('../xorBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/xorWith.js b/tools/eslint/node_modules/lodash/fp/xorWith.js index 5c2eebe67ef700..8e05739ad36d82 100644 --- a/tools/eslint/node_modules/lodash/fp/xorWith.js +++ b/tools/eslint/node_modules/lodash/fp/xorWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('xorWith', require('../xorWith')); +var convert = require('./convert'), + func = convert('xorWith', require('../xorWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/zip.js b/tools/eslint/node_modules/lodash/fp/zip.js index 0cae73b0a0434a..69e147a441da74 100644 --- a/tools/eslint/node_modules/lodash/fp/zip.js +++ b/tools/eslint/node_modules/lodash/fp/zip.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('zip', require('../zip')); +var convert = require('./convert'), + func = convert('zip', require('../zip')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/zipObject.js b/tools/eslint/node_modules/lodash/fp/zipObject.js index 8c2ff3bc200c87..462dbb68cb333b 100644 --- a/tools/eslint/node_modules/lodash/fp/zipObject.js +++ b/tools/eslint/node_modules/lodash/fp/zipObject.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('zipObject', require('../zipObject')); +var convert = require('./convert'), + func = convert('zipObject', require('../zipObject')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/zipObjectDeep.js b/tools/eslint/node_modules/lodash/fp/zipObjectDeep.js index a0ee4e34ec25ec..53a5d3380735e6 100644 --- a/tools/eslint/node_modules/lodash/fp/zipObjectDeep.js +++ b/tools/eslint/node_modules/lodash/fp/zipObjectDeep.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('zipObjectDeep', require('../zipObjectDeep')); +var convert = require('./convert'), + func = convert('zipObjectDeep', require('../zipObjectDeep')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fp/zipWith.js b/tools/eslint/node_modules/lodash/fp/zipWith.js index da75f3de409f63..c5cf9e21282317 100644 --- a/tools/eslint/node_modules/lodash/fp/zipWith.js +++ b/tools/eslint/node_modules/lodash/fp/zipWith.js @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('zipWith', require('../zipWith')); +var convert = require('./convert'), + func = convert('zipWith', require('../zipWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/tools/eslint/node_modules/lodash/fromPairs.js b/tools/eslint/node_modules/lodash/fromPairs.js index c18c1e38697b4c..a591488ef955a9 100644 --- a/tools/eslint/node_modules/lodash/fromPairs.js +++ b/tools/eslint/node_modules/lodash/fromPairs.js @@ -4,6 +4,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. diff --git a/tools/eslint/node_modules/lodash/functions.js b/tools/eslint/node_modules/lodash/functions.js index b50a197debb6f4..36a9cad2ea457a 100644 --- a/tools/eslint/node_modules/lodash/functions.js +++ b/tools/eslint/node_modules/lodash/functions.js @@ -6,6 +6,7 @@ var baseFunctions = require('./_baseFunctions'), * of `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to inspect. diff --git a/tools/eslint/node_modules/lodash/functionsIn.js b/tools/eslint/node_modules/lodash/functionsIn.js index b48e5a65b5f37b..6bd3b57df91a48 100644 --- a/tools/eslint/node_modules/lodash/functionsIn.js +++ b/tools/eslint/node_modules/lodash/functionsIn.js @@ -7,6 +7,7 @@ var baseFunctions = require('./_baseFunctions'), * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. diff --git a/tools/eslint/node_modules/lodash/get.js b/tools/eslint/node_modules/lodash/get.js index 755fa05ae2d96f..5a5837b2541884 100644 --- a/tools/eslint/node_modules/lodash/get.js +++ b/tools/eslint/node_modules/lodash/get.js @@ -2,14 +2,15 @@ var baseGet = require('./_baseGet'); /** * Gets the value at `path` of `object`. If the resolved value is - * `undefined` the `defaultValue` is used in its place. + * `undefined`, the `defaultValue` is used in its place. * * @static * @memberOf _ + * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * diff --git a/tools/eslint/node_modules/lodash/groupBy.js b/tools/eslint/node_modules/lodash/groupBy.js index 728a6dabac3b9b..ae7db5faa354ae 100644 --- a/tools/eslint/node_modules/lodash/groupBy.js +++ b/tools/eslint/node_modules/lodash/groupBy.js @@ -8,15 +8,18 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is an array of elements responsible for generating the key. - * The iteratee is invoked with one argument: (value). + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * diff --git a/tools/eslint/node_modules/lodash/gt.js b/tools/eslint/node_modules/lodash/gt.js index ddaf5ea06712ef..2fc9a206ccd4ca 100644 --- a/tools/eslint/node_modules/lodash/gt.js +++ b/tools/eslint/node_modules/lodash/gt.js @@ -3,10 +3,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. * @example * * _.gt(3, 1); diff --git a/tools/eslint/node_modules/lodash/gte.js b/tools/eslint/node_modules/lodash/gte.js index 4a5ffb5cdce2e6..521be993d23f2f 100644 --- a/tools/eslint/node_modules/lodash/gte.js +++ b/tools/eslint/node_modules/lodash/gte.js @@ -3,10 +3,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. * @example * * _.gte(3, 1); diff --git a/tools/eslint/node_modules/lodash/has.js b/tools/eslint/node_modules/lodash/has.js index d66d2de020ce24..34df55e8e2df61 100644 --- a/tools/eslint/node_modules/lodash/has.js +++ b/tools/eslint/node_modules/lodash/has.js @@ -5,6 +5,7 @@ var baseHas = require('./_baseHas'), * Checks if `path` is a direct property of `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -12,23 +13,23 @@ var baseHas = require('./_baseHas'), * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * - * var object = { 'a': { 'b': { 'c': 3 } } }; - * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.has(object, 'a'); * // => true * - * _.has(object, 'a.b.c'); + * _.has(object, 'a.b'); * // => true * - * _.has(object, ['a', 'b', 'c']); + * _.has(object, ['a', 'b']); * // => true * * _.has(other, 'a'); * // => false */ function has(object, path) { - return hasPath(object, path, baseHas); + return object != null && hasPath(object, path, baseHas); } module.exports = has; diff --git a/tools/eslint/node_modules/lodash/hasIn.js b/tools/eslint/node_modules/lodash/hasIn.js index 7da6b7dcd1add2..06a3686542e672 100644 --- a/tools/eslint/node_modules/lodash/hasIn.js +++ b/tools/eslint/node_modules/lodash/hasIn.js @@ -6,28 +6,29 @@ var baseHasIn = require('./_baseHasIn'), * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * - * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * - * _.hasIn(object, 'a.b.c'); + * _.hasIn(object, 'a.b'); * // => true * - * _.hasIn(object, ['a', 'b', 'c']); + * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { - return hasPath(object, path, baseHasIn); + return object != null && hasPath(object, path, baseHasIn); } module.exports = hasIn; diff --git a/tools/eslint/node_modules/lodash/head.js b/tools/eslint/node_modules/lodash/head.js index 30b47b0b3f4fed..8baa0b8a33a475 100644 --- a/tools/eslint/node_modules/lodash/head.js +++ b/tools/eslint/node_modules/lodash/head.js @@ -3,6 +3,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @alias first * @category Array * @param {Array} array The array to query. diff --git a/tools/eslint/node_modules/lodash/identity.js b/tools/eslint/node_modules/lodash/identity.js index da7dea19c17904..3732edb131b69f 100644 --- a/tools/eslint/node_modules/lodash/identity.js +++ b/tools/eslint/node_modules/lodash/identity.js @@ -2,6 +2,7 @@ * This method returns the first argument given to it. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. diff --git a/tools/eslint/node_modules/lodash/inRange.js b/tools/eslint/node_modules/lodash/inRange.js index 69c61101cdbf5c..d864ca2cf3e22e 100644 --- a/tools/eslint/node_modules/lodash/inRange.js +++ b/tools/eslint/node_modules/lodash/inRange.js @@ -3,12 +3,13 @@ var baseInRange = require('./_baseInRange'), /** * Checks if `n` is between `start` and up to but not including, `end`. If - * `end` is not specified it's set to `start` with `start` then set to `0`. + * `end` is not specified, it's set to `start` with `start` then set to `0`. * If `start` is greater than `end` the params are swapped to support * negative ranges. * * @static * @memberOf _ + * @since 3.3.0 * @category Number * @param {number} number The number to check. * @param {number} [start=0] The start of the range. diff --git a/tools/eslint/node_modules/lodash/includes.js b/tools/eslint/node_modules/lodash/includes.js index 01d68445416294..cefe3bf9487f68 100644 --- a/tools/eslint/node_modules/lodash/includes.js +++ b/tools/eslint/node_modules/lodash/includes.js @@ -8,18 +8,20 @@ var baseIndexOf = require('./_baseIndexOf'), var nativeMax = Math.max; /** - * Checks if `value` is in `collection`. If `collection` is a string it's checked - * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * is used for equality comparisons. If `fromIndex` is negative, it's used as * the offset from the end of `collection`. * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {boolean} Returns `true` if `value` is found, else `false`. * @example * diff --git a/tools/eslint/node_modules/lodash/indexOf.js b/tools/eslint/node_modules/lodash/indexOf.js index 4474d0cafd6a07..65616d45490767 100644 --- a/tools/eslint/node_modules/lodash/indexOf.js +++ b/tools/eslint/node_modules/lodash/indexOf.js @@ -7,11 +7,12 @@ var nativeMax = Math.max; /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `array`. + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. diff --git a/tools/eslint/node_modules/lodash/initial.js b/tools/eslint/node_modules/lodash/initial.js index 59b7a7d96dfbda..f4441b547a6e9c 100644 --- a/tools/eslint/node_modules/lodash/initial.js +++ b/tools/eslint/node_modules/lodash/initial.js @@ -5,6 +5,7 @@ var dropRight = require('./dropRight'); * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. diff --git a/tools/eslint/node_modules/lodash/intersection.js b/tools/eslint/node_modules/lodash/intersection.js index e97efddb7c9c05..c525a4ff2e276b 100644 --- a/tools/eslint/node_modules/lodash/intersection.js +++ b/tools/eslint/node_modules/lodash/intersection.js @@ -1,25 +1,27 @@ var arrayMap = require('./_arrayMap'), + baseCastArrayLikeObject = require('./_baseCastArrayLikeObject'), baseIntersection = require('./_baseIntersection'), - rest = require('./rest'), - toArrayLikeObject = require('./_toArrayLikeObject'); + rest = require('./rest'); /** * Creates an array of unique values that are included in all given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. + * for equality comparisons. The order of result values is determined by the + * order they occur in the first array. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of shared values. + * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersection([2, 1], [4, 2], [1, 2]); * // => [2] */ var intersection = rest(function(arrays) { - var mapped = arrayMap(arrays, toArrayLikeObject); + var mapped = arrayMap(arrays, baseCastArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) : []; diff --git a/tools/eslint/node_modules/lodash/intersectionBy.js b/tools/eslint/node_modules/lodash/intersectionBy.js index 2c9e0d33079367..6d8c45f50d4006 100644 --- a/tools/eslint/node_modules/lodash/intersectionBy.js +++ b/tools/eslint/node_modules/lodash/intersectionBy.js @@ -1,21 +1,24 @@ var arrayMap = require('./_arrayMap'), + baseCastArrayLikeObject = require('./_baseCastArrayLikeObject'), baseIntersection = require('./_baseIntersection'), baseIteratee = require('./_baseIteratee'), last = require('./last'), - rest = require('./rest'), - toArrayLikeObject = require('./_toArrayLikeObject'); + rest = require('./rest'); /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * by which they're compared. Result values are chosen from the first array. + * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of shared values. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); @@ -27,7 +30,7 @@ var arrayMap = require('./_arrayMap'), */ var intersectionBy = rest(function(arrays) { var iteratee = last(arrays), - mapped = arrayMap(arrays, toArrayLikeObject); + mapped = arrayMap(arrays, baseCastArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined; diff --git a/tools/eslint/node_modules/lodash/intersectionWith.js b/tools/eslint/node_modules/lodash/intersectionWith.js index c39e38f533e91d..2985e3fcb08877 100644 --- a/tools/eslint/node_modules/lodash/intersectionWith.js +++ b/tools/eslint/node_modules/lodash/intersectionWith.js @@ -1,20 +1,22 @@ var arrayMap = require('./_arrayMap'), + baseCastArrayLikeObject = require('./_baseCastArrayLikeObject'), baseIntersection = require('./_baseIntersection'), last = require('./last'), - rest = require('./rest'), - toArrayLikeObject = require('./_toArrayLikeObject'); + rest = require('./rest'); /** * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The comparator is invoked - * with two arguments: (arrVal, othVal). + * which is invoked to compare elements of `arrays`. Result values are chosen + * from the first array. The comparator is invoked with two arguments: + * (arrVal, othVal). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. + * @returns {Array} Returns the new array of intersecting values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; @@ -25,7 +27,7 @@ var arrayMap = require('./_arrayMap'), */ var intersectionWith = rest(function(arrays) { var comparator = last(arrays), - mapped = arrayMap(arrays, toArrayLikeObject); + mapped = arrayMap(arrays, baseCastArrayLikeObject); if (comparator === last(mapped)) { comparator = undefined; diff --git a/tools/eslint/node_modules/lodash/invert.js b/tools/eslint/node_modules/lodash/invert.js index 11628b14ea289b..21d10aba370dd7 100644 --- a/tools/eslint/node_modules/lodash/invert.js +++ b/tools/eslint/node_modules/lodash/invert.js @@ -4,11 +4,12 @@ var constant = require('./constant'), /** * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite property - * assignments of previous values. + * If `object` contains duplicate values, subsequent values overwrite + * property assignments of previous values. * * @static * @memberOf _ + * @since 0.7.0 * @category Object * @param {Object} object The object to invert. * @returns {Object} Returns the new inverted object. diff --git a/tools/eslint/node_modules/lodash/invertBy.js b/tools/eslint/node_modules/lodash/invertBy.js index 513f62b92fa7e2..4298199ccd1e0a 100644 --- a/tools/eslint/node_modules/lodash/invertBy.js +++ b/tools/eslint/node_modules/lodash/invertBy.js @@ -9,16 +9,18 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` through `iteratee`. - * The corresponding inverted value of each inverted key is an array of keys + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys * responsible for generating the inverted value. The iteratee is invoked * with one argument: (value). * * @static * @memberOf _ + * @since 4.1.0 * @category Object * @param {Object} object The object to invert. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Object} Returns the new inverted object. * @example * diff --git a/tools/eslint/node_modules/lodash/invoke.js b/tools/eslint/node_modules/lodash/invoke.js index f090a723673976..7b6f56bb1fc354 100644 --- a/tools/eslint/node_modules/lodash/invoke.js +++ b/tools/eslint/node_modules/lodash/invoke.js @@ -6,6 +6,7 @@ var baseInvoke = require('./_baseInvoke'), * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. diff --git a/tools/eslint/node_modules/lodash/invokeMap.js b/tools/eslint/node_modules/lodash/invokeMap.js index 42c8fbe1415637..4a6063e0aadfe3 100644 --- a/tools/eslint/node_modules/lodash/invokeMap.js +++ b/tools/eslint/node_modules/lodash/invokeMap.js @@ -8,11 +8,12 @@ var apply = require('./_apply'), /** * Invokes the method at `path` of each element in `collection`, returning * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `methodName` is a function it's - * invoked for, and `this` bound to, each element in `collection`. + * are provided to each invoked method. If `methodName` is a function, it's + * invoked for and `this` bound to, each element in `collection`. * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array|Function|string} path The path of the method to invoke or diff --git a/tools/eslint/node_modules/lodash/isArguments.js b/tools/eslint/node_modules/lodash/isArguments.js index 73fbafe0d28320..3ca0d3ca120601 100644 --- a/tools/eslint/node_modules/lodash/isArguments.js +++ b/tools/eslint/node_modules/lodash/isArguments.js @@ -10,7 +10,8 @@ var objectProto = Object.prototype; var hasOwnProperty = objectProto.hasOwnProperty; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -23,9 +24,11 @@ var propertyIsEnumerable = objectProto.propertyIsEnumerable; * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArguments(function() { return arguments; }()); diff --git a/tools/eslint/node_modules/lodash/isArray.js b/tools/eslint/node_modules/lodash/isArray.js index 22a1a22eb43e2b..1901120e7e2382 100644 --- a/tools/eslint/node_modules/lodash/isArray.js +++ b/tools/eslint/node_modules/lodash/isArray.js @@ -3,10 +3,12 @@ * * @static * @memberOf _ - * @type Function + * @since 0.1.0 + * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); diff --git a/tools/eslint/node_modules/lodash/isArrayBuffer.js b/tools/eslint/node_modules/lodash/isArrayBuffer.js index 80b85633f7deb7..0a6a8e67614d6f 100644 --- a/tools/eslint/node_modules/lodash/isArrayBuffer.js +++ b/tools/eslint/node_modules/lodash/isArrayBuffer.js @@ -6,7 +6,8 @@ var arrayBufferTag = '[object ArrayBuffer]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -16,10 +17,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ - * @type Function + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArrayBuffer(new ArrayBuffer(2)); diff --git a/tools/eslint/node_modules/lodash/isArrayLike.js b/tools/eslint/node_modules/lodash/isArrayLike.js index 9f4ddd51bb6767..189a611f005804 100644 --- a/tools/eslint/node_modules/lodash/isArrayLike.js +++ b/tools/eslint/node_modules/lodash/isArrayLike.js @@ -9,7 +9,7 @@ var getLength = require('./_getLength'), * * @static * @memberOf _ - * @type Function + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -28,8 +28,7 @@ var getLength = require('./_getLength'), * // => false */ function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); + return value != null && isLength(getLength(value)) && !isFunction(value); } module.exports = isArrayLike; diff --git a/tools/eslint/node_modules/lodash/isArrayLikeObject.js b/tools/eslint/node_modules/lodash/isArrayLikeObject.js index 22b3577376f95d..6c4812a8d862d3 100644 --- a/tools/eslint/node_modules/lodash/isArrayLikeObject.js +++ b/tools/eslint/node_modules/lodash/isArrayLikeObject.js @@ -7,10 +7,11 @@ var isArrayLike = require('./isArrayLike'), * * @static * @memberOf _ - * @type Function + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); diff --git a/tools/eslint/node_modules/lodash/isBoolean.js b/tools/eslint/node_modules/lodash/isBoolean.js index 53ec5d6e5ee25e..242fad1ffd0a34 100644 --- a/tools/eslint/node_modules/lodash/isBoolean.js +++ b/tools/eslint/node_modules/lodash/isBoolean.js @@ -7,7 +7,8 @@ var boolTag = '[object Boolean]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -17,9 +18,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isBoolean(false); diff --git a/tools/eslint/node_modules/lodash/isBuffer.js b/tools/eslint/node_modules/lodash/isBuffer.js index 1e6b8b6d385ab9..404c22200ca75f 100644 --- a/tools/eslint/node_modules/lodash/isBuffer.js +++ b/tools/eslint/node_modules/lodash/isBuffer.js @@ -8,13 +8,19 @@ var objectTypes = { }; /** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; /** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; /** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; +var moduleExports = (freeModule && freeModule.exports === freeExports) + ? freeExports + : undefined; /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined; @@ -24,6 +30,7 @@ var Buffer = moduleExports ? root.Buffer : undefined; * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. diff --git a/tools/eslint/node_modules/lodash/isDate.js b/tools/eslint/node_modules/lodash/isDate.js index 6e3611a05bfbdb..f85a801747d47c 100644 --- a/tools/eslint/node_modules/lodash/isDate.js +++ b/tools/eslint/node_modules/lodash/isDate.js @@ -7,7 +7,8 @@ var dateTag = '[object Date]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -17,9 +18,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isDate(new Date); diff --git a/tools/eslint/node_modules/lodash/isElement.js b/tools/eslint/node_modules/lodash/isElement.js index 447d6bc2038fd2..67aca5dc7fa949 100644 --- a/tools/eslint/node_modules/lodash/isElement.js +++ b/tools/eslint/node_modules/lodash/isElement.js @@ -6,9 +6,11 @@ var isObjectLike = require('./isObjectLike'), * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @returns {boolean} Returns `true` if `value` is a DOM element, + * else `false`. * @example * * _.isElement(document.body); diff --git a/tools/eslint/node_modules/lodash/isEmpty.js b/tools/eslint/node_modules/lodash/isEmpty.js index 29062ed4bea91a..9d4649690bdb13 100644 --- a/tools/eslint/node_modules/lodash/isEmpty.js +++ b/tools/eslint/node_modules/lodash/isEmpty.js @@ -1,8 +1,16 @@ -var isArguments = require('./isArguments'), +var getTag = require('./_getTag'), + isArguments = require('./isArguments'), isArray = require('./isArray'), isArrayLike = require('./isArrayLike'), + isBuffer = require('./isBuffer'), isFunction = require('./isFunction'), - isString = require('./isString'); + isObjectLike = require('./isObjectLike'), + isString = require('./isString'), + keys = require('./keys'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + setTag = '[object Set]'; /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -10,15 +18,27 @@ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ +var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); + /** - * Checks if `value` is empty. A value is considered empty unless it's an - * `arguments` object, array, string, or jQuery-like collection with a length - * greater than `0` or an object with own enumerable properties. + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang - * @param {Array|Object|string} value The value to inspect. + * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * @@ -39,15 +59,22 @@ var hasOwnProperty = objectProto.hasOwnProperty; */ function isEmpty(value) { if (isArrayLike(value) && - (isArray(value) || isString(value) || isFunction(value.splice) || isArguments(value))) { + (isArray(value) || isString(value) || isFunction(value.splice) || + isArguments(value) || isBuffer(value))) { return !value.length; } + if (isObjectLike(value)) { + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } - return true; + return !(nonEnumShadows && keys(value).length); } module.exports = isEmpty; diff --git a/tools/eslint/node_modules/lodash/isEqual.js b/tools/eslint/node_modules/lodash/isEqual.js index 43a3a2b567a0ce..dd5d0cc7ce0939 100644 --- a/tools/eslint/node_modules/lodash/isEqual.js +++ b/tools/eslint/node_modules/lodash/isEqual.js @@ -12,10 +12,12 @@ var baseIsEqual = require('./_baseIsEqual'); * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @returns {boolean} Returns `true` if the values are equivalent, + * else `false`. * @example * * var object = { 'user': 'fred' }; diff --git a/tools/eslint/node_modules/lodash/isEqualWith.js b/tools/eslint/node_modules/lodash/isEqualWith.js index 60fe95d9eb0d16..a442b248f3a3c7 100644 --- a/tools/eslint/node_modules/lodash/isEqualWith.js +++ b/tools/eslint/node_modules/lodash/isEqualWith.js @@ -1,18 +1,20 @@ var baseIsEqual = require('./_baseIsEqual'); /** - * This method is like `_.isEqual` except that it accepts `customizer` which is - * invoked to compare values. If `customizer` returns `undefined` comparisons are - * handled by the method instead. The `customizer` is invoked with up to six arguments: - * (objValue, othValue [, index|key, object, other, stack]). + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @returns {boolean} Returns `true` if the values are equivalent, + * else `false`. * @example * * function isGreeting(value) { diff --git a/tools/eslint/node_modules/lodash/isError.js b/tools/eslint/node_modules/lodash/isError.js index e66b443d8e508e..b4a93aebe24764 100644 --- a/tools/eslint/node_modules/lodash/isError.js +++ b/tools/eslint/node_modules/lodash/isError.js @@ -7,7 +7,8 @@ var errorTag = '[object Error]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -18,9 +19,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @returns {boolean} Returns `true` if `value` is an error object, + * else `false`. * @example * * _.isError(new Error); @@ -30,8 +33,11 @@ var objectToString = objectProto.toString; * // => false */ function isError(value) { - return isObjectLike(value) && - typeof value.message == 'string' && objectToString.call(value) == errorTag; + if (!isObjectLike(value)) { + return false; + } + return (objectToString.call(value) == errorTag) || + (typeof value.message == 'string' && typeof value.name == 'string'); } module.exports = isError; diff --git a/tools/eslint/node_modules/lodash/isFinite.js b/tools/eslint/node_modules/lodash/isFinite.js index 44be4bc9d0943b..744e7a65e1e4db 100644 --- a/tools/eslint/node_modules/lodash/isFinite.js +++ b/tools/eslint/node_modules/lodash/isFinite.js @@ -6,13 +6,16 @@ var nativeIsFinite = root.isFinite; /** * Checks if `value` is a finite primitive number. * - * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite). + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @returns {boolean} Returns `true` if `value` is a finite number, + * else `false`. * @example * * _.isFinite(3); diff --git a/tools/eslint/node_modules/lodash/isFunction.js b/tools/eslint/node_modules/lodash/isFunction.js index a1d9530c65e19e..da02be0e10be32 100644 --- a/tools/eslint/node_modules/lodash/isFunction.js +++ b/tools/eslint/node_modules/lodash/isFunction.js @@ -8,7 +8,8 @@ var funcTag = '[object Function]', var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -18,9 +19,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -31,8 +34,8 @@ var objectToString = objectProto.toString; */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/tools/eslint/node_modules/lodash/isInteger.js b/tools/eslint/node_modules/lodash/isInteger.js index 1bfcc65fb8be8c..66aa87d573d717 100644 --- a/tools/eslint/node_modules/lodash/isInteger.js +++ b/tools/eslint/node_modules/lodash/isInteger.js @@ -3,10 +3,12 @@ var toInteger = require('./toInteger'); /** * Checks if `value` is an integer. * - * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an integer, else `false`. diff --git a/tools/eslint/node_modules/lodash/isLength.js b/tools/eslint/node_modules/lodash/isLength.js index 2f04aca810f31b..cd9b2572178cb9 100644 --- a/tools/eslint/node_modules/lodash/isLength.js +++ b/tools/eslint/node_modules/lodash/isLength.js @@ -4,13 +4,16 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. * @example * * _.isLength(3); @@ -26,7 +29,8 @@ var MAX_SAFE_INTEGER = 9007199254740991; * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } module.exports = isLength; diff --git a/tools/eslint/node_modules/lodash/isMap.js b/tools/eslint/node_modules/lodash/isMap.js index bc92defd87f91d..f83758e13bac1e 100644 --- a/tools/eslint/node_modules/lodash/isMap.js +++ b/tools/eslint/node_modules/lodash/isMap.js @@ -9,9 +9,11 @@ var mapTag = '[object Map]'; * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isMap(new Map); diff --git a/tools/eslint/node_modules/lodash/isMatch.js b/tools/eslint/node_modules/lodash/isMatch.js index a14131fef31724..371e4458b2a18a 100644 --- a/tools/eslint/node_modules/lodash/isMatch.js +++ b/tools/eslint/node_modules/lodash/isMatch.js @@ -2,13 +2,15 @@ var baseIsMatch = require('./_baseIsMatch'), getMatchData = require('./_getMatchData'); /** - * Performs a deep comparison between `object` and `source` to determine if - * `object` contains equivalent property values. + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. This method is + * equivalent to a `_.matches` function when `source` is partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. diff --git a/tools/eslint/node_modules/lodash/isMatchWith.js b/tools/eslint/node_modules/lodash/isMatchWith.js index 2460eb35e0b66c..187b6a61de55d0 100644 --- a/tools/eslint/node_modules/lodash/isMatchWith.js +++ b/tools/eslint/node_modules/lodash/isMatchWith.js @@ -3,12 +3,13 @@ var baseIsMatch = require('./_baseIsMatch'), /** * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined` comparisons + * is invoked to compare values. If `customizer` returns `undefined`, comparisons * are handled by the method instead. The `customizer` is invoked with five * arguments: (objValue, srcValue, index|key, object, source). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. diff --git a/tools/eslint/node_modules/lodash/isNaN.js b/tools/eslint/node_modules/lodash/isNaN.js index 5b757b1fc54376..7d0d783bada2ce 100644 --- a/tools/eslint/node_modules/lodash/isNaN.js +++ b/tools/eslint/node_modules/lodash/isNaN.js @@ -3,11 +3,14 @@ var isNumber = require('./isNumber'); /** * Checks if `value` is `NaN`. * - * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) - * which returns `true` for `undefined` and other non-numeric values. + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. @@ -27,7 +30,8 @@ var isNumber = require('./isNumber'); */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. return isNumber(value) && value != +value; } diff --git a/tools/eslint/node_modules/lodash/isNative.js b/tools/eslint/node_modules/lodash/isNative.js index 616a832e6b8e29..2d5149ba457718 100644 --- a/tools/eslint/node_modules/lodash/isNative.js +++ b/tools/eslint/node_modules/lodash/isNative.js @@ -1,11 +1,15 @@ var isFunction = require('./isFunction'), isHostObject = require('./_isHostObject'), - isObjectLike = require('./isObjectLike'); + isObject = require('./isObject'), + toSource = require('./_toSource'); -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; -/** Used to detect host constructors (Safari > 5). */ +/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used for built-in method references. */ @@ -28,9 +32,11 @@ var reIsNative = RegExp('^' + * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. * @example * * _.isNative(Array.prototype.push); @@ -40,14 +46,11 @@ var reIsNative = RegExp('^' + * // => false */ function isNative(value) { - if (value == null) { + if (!isObject(value)) { return false; } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } module.exports = isNative; diff --git a/tools/eslint/node_modules/lodash/isNil.js b/tools/eslint/node_modules/lodash/isNil.js index c4197fb3cf829f..79f05052c5ed9c 100644 --- a/tools/eslint/node_modules/lodash/isNil.js +++ b/tools/eslint/node_modules/lodash/isNil.js @@ -3,6 +3,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. diff --git a/tools/eslint/node_modules/lodash/isNull.js b/tools/eslint/node_modules/lodash/isNull.js index ec66c4d8d8f18e..c0a374d7dc178a 100644 --- a/tools/eslint/node_modules/lodash/isNull.js +++ b/tools/eslint/node_modules/lodash/isNull.js @@ -3,6 +3,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. diff --git a/tools/eslint/node_modules/lodash/isNumber.js b/tools/eslint/node_modules/lodash/isNumber.js index 0c8fb9ae93d23f..e427282ac85905 100644 --- a/tools/eslint/node_modules/lodash/isNumber.js +++ b/tools/eslint/node_modules/lodash/isNumber.js @@ -7,7 +7,8 @@ var numberTag = '[object Number]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -15,14 +16,16 @@ var objectToString = objectProto.toString; /** * Checks if `value` is classified as a `Number` primitive or object. * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified - * as numbers, use the `_.isFinite` method. + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isNumber(3); diff --git a/tools/eslint/node_modules/lodash/isObject.js b/tools/eslint/node_modules/lodash/isObject.js index 41993db213eb69..d16542f8bf3830 100644 --- a/tools/eslint/node_modules/lodash/isObject.js +++ b/tools/eslint/node_modules/lodash/isObject.js @@ -1,9 +1,11 @@ /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. diff --git a/tools/eslint/node_modules/lodash/isObjectLike.js b/tools/eslint/node_modules/lodash/isObjectLike.js index 240167ad811f34..e34114be54058c 100644 --- a/tools/eslint/node_modules/lodash/isObjectLike.js +++ b/tools/eslint/node_modules/lodash/isObjectLike.js @@ -4,6 +4,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. diff --git a/tools/eslint/node_modules/lodash/isPlainObject.js b/tools/eslint/node_modules/lodash/isPlainObject.js index 1d68332c04813e..13a90e7d03a842 100644 --- a/tools/eslint/node_modules/lodash/isPlainObject.js +++ b/tools/eslint/node_modules/lodash/isPlainObject.js @@ -1,4 +1,5 @@ -var isHostObject = require('./_isHostObject'), +var getPrototype = require('./_getPrototype'), + isHostObject = require('./_isHostObject'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ @@ -10,27 +11,30 @@ var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = Function.prototype.toString; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** Built-in value references. */ -var getPrototypeOf = Object.getPrototypeOf; - /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ + * @since 0.8.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @returns {boolean} Returns `true` if `value` is a plain object, + * else `false`. * @example * * function Foo() { @@ -50,17 +54,15 @@ var getPrototypeOf = Object.getPrototypeOf; * // => true */ function isPlainObject(value) { - if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) { + if (!isObjectLike(value) || + objectToString.call(value) != objectTag || isHostObject(value)) { return false; } - var proto = objectProto; - if (typeof value.constructor == 'function') { - proto = getPrototypeOf(value); - } + var proto = getPrototype(value); if (proto === null) { return true; } - var Ctor = proto.constructor; + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return (typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString); } diff --git a/tools/eslint/node_modules/lodash/isRegExp.js b/tools/eslint/node_modules/lodash/isRegExp.js index e127e5aae8c0d7..8eeb4103ec9fc8 100644 --- a/tools/eslint/node_modules/lodash/isRegExp.js +++ b/tools/eslint/node_modules/lodash/isRegExp.js @@ -7,7 +7,8 @@ var regexpTag = '[object RegExp]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -17,9 +18,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isRegExp(/abc/); diff --git a/tools/eslint/node_modules/lodash/isSafeInteger.js b/tools/eslint/node_modules/lodash/isSafeInteger.js index f601243fee2e25..a780afb6b64196 100644 --- a/tools/eslint/node_modules/lodash/isSafeInteger.js +++ b/tools/eslint/node_modules/lodash/isSafeInteger.js @@ -7,13 +7,16 @@ var MAX_SAFE_INTEGER = 9007199254740991; * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 * double precision number which isn't the result of a rounded unsafe integer. * - * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @returns {boolean} Returns `true` if `value` is a safe integer, + * else `false`. * @example * * _.isSafeInteger(3); diff --git a/tools/eslint/node_modules/lodash/isSet.js b/tools/eslint/node_modules/lodash/isSet.js index e1d50be9044c2a..9030dc44e031cd 100644 --- a/tools/eslint/node_modules/lodash/isSet.js +++ b/tools/eslint/node_modules/lodash/isSet.js @@ -9,9 +9,11 @@ var setTag = '[object Set]'; * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isSet(new Set); diff --git a/tools/eslint/node_modules/lodash/isString.js b/tools/eslint/node_modules/lodash/isString.js index 5ed392e4060e17..573de3b53cfa1b 100644 --- a/tools/eslint/node_modules/lodash/isString.js +++ b/tools/eslint/node_modules/lodash/isString.js @@ -8,7 +8,8 @@ var stringTag = '[object String]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -17,10 +18,12 @@ var objectToString = objectProto.toString; * Checks if `value` is classified as a `String` primitive or object. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isString('abc'); diff --git a/tools/eslint/node_modules/lodash/isSymbol.js b/tools/eslint/node_modules/lodash/isSymbol.js index 5e11a00d3c8522..21dd55927d3e54 100644 --- a/tools/eslint/node_modules/lodash/isSymbol.js +++ b/tools/eslint/node_modules/lodash/isSymbol.js @@ -7,7 +7,8 @@ var symbolTag = '[object Symbol]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -17,9 +18,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isSymbol(Symbol.iterator); diff --git a/tools/eslint/node_modules/lodash/isTypedArray.js b/tools/eslint/node_modules/lodash/isTypedArray.js index 9e9b0a274c8fde..0d86b90cb6e020 100644 --- a/tools/eslint/node_modules/lodash/isTypedArray.js +++ b/tools/eslint/node_modules/lodash/isTypedArray.js @@ -17,6 +17,7 @@ var argsTag = '[object Arguments]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', @@ -36,17 +37,19 @@ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dateTag] = typedArrayTags[errorTag] = -typedArrayTags[funcTag] = typedArrayTags[mapTag] = -typedArrayTags[numberTag] = typedArrayTags[objectTag] = -typedArrayTags[regexpTag] = typedArrayTags[setTag] = -typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; /** Used for built-in method references. */ var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -56,9 +59,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isTypedArray(new Uint8Array); @@ -68,7 +73,8 @@ var objectToString = objectProto.toString; * // => false */ function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } module.exports = isTypedArray; diff --git a/tools/eslint/node_modules/lodash/isUndefined.js b/tools/eslint/node_modules/lodash/isUndefined.js index d64e560c66abd1..377d121ab8e93d 100644 --- a/tools/eslint/node_modules/lodash/isUndefined.js +++ b/tools/eslint/node_modules/lodash/isUndefined.js @@ -2,6 +2,7 @@ * Checks if `value` is `undefined`. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. diff --git a/tools/eslint/node_modules/lodash/isWeakMap.js b/tools/eslint/node_modules/lodash/isWeakMap.js index d934a9f5e64615..cd7b9ed81d9853 100644 --- a/tools/eslint/node_modules/lodash/isWeakMap.js +++ b/tools/eslint/node_modules/lodash/isWeakMap.js @@ -9,9 +9,11 @@ var weakMapTag = '[object WeakMap]'; * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isWeakMap(new WeakMap); diff --git a/tools/eslint/node_modules/lodash/isWeakSet.js b/tools/eslint/node_modules/lodash/isWeakSet.js index 40674f480c8ed8..5395797ae6c2e6 100644 --- a/tools/eslint/node_modules/lodash/isWeakSet.js +++ b/tools/eslint/node_modules/lodash/isWeakSet.js @@ -7,7 +7,8 @@ var weakSetTag = '[object WeakSet]'; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -17,9 +18,11 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isWeakSet(new WeakSet); diff --git a/tools/eslint/node_modules/lodash/iteratee.js b/tools/eslint/node_modules/lodash/iteratee.js index c761adbbc5a21c..8ec05887671d0b 100644 --- a/tools/eslint/node_modules/lodash/iteratee.js +++ b/tools/eslint/node_modules/lodash/iteratee.js @@ -3,11 +3,13 @@ var baseClone = require('./_baseClone'), /** * Creates a function that invokes `func` with the arguments of the created - * function. If `func` is a property name the created callback returns the - * property value for a given element. If `func` is an object the created - * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * function. If `func` is a property name, the created function returns the + * property value for a given element. If `func` is an array or object, the + * created function returns `true` for elements that contain the equivalent + * source properties, otherwise it returns `false`. * * @static + * @since 4.0.0 * @memberOf _ * @category Util * @param {*} [func=_.identity] The value to convert to a callback. @@ -15,20 +17,31 @@ var baseClone = require('./_baseClone'), * @example * * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } * ]; * + * // The `_.matches` iteratee shorthand. + * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); + * // => [{ 'user': 'barney', 'age': 36, 'active': true }] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, _.iteratee(['user', 'fred'])); + * // => [{ 'user': 'fred', 'age': 40 }] + * + * // The `_.property` iteratee shorthand. + * _.map(users, _.iteratee('user')); + * // => ['barney', 'fred'] + * * // Create custom iteratee shorthands. - * _.iteratee = _.wrap(_.iteratee, function(callback, func) { - * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); - * return !p ? callback(func) : function(object) { - * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { + * return !_.isRegExp(func) ? iteratee(func) : function(string) { + * return func.test(string); * }; * }); * - * _.filter(users, 'age > 36'); - * // => [{ 'user': 'fred', 'age': 40 }] + * _.filter(['abc', 'def'], /ef/); + * // => ['def'] */ function iteratee(func) { return baseIteratee(typeof func == 'function' ? func : baseClone(func, true)); diff --git a/tools/eslint/node_modules/lodash/join.js b/tools/eslint/node_modules/lodash/join.js index 79d308d2812f91..fe31067664ac8a 100644 --- a/tools/eslint/node_modules/lodash/join.js +++ b/tools/eslint/node_modules/lodash/join.js @@ -9,6 +9,7 @@ var nativeJoin = arrayProto.join; * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to convert. * @param {string} [separator=','] The element separator. diff --git a/tools/eslint/node_modules/lodash/kebabCase.js b/tools/eslint/node_modules/lodash/kebabCase.js index f29124fb2b7d21..8a52be64555638 100644 --- a/tools/eslint/node_modules/lodash/kebabCase.js +++ b/tools/eslint/node_modules/lodash/kebabCase.js @@ -1,10 +1,12 @@ var createCompounder = require('./_createCompounder'); /** - * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. @@ -16,7 +18,7 @@ var createCompounder = require('./_createCompounder'); * _.kebabCase('fooBar'); * // => 'foo-bar' * - * _.kebabCase('__foo_bar__'); + * _.kebabCase('__FOO_BAR__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { diff --git a/tools/eslint/node_modules/lodash/keyBy.js b/tools/eslint/node_modules/lodash/keyBy.js index febc86b4b45afe..97e6f4b38e2461 100644 --- a/tools/eslint/node_modules/lodash/keyBy.js +++ b/tools/eslint/node_modules/lodash/keyBy.js @@ -2,15 +2,17 @@ var createAggregator = require('./_createAggregator'); /** * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is the last element responsible for generating the key. The + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * diff --git a/tools/eslint/node_modules/lodash/keys.js b/tools/eslint/node_modules/lodash/keys.js index eac239f5c88e4f..186a4fedd0a256 100644 --- a/tools/eslint/node_modules/lodash/keys.js +++ b/tools/eslint/node_modules/lodash/keys.js @@ -13,6 +13,7 @@ var baseHas = require('./_baseHas'), * for more details. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. diff --git a/tools/eslint/node_modules/lodash/keysIn.js b/tools/eslint/node_modules/lodash/keysIn.js index e327b874d9167d..d2fb91cb32b1e9 100644 --- a/tools/eslint/node_modules/lodash/keysIn.js +++ b/tools/eslint/node_modules/lodash/keysIn.js @@ -16,6 +16,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; * * @static * @memberOf _ + * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. diff --git a/tools/eslint/node_modules/lodash/lang.js b/tools/eslint/node_modules/lodash/lang.js index d3be68f06d2616..665f5c66ceade1 100644 --- a/tools/eslint/node_modules/lodash/lang.js +++ b/tools/eslint/node_modules/lodash/lang.js @@ -1,4 +1,5 @@ module.exports = { + 'castArray': require('./castArray'), 'clone': require('./clone'), 'cloneDeep': require('./cloneDeep'), 'cloneDeepWith': require('./cloneDeepWith'), diff --git a/tools/eslint/node_modules/lodash/last.js b/tools/eslint/node_modules/lodash/last.js index 299af3146ca232..6402a4c33a7b2e 100644 --- a/tools/eslint/node_modules/lodash/last.js +++ b/tools/eslint/node_modules/lodash/last.js @@ -3,6 +3,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. diff --git a/tools/eslint/node_modules/lodash/lastIndexOf.js b/tools/eslint/node_modules/lodash/lastIndexOf.js index 1eb2f2836faf08..7e9d988e5e93be 100644 --- a/tools/eslint/node_modules/lodash/lastIndexOf.js +++ b/tools/eslint/node_modules/lodash/lastIndexOf.js @@ -11,6 +11,7 @@ var nativeMax = Math.max, * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. @@ -33,7 +34,11 @@ function lastIndexOf(array, value, fromIndex) { var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); - index = (index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)) + 1; + index = ( + index < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1) + ) + 1; } if (value !== value) { return indexOfNaN(array, index, true); diff --git a/tools/eslint/node_modules/lodash/lodash.js b/tools/eslint/node_modules/lodash/lodash.js index d314acd0976e00..0e359de50b206c 100644 --- a/tools/eslint/node_modules/lodash/lodash.js +++ b/tools/eslint/node_modules/lodash/lodash.js @@ -1,11 +1,11 @@ /** * @license - * lodash 4.3.0 (Custom Build) + * lodash 4.9.0 (Custom Build) * Build: `lodash -d -o ./foo/lodash.js` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ ;(function() { @@ -13,7 +13,19 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.3.0'; + var VERSION = '4.9.0'; + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** Used as the `TypeError` message for "Functions" methods. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -39,20 +51,11 @@ var HOT_COUNT = 150, HOT_SPAN = 16; - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - /** Used to indicate the type of lazy iteratees. */ var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; - /** Used as the `TypeError` message for "Functions" methods. */ - var FUNC_ERROR_TEXT = 'Expected a function'; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, @@ -64,9 +67,6 @@ MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', @@ -78,6 +78,7 @@ mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', + promiseTag = '[object Promise]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', @@ -86,6 +87,7 @@ weakSetTag = '[object WeakSet]'; var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', @@ -117,7 +119,10 @@ reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); @@ -129,7 +134,10 @@ /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; - /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ + /** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). + */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ @@ -144,7 +152,7 @@ /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; - /** Used to detect host constructors (Safari > 5). */ + /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect octal string values. */ @@ -228,15 +236,15 @@ ].join('|'), 'g'); /** Used to detect strings that need a more robust regexp to match words. */ - var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** Used to assign default `context` object properties. */ var contextProps = [ - 'Array', 'Buffer', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', - 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', - 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + 'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', + 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', + '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ @@ -251,25 +259,26 @@ typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dateTag] = typedArrayTags[errorTag] = - typedArrayTags[funcTag] = typedArrayTags[mapTag] = - typedArrayTags[numberTag] = typedArrayTags[objectTag] = - typedArrayTags[regexpTag] = typedArrayTags[setTag] = - typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = - cloneableTags[dateTag] = cloneableTags[float32Tag] = - cloneableTags[float64Tag] = cloneableTags[int8Tag] = - cloneableTags[int16Tag] = cloneableTags[int32Tag] = - cloneableTags[mapTag] = cloneableTags[numberTag] = - cloneableTags[objectTag] = cloneableTags[regexpTag] = - cloneableTags[setTag] = cloneableTags[stringTag] = - cloneableTags[symbolTag] = cloneableTags[uint8Tag] = - cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = - cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; @@ -335,10 +344,19 @@ freeParseInt = parseInt; /** Detect free variable `exports`. */ - var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; + var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; /** Detect free variable `module`. */ - var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; + var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = (freeModule && freeModule.exports === freeExports) + ? freeExports + : undefined; /** Detect free variable `global` from Node.js. */ var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); @@ -349,9 +367,6 @@ /** Detect free variable `window`. */ var freeWindow = checkGlobal(objectTypes[typeof window] && window); - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; - /** Detect `this` as the global object. */ var thisGlobal = checkGlobal(objectTypes[typeof this] && this); @@ -361,7 +376,9 @@ * The `this` value is used if it's the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ - var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); + var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ @@ -374,6 +391,7 @@ * @returns {Object} Returns `map`. */ function addMapEntry(map, pair) { + // Don't return `Map#set` because it doesn't return the map instance in IE 11. map.set(pair[0], pair[1]); return map; } @@ -398,7 +416,7 @@ * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. - * @param {...*} args The arguments to invoke `func` with. + * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { @@ -505,7 +523,8 @@ * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. */ function arrayEvery(array, predicate) { var index = -1, @@ -531,13 +550,13 @@ function arrayFilter(array, predicate) { var index = -1, length = array.length, - resIndex = -1, + resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { - result[++resIndex] = value; + result[resIndex++] = value; } } return result; @@ -557,8 +576,7 @@ } /** - * A specialized version of `_.includesWith` for arrays without support for - * specifying an index to search from. + * This function is like `arrayIncludes` except that it accepts a comparator. * * @private * @param {Array} array The array to search. @@ -625,7 +643,8 @@ * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { @@ -649,7 +668,8 @@ * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as the initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { @@ -670,7 +690,8 @@ * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ function arraySome(array, predicate) { var index = -1, @@ -722,7 +743,8 @@ * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. + * @param {boolean} [retKey] Specify returning the key of the found element + * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { @@ -782,6 +804,42 @@ return -1; } + /** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ + function baseMean(array, iteratee) { + var length = array ? array.length : 0; + return length ? (baseSum(array, iteratee) / length) : NAN; + } + /** * The base implementation of `_.reduce` and `_.reduceRight`, without support * for iteratee shorthands, which iterates over `collection` using `eachFunc`. @@ -790,7 +848,8 @@ * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ @@ -804,9 +863,9 @@ } /** - * The base implementation of `_.sortBy` which uses `comparer` to define - * the sort order of `array` and replaces criteria objects with their - * corresponding values. + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. * * @private * @param {Array} array The array to sort. @@ -824,7 +883,8 @@ } /** - * The base implementation of `_.sum` without support for iteratee shorthands. + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. @@ -1021,10 +1081,53 @@ // for more details. // // This also ensures a stable sort in V8 and other engines. - // See https://code.google.com/p/v8/issues/detail?id=90 for more details. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } + /** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ + function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; + } + + /** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new mathematical operation function. + */ + function createMathOperation(operator) { + return function(value, other) { + var result; + if (value === undefined && other === undefined) { + return 0; + } + if (value !== undefined) { + result = value; + } + if (other !== undefined) { + result = result === undefined ? other : operator(result, other); + } + return result; + }; + } + /** * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. * @@ -1159,13 +1262,14 @@ function replaceHolders(array, placeholder) { var index = -1, length = array.length, - resIndex = -1, + resIndex = 0, result = []; while (++index < length) { - if (array[index] === placeholder) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { array[index] = PLACEHOLDER; - result[++resIndex] = index; + result[resIndex++] = index; } } return result; @@ -1235,6 +1339,7 @@ * * @static * @memberOf _ + * @since 1.1.0 * @category Util * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. @@ -1292,7 +1397,8 @@ var objectCtorString = funcToString.call(Object); /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -1313,9 +1419,9 @@ Uint8Array = context.Uint8Array, clearTimeout = context.clearTimeout, enumerate = Reflect ? Reflect.enumerate : undefined, - getPrototypeOf = Object.getPrototypeOf, getOwnPropertySymbols = Object.getOwnPropertySymbols, iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined, + objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, setTimeout = context.setTimeout, splice = arrayProto.splice; @@ -1323,6 +1429,7 @@ /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeFloor = Math.floor, + nativeGetPrototype = Object.getPrototypeOf, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = Object.keys, @@ -1333,7 +1440,9 @@ nativeReverse = arrayProto.reverse; /* Built-in method references that are verified to be native. */ - var Map = getNative(context, 'Map'), + var DataView = getNative(context, 'DataView'), + Map = getNative(context, 'Map'), + Promise = getNative(context, 'Promise'), Set = getNative(context, 'Set'), WeakMap = getNative(context, 'WeakMap'), nativeCreate = getNative(Object, 'create'); @@ -1341,42 +1450,47 @@ /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; + /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ + var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); + + /** Used to lookup unminified function names. */ + var realNames = {}; + /** Used to detect maps, sets, and weakmaps. */ - var mapCtorString = Map ? funcToString.call(Map) : '', - setCtorString = Set ? funcToString.call(Set) : '', - weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = Symbol ? symbolProto.valueOf : undefined, - symbolToString = Symbol ? symbolProto.toString : undefined; - - /** Used to lookup unminified function names. */ - var realNames = {}; + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps `value` to enable implicit method - * chaining. Methods that operate on and return arrays, collections, and - * functions can be chained together. Methods that retrieve a single value or - * may return a primitive value will automatically end the chain sequence and - * return the unwrapped value. Otherwise, the value must be unwrapped with - * `_#value`. + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. * - * Explicit chaining, which must be unwrapped with `_#value` in all cases, - * may be enabled using `_.chain`. + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. * * The execution of chained methods is lazy, that is, it's deferred until * `_#value` is implicitly or explicitly called. * - * Lazy evaluation allows several methods to support shortcut fusion. Shortcut - * fusion is an optimization to merge iteratee calls; this avoids the creation - * of intermediate arrays and can greatly reduce the number of iteratee executions. - * Sections of a chain sequence qualify for shortcut fusion if the section is - * applied to an array of at least two hundred elements and any iteratees - * accept only one argument. The heuristic for whether a section qualifies - * for shortcut fusion is subject to change. + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array of at least `200` elements + * and any iteratees accept only one argument. The heuristic for whether a + * section qualifies for shortcut fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. @@ -1395,51 +1509,55 @@ * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` * * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, - * `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`, - * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, - * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, - * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, - * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`, - * `flowRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, - * `intersection`, `intersectionBy`, `intersectionWith`, `invert`, `invertBy`, - * `invokeMap`, `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, - * `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, - * `method`, `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, - * `orderBy`, `over`, `overArgs`, `overEvery`, `overSome`, `partial`, - * `partialRight`, `partition`, `pick`, `pickBy`, `plant`, `property`, - * `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, - * `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`, `sampleSize`, - * `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, - * `thru`, `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, - * `transform`, `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, - * `uniqWith`, `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, - * `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`, - * `zipObjectDeep`, and `zipWith` + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` * * The wrapper methods that are **not** chainable by default are: * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, - * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, - * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`, + * `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`, + * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`, + * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`, + * `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`, + * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`, - * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, `isMatchWith`, - * `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`, - * `isPlainObject`, `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`, - * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, - * `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`, + * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`, + * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, + * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, + * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, + * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, + * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, * `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`, * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, - * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toLower`, - * `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, - * `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, - * `upperCase`, `upperFirst`, `value`, and `words` + * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`, + * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`, + * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, + * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` * * @name _ * @constructor @@ -1480,7 +1598,7 @@ } /** - * The function whose prototype all chaining wrappers inherit from. + * The function whose prototype chain sequence wrappers inherit from. * * @private */ @@ -1493,7 +1611,7 @@ * * @private * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable chaining for all wrapper methods. + * @param {boolean} [chainAll] Enable explicit method chain sequences. */ function LodashWrapper(value, chainAll) { this.__wrapped__ = value; @@ -1510,7 +1628,7 @@ * * @static * @memberOf _ - * @type Object + * @type {Object} */ lodash.templateSettings = { @@ -1518,7 +1636,7 @@ * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings - * @type RegExp + * @type {RegExp} */ 'escape': reEscape, @@ -1526,7 +1644,7 @@ * Used to detect code to be evaluated. * * @memberOf _.templateSettings - * @type RegExp + * @type {RegExp} */ 'evaluate': reEvaluate, @@ -1534,7 +1652,7 @@ * Used to detect `data` property values to inject. * * @memberOf _.templateSettings - * @type RegExp + * @type {RegExp} */ 'interpolate': reInterpolate, @@ -1542,7 +1660,7 @@ * Used to reference the data object in the template text. * * @memberOf _.templateSettings - * @type string + * @type {string} */ 'variable': '', @@ -1550,7 +1668,7 @@ * Used to import variables into the compiled template. * * @memberOf _.templateSettings - * @type Object + * @type {Object} */ 'imports': { @@ -1558,18 +1676,26 @@ * A reference to the `lodash` function. * * @memberOf _.templateSettings.imports - * @type Function + * @type {Function} */ '_': lodash } }; + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + /*------------------------------------------------------------------------*/ /** * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private + * @constructor * @param {*} value The value to wrap. */ function LazyWrapper(value) { @@ -1645,7 +1771,8 @@ resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); - if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { + if (!isArr || arrLength < LARGE_ARRAY_SIZE || + (arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; @@ -1678,12 +1805,17 @@ return result; } + // Ensure `LazyWrapper` is an instance of `baseLodash`. + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; + /*------------------------------------------------------------------------*/ /** - * Creates an hash object. + * Creates a hash object. * * @private + * @constructor * @returns {Object} Returns the new hash object. */ function Hash() {} @@ -1740,12 +1872,16 @@ hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; } + // Avoid inheriting from `Object.prototype` when possible. + Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; + /*------------------------------------------------------------------------*/ /** * Creates a map cache object to store key-value pairs. * * @private + * @constructor * @param {Array} [values] The values to cache. */ function MapCache(values) { @@ -1767,7 +1903,11 @@ * @memberOf MapCache */ function mapClear() { - this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash }; + this.__data__ = { + 'hash': new Hash, + 'map': Map ? new Map : [], + 'string': new Hash + }; } /** @@ -1829,7 +1969,7 @@ * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. - * @returns {Object} Returns the map cache object. + * @returns {Object} Returns the map cache instance. */ function mapSet(key, value) { var data = this.__data__; @@ -1843,6 +1983,13 @@ return this; } + // Add methods to `MapCache`. + MapCache.prototype.clear = mapClear; + MapCache.prototype['delete'] = mapDelete; + MapCache.prototype.get = mapGet; + MapCache.prototype.has = mapHas; + MapCache.prototype.set = mapSet; + /*------------------------------------------------------------------------*/ /** @@ -1850,6 +1997,7 @@ * Creates a set cache object to store unique values. * * @private + * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { @@ -1902,12 +2050,16 @@ } } + // Add methods to `SetCache`. + SetCache.prototype.push = cachePush; + /*------------------------------------------------------------------------*/ /** * Creates a stack cache object to store key-value pairs. * * @private + * @constructor * @param {Array} [values] The values to cache. */ function Stack(values) { @@ -1988,7 +2140,7 @@ * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. - * @returns {Object} Returns the stack cache object. + * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__, @@ -2009,13 +2161,20 @@ return this; } + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + /*------------------------------------------------------------------------*/ /** * Removes `key` and its value from the associative array. * * @private - * @param {Array} array The array to query. + * @param {Array} array The array to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ @@ -2059,8 +2218,7 @@ } /** - * Gets the index at which the first occurrence of `key` is found in `array` - * of key-value pairs. + * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to search. @@ -2115,7 +2273,8 @@ } /** - * This function is like `assignValue` except that it doesn't assign `undefined` values. + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. * * @private * @param {Object} object The object to modify. @@ -2141,8 +2300,7 @@ */ function assignValue(object, key, value) { var objValue = object[key]; - if ((!eq(objValue, value) || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) || + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { object[key] = value; } @@ -2199,6 +2357,50 @@ return result; } + /** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ + function baseCastArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + + /** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ + function baseCastFunction(value) { + return typeof value == 'function' ? value : identity; + } + + /** + * Casts `value` to a string if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the cast key. + */ + function baseCastKey(key) { + return (typeof key == 'string' || isSymbol(key)) ? key : (key + ''); + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ + function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); + } + /** * The base implementation of `_.clamp` which doesn't coerce arguments to numbers. * @@ -2227,13 +2429,14 @@ * @private * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. + * @param {boolean} [isFull] Specify a clone including symbols. * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ - function baseClone(value, isDeep, customizer, key, object, stack) { + function baseClone(value, isDeep, isFull, customizer, key, object, stack) { var result; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); @@ -2266,9 +2469,10 @@ return copySymbols(value, baseAssign(result, value)); } } else { - return cloneableTags[tag] - ? initCloneByTag(value, tag, isDeep) - : (object ? value : {}); + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, baseClone, isDeep); } } // Check for circular references and return its corresponding clone. @@ -2279,11 +2483,18 @@ } stack.set(value, result); + if (!isArr) { + var props = isFull ? getAllKeys(value) : keys(value); + } // Recursively populate clone (susceptible to call stack limits). - (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { - assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack)); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); }); - return isArr ? result : copySymbols(value, result); + return result; } /** @@ -2307,7 +2518,8 @@ predicate = source[key], value = object[key]; - if ((value === undefined && !(key in Object(object))) || !predicate(value)) { + if ((value === undefined && + !(key in Object(object))) || !predicate(value)) { return false; } } @@ -2323,17 +2535,9 @@ * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ - var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; - }()); + function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; + } /** * The base implementation of `_.delay` and `_.defer` which accepts an array @@ -2353,8 +2557,8 @@ } /** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. @@ -2433,7 +2637,8 @@ * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` */ function baseEvery(collection, predicate) { var result = true; @@ -2495,24 +2700,25 @@ * * @private * @param {Array} array The array to flatten. - * @param {boolean} [isDeep] Specify a deep flatten. - * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ - function baseFlatten(array, isDeep, isStrict, result) { - result || (result = []); - + function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; + predicate || (predicate = isFlattenable); + result || (result = []); + while (++index < length) { var value = array[index]; - if (isArrayLikeObject(value) && - (isStrict || isArray(value) || isArguments(value))) { - if (isDeep) { + if (depth > 0 && predicate(value)) { + if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, isDeep, isStrict, result); + baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } @@ -2524,10 +2730,9 @@ } /** - * The base implementation of `baseForIn` and `baseForOwn` which iterates - * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iteratee functions may exit iteration early by explicitly - * returning `false`. + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` invoking `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. @@ -2549,18 +2754,6 @@ */ var baseForRight = createBaseFor(true); - /** - * The base implementation of `_.forIn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForIn(object, iteratee) { - return object == null ? object : baseFor(object, iteratee, keysIn); - } - /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * @@ -2609,7 +2802,7 @@ * @returns {*} Returns the resolved value. */ function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = 0, length = path.length; @@ -2620,6 +2813,24 @@ return (index && index == length) ? object : undefined; } + /** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) + ? result + : arrayPush(result, symbolsFunc(object)); + } + /** * The base implementation of `_.has` without support for deep paths. * @@ -2633,7 +2844,7 @@ // that are composed entirely of index properties, return `false` for // `hasOwnProperty` checks of them. return hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototypeOf(object) === null); + (typeof object == 'object' && key in object && getPrototype(object) === null); } /** @@ -2673,9 +2884,11 @@ */ function baseIntersection(arrays, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), + maxLength = Infinity, result = []; while (othIndex--) { @@ -2683,26 +2896,32 @@ if (othIndex && iteratee) { array = arrayMap(array, baseUnary(iteratee)); } - caches[othIndex] = !comparator && (iteratee || array.length >= 120) + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) ? new SetCache(othIndex && array) : undefined; } array = arrays[0]; var index = -1, - length = array.length, seen = caches[0]; outer: - while (++index < length) { + while (++index < length && result.length < maxLength) { var value = array[index], computed = iteratee ? iteratee(value) : value; - if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) { - var othIndex = othLength; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; - if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) { + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { continue outer; } } @@ -2745,7 +2964,7 @@ */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); path = last(path); } @@ -2788,7 +3007,8 @@ * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` + * for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ @@ -2800,41 +3020,39 @@ if (!objIsArr) { objTag = getTag(object); - if (objTag == argsTag) { - objTag = objectTag; - } else if (objTag != objectTag) { - objIsArr = isTypedArray(object); - } + objTag = objTag == argsTag ? objectTag : objTag; } if (!othIsArr) { othTag = getTag(other); - if (othTag == argsTag) { - othTag = objectTag; - } else if (othTag != objectTag) { - othIsArr = isTypedArray(other); - } + othTag = othTag == argsTag ? objectTag : othTag; } var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) + : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); } - var isPartial = bitmask & PARTIAL_COMPARE_FLAG; - if (!isPartial) { + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); - return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); + return equalObjects(object, other, equalFunc, customizer, bitmask, stack); } /** @@ -2876,9 +3094,10 @@ return false; } } else { - var stack = new Stack, - result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; - + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result @@ -2898,14 +3117,15 @@ * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { return value; } if (value == null) { return identity; } - if (type == 'object') { + if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); @@ -2918,7 +3138,6 @@ * property of prototypes or treat sparse arrays as dense. * * @private - * @type Function * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ @@ -2979,16 +3198,7 @@ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; + return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); @@ -3004,6 +3214,9 @@ * @returns {Function} Returns the new function. */ function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(path, srcValue); + } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) @@ -3020,13 +3233,16 @@ * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } - var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); + if (!(isArray(source) || isTypedArray(source))) { + var props = keysIn(source); + } arrayEach(props || source, function(srcValue, key) { if (props) { key = srcValue; @@ -3037,7 +3253,10 @@ baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { - var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; + var newValue = customizer + ? customizer(object[key], srcValue, (key + ''), object, source, stack) + : undefined; + if (newValue === undefined) { newValue = srcValue; } @@ -3058,7 +3277,8 @@ * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = object[key], @@ -3069,21 +3289,24 @@ assignMergeValue(object, key, stacked); return; } - var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined, - isCommon = newValue === undefined; + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; if (isCommon) { newValue = srcValue; if (isArray(srcValue) || isTypedArray(srcValue)) { if (isArray(objValue)) { - newValue = srcIndex ? copyArray(objValue) : objValue; + newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { @@ -3092,10 +3315,10 @@ } else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } else { - newValue = srcIndex ? baseClone(objValue) : objValue; + newValue = objValue; } } else { @@ -3108,6 +3331,7 @@ // Recursively merge objects and arrays (susceptible to call stack limits). mergeFunc(newValue, srcValue, srcIndex, customizer, stack); } + stack['delete'](srcValue); assignMergeValue(object, key, newValue); } @@ -3121,12 +3345,8 @@ * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { - var index = -1, - toIteratee = getIteratee(); - - iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) { - return toIteratee(iteratee); - }); + var index = -1; + iteratees = arrayMap(iteratees.length ? iteratees : [identity], getIteratee()); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { @@ -3142,11 +3362,11 @@ /** * The base implementation of `_.pick` without support for individual - * property names. + * property identifiers. * * @private * @param {Object} object The source object. - * @param {string[]} props The property names to pick. + * @param {string[]} props The property identifiers to pick. * @returns {Object} Returns the new object. */ function basePick(object, props) { @@ -3168,12 +3388,19 @@ * @returns {Object} Returns the new object. */ function basePickBy(object, predicate) { - var result = {}; - baseForIn(object, function(value, key) { + var index = -1, + props = getAllKeysIn(object), + length = props.length, + result = {}; + + while (++index < length) { + var key = props[index], + value = object[key]; + if (predicate(value, key)) { result[key] = value; } - }); + } return result; } @@ -3203,18 +3430,6 @@ }; } - /** - * The base implementation of `_.pullAll`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - */ - function basePullAll(array, values) { - return basePullAllBy(array, values); - } - /** * The base implementation of `_.pullAllBy` without support for iteratee * shorthands. @@ -3223,22 +3438,24 @@ * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns `array`. */ - function basePullAllBy(array, values, iteratee) { - var index = -1, + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, length = values.length, seen = array; if (iteratee) { - seen = arrayMap(array, function(value) { return iteratee(value); }); + seen = arrayMap(array, baseUnary(iteratee)); } while (++index < length) { var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; - while ((fromIndex = baseIndexOf(seen, computed, fromIndex)) > -1) { + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } @@ -3269,7 +3486,7 @@ splice.call(array, index, 1); } else if (!isKey(index, array)) { - var path = baseToPath(index), + var path = baseCastPath(index), object = parent(array, path); if (object != null) { @@ -3320,6 +3537,34 @@ return result; } + /** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; + } + /** * The base implementation of `_.set`. * @@ -3331,7 +3576,7 @@ * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = -1, length = path.length, @@ -3346,7 +3591,9 @@ var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { - newValue = objValue == null ? (isIndex(path[index + 1]) ? [] : {}) : objValue; + newValue = objValue == null + ? (isIndex(path[index + 1]) ? [] : {}) + : objValue; } } assignValue(nested, key, newValue); @@ -3405,7 +3652,8 @@ * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ function baseSome(collection, predicate) { var result; @@ -3459,7 +3707,8 @@ * @param {*} value The value to evaluate. * @param {Function} iteratee The iteratee invoked per element. * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { value = iteratee(value); @@ -3522,7 +3771,7 @@ value = array[0], computed = iteratee ? iteratee(value) : value, seen = computed, - resIndex = 0, + resIndex = 1, result = [value]; while (++index < length) { @@ -3531,24 +3780,12 @@ if (!eq(computed, seen)) { seen = computed; - result[++resIndex] = value; + result[resIndex++] = value; } } return result; } - /** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ - function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); - } - /** * The base implementation of `_.uniqBy` without support for iteratee shorthands. * @@ -3618,12 +3855,26 @@ * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ function baseUnset(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); object = parent(object, path); var key = last(path); return (object != null && has(object, key)) ? delete object[key] : true; } + /** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); + } + /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` * without support for iteratee shorthands. @@ -3696,7 +3947,7 @@ * This base implementation of `_.zipObject` which assigns values using `assignFunc`. * * @private - * @param {Array} props The property names. + * @param {Array} props The property identifiers. * @param {Array} values The property values. * @param {Function} assignFunc The function to assign values. * @returns {Object} Returns the new object. @@ -3708,7 +3959,8 @@ result = {}; while (++index < length) { - assignFunc(result, props[index], index < valsLength ? values[index] : undefined); + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); } return result; } @@ -3725,9 +3977,7 @@ if (isDeep) { return buffer.slice(); } - var Ctor = buffer.constructor, - result = new Ctor(buffer.length); - + var result = new buffer.constructor(buffer.length); buffer.copy(result); return result; } @@ -3740,24 +3990,36 @@ * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { - var Ctor = arrayBuffer.constructor, - result = new Ctor(arrayBuffer.byteLength), - view = new Uint8Array(result); - - view.set(new Uint8Array(arrayBuffer)); + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + /** * Creates a clone of `map`. * * @private * @param {Object} map The map to clone. + * @param {Function} cloneFunc The function to clone values. + * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned map. */ - function cloneMap(map) { - var Ctor = map.constructor; - return arrayReduce(mapToArray(map), addMapEntry, new Ctor); + function cloneMap(map, isDeep, cloneFunc) { + var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map); + return arrayReduce(array, addMapEntry, new map.constructor); } /** @@ -3768,9 +4030,7 @@ * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { - var Ctor = regexp.constructor, - result = new Ctor(regexp.source, reFlags.exec(regexp)); - + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } @@ -3780,11 +4040,13 @@ * * @private * @param {Object} set The set to clone. + * @param {Function} cloneFunc The function to clone values. + * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned set. */ - function cloneSet(set) { - var Ctor = set.constructor; - return arrayReduce(setToArray(set), addSetEntry, new Ctor); + function cloneSet(set, isDeep, cloneFunc) { + var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set); + return arrayReduce(array, addSetEntry, new set.constructor); } /** @@ -3795,7 +4057,7 @@ * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { - return Symbol ? Object(symbolValueOf.call(symbol)) : {}; + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; } /** @@ -3807,10 +4069,8 @@ * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, - Ctor = typedArray.constructor; - - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -3821,23 +4081,28 @@ * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ - function composeArgs(args, partials, holders) { - var holdersLength = holders.length, - argsIndex = -1, - argsLength = nativeMax(args.length - holdersLength, 0), + function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, - result = Array(leftLength + argsLength); + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { - result[holders[argsIndex]] = args[argsIndex]; + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } } - while (argsLength--) { + while (rangeLength--) { result[leftIndex++] = args[argsIndex++]; } return result; @@ -3851,18 +4116,21 @@ * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ - function composeArgsRight(args, partials, holders) { - var holdersIndex = -1, + function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, holdersLength = holders.length, - argsIndex = -1, - argsLength = nativeMax(args.length - holdersLength, 0), rightIndex = -1, rightLength = partials.length, - result = Array(argsLength + rightLength); + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; - while (++argsIndex < argsLength) { + while (++argsIndex < rangeLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; @@ -3870,7 +4138,9 @@ result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } } return result; } @@ -3899,7 +4169,7 @@ * * @private * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. + * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @returns {Object} Returns `object`. */ @@ -3913,7 +4183,7 @@ * * @private * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. + * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. @@ -3925,8 +4195,11 @@ length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -3976,7 +4249,10 @@ customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; - customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; + customizer = typeof customizer == 'function' + ? (length--, customizer) + : undefined; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; @@ -4022,7 +4298,7 @@ } /** - * Creates a base function for methods like `_.forIn`. + * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. @@ -4051,7 +4327,8 @@ * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new wrapped function. */ @@ -4077,8 +4354,11 @@ return function(string) { string = toString(string); - var strSymbols = reHasComplexSymbol.test(string) ? stringToArray(string) : undefined, - chr = strSymbols ? strSymbols[0] : string.charAt(0), + var strSymbols = reHasComplexSymbol.test(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols ? strSymbols[0] : string.charAt(0), trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); return chr[methodName]() + trailing; @@ -4108,8 +4388,8 @@ */ function createCtorWrapper(Ctor) { return function() { - // Use a `switch` statement to work with class constructors. - // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; switch (args.length) { @@ -4136,7 +4416,8 @@ * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {number} arity The arity of `func`. * @returns {Function} Returns the new wrapped function. */ @@ -4145,10 +4426,9 @@ function wrapper() { var length = arguments.length, - index = length, args = Array(length), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, - placeholder = lodash.placeholder || wrapper.placeholder; + index = length, + placeholder = getPlaceholder(wrapper); while (index--) { args[index] = arguments[index]; @@ -4158,9 +4438,13 @@ : replaceHolders(args, placeholder); length -= holders.length; - return length < arity - ? createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, undefined, args, holders, undefined, undefined, arity - length) - : apply(fn, this, args); + if (length < arity) { + return createRecurryWrapper( + func, bitmask, createHybridWrapper, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); } return wrapper; } @@ -4174,7 +4458,7 @@ */ function createFlow(fromRight) { return rest(function(funcs) { - funcs = baseFlatten(funcs); + funcs = baseFlatten(funcs, 1); var length = funcs.length, index = length, @@ -4199,17 +4483,23 @@ var funcName = getFuncName(func), data = funcName == 'wrapper' ? getData(func) : undefined; - if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { + if (data && isLaziable(data[0]) && + data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { - wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; - if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { + if (wrapper && args.length == 1 && + isArray(value) && value.length >= LARGE_ARRAY_SIZE) { return wrapper.plant(value).value(); } var index = 0, @@ -4229,11 +4519,14 @@ * * @private * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to the new function. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided to the new function. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. @@ -4244,8 +4537,7 @@ var isAry = bitmask & ARY_FLAG, isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, - isCurry = bitmask & CURRY_FLAG, - isCurryRight = bitmask & CURRY_RIGHT_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), isFlip = bitmask & FLIP_FLAG, Ctor = isBindKey ? undefined : createCtorWrapper(func); @@ -4257,30 +4549,34 @@ while (index--) { args[index] = arguments[index]; } + if (isCurried) { + var placeholder = getPlaceholder(wrapper), + holdersCount = countHolders(args, placeholder); + } if (partials) { - args = composeArgs(args, partials, holders); + args = composeArgs(args, partials, holders, isCurried); } if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight); + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); } - if (isCurry || isCurryRight) { - var placeholder = lodash.placeholder || wrapper.placeholder, - argsHolders = replaceHolders(args, placeholder); - - length -= argsHolders.length; - if (length < arity) { - return createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, thisArg, args, argsHolders, argPos, ary, arity - length); - } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurryWrapper( + func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; + length = args.length; if (argPos) { args = reorder(args, argPos); - } else if (isFlip && args.length > 1) { + } else if (isFlip && length > 1) { args.reverse(); } - if (isAry && ary < args.length) { + if (isAry && ary < length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { @@ -4314,7 +4610,7 @@ */ function createOver(arrayFunc) { return rest(function(iteratees) { - iteratees = arrayMap(baseFlatten(iteratees), getIteratee()); + iteratees = arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), getIteratee()); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { @@ -4329,37 +4625,34 @@ * is truncated if the number of characters exceeds `length`. * * @private - * @param {string} string The string to create padding for. - * @param {number} [length=0] The padding length. + * @param {number} length The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padding for `string`. */ - function createPadding(string, length, chars) { - length = toInteger(length); - - var strLength = stringSize(string); - if (!length || strLength >= length) { - return ''; - } - var padLength = length - strLength; + function createPadding(length, chars) { chars = chars === undefined ? ' ' : (chars + ''); - var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); return reHasComplexSymbol.test(chars) - ? stringToArray(result).slice(0, padLength).join('') - : result.slice(0, padLength); + ? stringToArray(result).slice(0, length).join('') + : result.slice(0, length); } /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg` and the `partials` prepended to those provided to - * the wrapper. + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to the new function. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. * @returns {Function} Returns the new wrapped function. */ function createPartialWrapper(func, bitmask, thisArg, partials) { @@ -4416,11 +4709,13 @@ * * @private * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. + * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` + * for more details. * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder to replace. + * @param {*} placeholder The placeholder value. * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to the new function. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. @@ -4430,7 +4725,7 @@ function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & CURRY_FLAG, newArgPos = argPos ? copyArray(argPos) : undefined, - newsHolders = isCurry ? holders : undefined, + newHolders = isCurry ? holders : undefined, newHoldersRight = isCurry ? undefined : holders, newPartials = isCurry ? partials : undefined, newPartialsRight = isCurry ? undefined : partials; @@ -4441,9 +4736,12 @@ if (!(bitmask & CURRY_BOUND_FLAG)) { bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); } - var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity], - result = wrapFunc.apply(undefined, newData); + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, newArgPos, ary, arity + ]; + var result = wrapFunc.apply(undefined, newData); if (isLaziable(func)) { setData(result, newData); } @@ -4532,8 +4830,12 @@ partials = holders = undefined; } - var data = isBindKey ? undefined : getData(func), - newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; + var data = isBindKey ? undefined : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; if (data) { mergeData(newData, data); @@ -4571,9 +4873,10 @@ * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `array` and `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { @@ -4614,12 +4917,16 @@ // Recursively compare arrays (susceptible to call stack limits). if (isUnordered) { if (!arraySome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); + return arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack); })) { result = false; break; } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack) + )) { result = false; break; } @@ -4640,12 +4947,22 @@ * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ - function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { + function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { @@ -4655,8 +4972,9 @@ case boolTag: case dateTag: - // Coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + // Coerce dates and booleans to numbers, dates to milliseconds and + // booleans to `1` or `0` treating invalid dates coerced to `NaN` as + // not equal. return +object == +other; case errorTag: @@ -4668,8 +4986,9 @@ case regexpTag: case stringTag: - // Coerce regexes to strings and treat strings primitives and string - // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring + // for more details. return object == (other + ''); case mapTag: @@ -4679,12 +4998,24 @@ var isPartial = bitmask & PARTIAL_COMPARE_FLAG; convert || (convert = setToArray); + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= UNORDERED_COMPARE_FLAG; + stack.set(object, other); + // Recursively compare objects (susceptible to call stack limits). - return (isPartial || object.size == other.size) && - equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); + return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); case symbolTag: - return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } } return false; } @@ -4697,9 +5028,10 @@ * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { @@ -4764,6 +5096,29 @@ return result; } + /** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); + } + + /** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); + } + /** * Gets metadata for `func`. * @@ -4798,10 +5153,10 @@ } /** - * Gets the appropriate "iteratee" function. If the `_.iteratee` method is - * customized this function returns the custom method, otherwise it returns - * `baseIteratee`. If arguments are provided the chosen function is invoked - * with them and its result is returned. + * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, + * this function returns the custom method, otherwise it returns `baseIteratee`. + * If arguments are provided, the chosen function is invoked with them and + * its result is returned. * * @private * @param {*} [value] The value to convert to an iteratee. @@ -4817,8 +5172,9 @@ /** * Gets the "length" property value of `object`. * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. @@ -4852,19 +5208,68 @@ * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object == null ? undefined : object[key]; + var value = object[key]; return isNative(value) ? value : undefined; } /** - * Creates an array of the own symbol properties of `object`. + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ + function getPlaceholder(func) { + var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; + return object.placeholder; + } + + /** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ + function getPrototype(value) { + return nativeGetPrototype(Object(value)); + } + + /** + * Creates an array of the own enumerable symbol properties of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + function getSymbols(object) { + // Coerce `object` to an object to avoid non-object errors in V8. + // See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details. + return getOwnPropertySymbols(Object(object)); + } + + // Fallback for IE < 11. + if (!getOwnPropertySymbols) { + getSymbols = function() { + return []; + }; + } + + /** + * Creates an array of the own and inherited enumerable symbol properties + * of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ - var getSymbols = getOwnPropertySymbols || function() { - return []; + var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; }; /** @@ -4878,18 +5283,23 @@ return objectToString.call(value); } - // Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps. - if ((Map && getTag(new Map) != mapTag) || + // Fallback for data views, maps, sets, and weak maps in IE 11, + // for data views in Edge, and promises in Node.js. + if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = objectToString.call(value), - Ctor = result == objectTag ? value.constructor : null, - ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : undefined; if (ctorString) { switch (ctorString) { + case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } @@ -4936,23 +5346,25 @@ * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { - if (object == null) { - return false; - } - var result = hasFunc(object, path); - if (!result && !isKey(path)) { - path = baseToPath(path); - object = parent(object, path); - if (object != null) { - path = last(path); - result = hasFunc(object, path); + path = isKey(path, object) ? [path] : baseCastPath(path); + + var result, + index = -1, + length = path.length; + + while (++index < length) { + var key = path[index]; + if (!(result = object != null && hasFunc(object, key))) { + break; } + object = object[key]; } - var length = object ? object.length : undefined; - return result || ( - !!length && isLength(length) && isIndex(path, length) && - (isArray(object) || isString(object) || isArguments(object)) - ); + if (result) { + return result; + } + var length = object ? object.length : 0; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isString(object) || isArguments(object)); } /** @@ -4982,11 +5394,9 @@ * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { - if (isPrototype(object)) { - return {}; - } - var Ctor = object.constructor; - return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4998,10 +5408,11 @@ * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. + * @param {Function} cloneFunc The function to clone values. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ - function initCloneByTag(object, tag, isDeep) { + function initCloneByTag(object, tag, cloneFunc, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: @@ -5011,13 +5422,16 @@ case dateTag: return new Ctor(+object); + case dataViewTag: + return cloneDataView(object, isDeep); + case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: - return cloneMap(object); + return cloneMap(object, isDeep, cloneFunc); case numberTag: case stringTag: @@ -5027,7 +5441,7 @@ return cloneRegExp(object); case setTag: - return cloneSet(object); + return cloneSet(object, isDeep, cloneFunc); case symbolTag: return cloneSymbol(object); @@ -5051,6 +5465,29 @@ return null; } + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArrayLikeObject(value) && (isArray(value) || isArguments(value)); + } + + /** + * Checks if `value` is a flattenable array and not a `_.matchesProperty` + * iteratee shorthand. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenableIteratee(value) { + return isArray(value) && !(value.length == 2 && !isFunction(value[0])); + } + /** * Checks if the given arguments are from an iteratee call. * @@ -5058,7 +5495,8 @@ * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { @@ -5066,8 +5504,9 @@ } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object)) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5082,11 +5521,12 @@ * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } @@ -5100,7 +5540,7 @@ function isKeyable(value) { var type = typeof value; return type == 'number' || type == 'boolean' || - (type == 'string' && value !== '__proto__') || value == null; + (type == 'string' && value != '__proto__') || value == null; } /** @@ -5108,7 +5548,8 @@ * * @private * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. */ function isLaziable(func) { var funcName = getFuncName(func), @@ -5150,15 +5591,35 @@ return value === value && !isObject(value); } + /** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new function. + */ + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; + } + /** * Merges the function metadata of `source` into `data`. * * Merging metadata reduces the number of wrappers used to invoke a function. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` - * modify function arguments, making the order in which they are executed important, - * preventing the merging of metadata. However, we make an exception for a safe - * combined case where curried functions have `_.ary` and or `_.rearg` applied. + * may be applied regardless of execution order. Methods like `_.ary` and + * `_.rearg` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined case where curried functions have `_.ary` + * and or `_.rearg` applied. * * @private * @param {Array} data The destination metadata. @@ -5172,9 +5633,9 @@ isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG); var isCombo = - (srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) || - (srcBitmask == ARY_FLAG && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || - (srcBitmask == (ARY_FLAG | REARG_FLAG) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); + ((srcBitmask == ARY_FLAG) && (bitmask == CURRY_FLAG)) || + ((srcBitmask == ARY_FLAG) && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (ARY_FLAG | REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5184,7 +5645,7 @@ if (srcBitmask & BIND_FLAG) { data[2] = source[2]; // Set when currying a bound function. - newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG; + newBitmask |= bitmask & BIND_FLAG ? 0 : CURRY_BOUND_FLAG; } // Compose partial arguments. var value = source[3]; @@ -5229,13 +5690,13 @@ * @param {string} key The key of the property to merge. * @param {Object} object The parent object of `objValue`. * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged counterparts. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. * @returns {*} Returns the value to assign. */ function mergeDefaults(objValue, srcValue, key, object, source, stack) { if (isObject(objValue) && isObject(srcValue)) { - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, mergeDefaults, stack); + baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue)); } return objValue; } @@ -5249,7 +5710,7 @@ * @returns {*} Returns the parent value. */ function parent(object, path) { - return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); + return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); } /** @@ -5278,8 +5739,9 @@ * Sets metadata for `func`. * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity function - * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) + * period of time, it will trip its breaker and transition to an identity + * function to avoid garbage collection pauses in V8. See + * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) * for more details. * * @private @@ -5314,34 +5776,31 @@ * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ - function stringToPath(string) { + var stringToPath = memoize(function(string) { var result = []; toString(string).replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; - } - - /** - * Converts `value` to an array-like object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the array-like object. - */ - function toArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; - } + }); /** - * Converts `value` to a function if it's not one. + * Converts `func` to its source code. * * @private - * @param {*} value The value to process. - * @returns {Function} Returns the function. + * @param {Function} func The function to process. + * @returns {string} Returns the source code. */ - function toFunction(value) { - return typeof value == 'function' ? value : identity; + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; } /** @@ -5371,9 +5830,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to process. - * @param {number} [size=0] The length of each chunk. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the new array containing chunks. * @example * @@ -5383,19 +5844,22 @@ * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ - function chunk(array, size) { - size = nativeMax(toInteger(size), 0); - + function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } var length = array ? array.length : 0; if (!length || size < 1) { return []; } var index = 0, - resIndex = -1, + resIndex = 0, result = Array(nativeCeil(length / size)); while (index < length) { - result[++resIndex] = baseSlice(array, index, (index += size)); + result[resIndex++] = baseSlice(array, index, (index += size)); } return result; } @@ -5406,6 +5870,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the new array of filtered values. @@ -5417,13 +5882,13 @@ function compact(array) { var index = -1, length = array ? array.length : 0, - resIndex = -1, + resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value) { - result[++resIndex] = value; + result[resIndex++] = value; } } return result; @@ -5435,6 +5900,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. @@ -5450,21 +5916,29 @@ * console.log(array); * // => [1] */ - var concat = rest(function(array, values) { - if (!isArray(array)) { - array = array == null ? [] : [Object(array)]; + function concat() { + var length = arguments.length, + array = castArray(arguments[0]); + + if (length < 2) { + return length ? copyArray(array) : []; } - values = baseFlatten(values); - return arrayConcat(array, values); - }); + var args = Array(length - 1); + while (length--) { + args[length - 1] = arguments[length]; + } + return arrayConcat(array, baseFlatten(args, 1)); + } /** - * Creates an array of unique `array` values not included in the other - * given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. + * Creates an array of unique `array` values not included in the other given + * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. The order of result values is determined by the + * order they occur in the first array. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. @@ -5476,21 +5950,24 @@ */ var difference = rest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true)) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; }); /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * by which they're compared. Result values are chosen from the first array. + * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * @@ -5507,17 +5984,19 @@ iteratee = undefined; } return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true), getIteratee(iteratee)) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee)) : []; }); /** * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The comparator - * is invoked with two arguments: (arrVal, othVal). + * which is invoked to compare elements of `array` to `values`. Result values + * are chosen from the first array. The comparator is invoked with two arguments: + * (arrVal, othVal). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. @@ -5536,7 +6015,7 @@ comparator = undefined; } return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true), undefined, comparator) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) : []; }); @@ -5545,10 +6024,11 @@ * * @static * @memberOf _ + * @since 0.5.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * @@ -5578,10 +6058,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * @@ -5614,9 +6095,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * @@ -5654,9 +6137,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * @@ -5695,6 +6180,7 @@ * * @static * @memberOf _ + * @since 3.2.0 * @category Array * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. @@ -5733,9 +6219,11 @@ * * @static * @memberOf _ + * @since 1.1.0 * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * @@ -5772,9 +6260,11 @@ * * @static * @memberOf _ + * @since 2.0.0 * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {number} Returns the index of the found element, else `-1`. * @example * @@ -5806,39 +6296,70 @@ } /** - * Flattens `array` a single level. + * Flattens `array` a single level deep. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * - * _.flatten([1, [2, 3, [4]]]); - * // => [1, 2, 3, [4]] + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] */ function flatten(array) { var length = array ? array.length : 0; - return length ? baseFlatten(array) : []; + return length ? baseFlatten(array, 1) : []; } /** - * This method is like `_.flatten` except that it recursively flattens `array`. + * Recursively flattens `array`. * * @static * @memberOf _ + * @since 3.0.0 * @category Array - * @param {Array} array The array to recursively flatten. + * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * - * _.flattenDeep([1, [2, 3, [4]]]); - * // => [1, 2, 3, 4] + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] */ function flattenDeep(array) { var length = array ? array.length : 0; - return length ? baseFlatten(array, true) : []; + return length ? baseFlatten(array, INFINITY) : []; + } + + /** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ + function flattenDepth(array, depth) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(array, depth); } /** @@ -5847,6 +6368,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. @@ -5872,6 +6394,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @alias first * @category Array * @param {Array} array The array to query. @@ -5891,11 +6414,12 @@ /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `array`. + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. @@ -5927,6 +6451,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. @@ -5942,20 +6467,22 @@ /** * Creates an array of unique values that are included in all given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. + * for equality comparisons. The order of result values is determined by the + * order they occur in the first array. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of shared values. + * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersection([2, 1], [4, 2], [1, 2]); * // => [2] */ var intersection = rest(function(arrays) { - var mapped = arrayMap(arrays, toArrayLikeObject); + var mapped = arrayMap(arrays, baseCastArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) : []; @@ -5964,14 +6491,17 @@ /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * by which they're compared. Result values are chosen from the first array. + * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of shared values. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); @@ -5983,7 +6513,7 @@ */ var intersectionBy = rest(function(arrays) { var iteratee = last(arrays), - mapped = arrayMap(arrays, toArrayLikeObject); + mapped = arrayMap(arrays, baseCastArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined; @@ -5997,15 +6527,17 @@ /** * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The comparator is invoked - * with two arguments: (arrVal, othVal). + * which is invoked to compare elements of `arrays`. Result values are chosen + * from the first array. The comparator is invoked with two arguments: + * (arrVal, othVal). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. + * @returns {Array} Returns the new array of intersecting values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; @@ -6016,7 +6548,7 @@ */ var intersectionWith = rest(function(arrays) { var comparator = last(arrays), - mapped = arrayMap(arrays, toArrayLikeObject); + mapped = arrayMap(arrays, baseCastArrayLikeObject); if (comparator === last(mapped)) { comparator = undefined; @@ -6033,6 +6565,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to convert. * @param {string} [separator=','] The element separator. @@ -6051,6 +6584,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. @@ -6070,6 +6604,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. @@ -6092,7 +6627,11 @@ var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); - index = (index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)) + 1; + index = ( + index < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1) + ) + 1; } if (value !== value) { return indexOfNaN(array, index, true); @@ -6110,10 +6649,12 @@ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * - * **Note:** Unlike `_.without`, this method mutates `array`. + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. * * @static * @memberOf _ + * @since 2.0.0 * @category Array * @param {Array} array The array to modify. * @param {...*} [values] The values to remove. @@ -6135,6 +6676,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. @@ -6156,16 +6698,18 @@ /** * This method is like `_.pullAll` except that it accepts `iteratee` which is * invoked for each element of `array` and `values` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * by which they're compared. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns `array`. * @example * @@ -6177,7 +6721,36 @@ */ function pullAllBy(array, values, iteratee) { return (array && array.length && values && values.length) - ? basePullAllBy(array, values, getIteratee(iteratee)) + ? basePullAll(array, values, getIteratee(iteratee)) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `comparator` which + * is invoked to compare elements of `array` to `values`. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + function pullAllWith(array, values, comparator) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, undefined, comparator) : array; } @@ -6189,6 +6762,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove, @@ -6206,7 +6780,7 @@ * // => [10, 20] */ var pullAt = rest(function(array, indexes) { - indexes = arrayMap(baseFlatten(indexes), String); + indexes = arrayMap(baseFlatten(indexes, 1), String); var result = baseAt(array, indexes); basePullAt(array, indexes.sort(compareAscending)); @@ -6215,16 +6789,19 @@ /** * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked with - * three arguments: (value, index, array). + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). * - * **Note:** Unlike `_.filter`, this method mutates `array`. + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. * * @static * @memberOf _ + * @since 2.0.0 * @category Array * @param {Array} array The array to modify. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new array of removed elements. * @example * @@ -6269,7 +6846,9 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array + * @param {Array} array The array to modify. * @returns {Array} Returns `array`. * @example * @@ -6288,11 +6867,13 @@ /** * Creates a slice of `array` from `start` up to, but not including, `end`. * - * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice) - * to ensure dense arrays are returned. + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. @@ -6316,15 +6897,17 @@ } /** - * Uses a binary search to determine the lowest index at which `value` should - * be inserted into `array` in order to maintain its sort order. + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * _.sortedIndex([30, 50], 40); @@ -6344,11 +6927,14 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; @@ -6370,6 +6956,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. @@ -6397,10 +6984,12 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * _.sortedLastIndex([4, 5], 4); @@ -6417,11 +7006,14 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * // The `_.property` iteratee shorthand. @@ -6438,6 +7030,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. @@ -6464,6 +7057,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. @@ -6484,6 +7078,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. @@ -6504,6 +7099,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. @@ -6521,10 +7117,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * @@ -6553,10 +7150,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * @@ -6584,14 +7182,16 @@ /** * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with three - * arguments: (value, index, array). + * taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * @@ -6629,9 +7229,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * @@ -6669,6 +7271,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. @@ -6678,19 +7281,22 @@ * // => [2, 1, 4] */ var union = rest(function(arrays) { - return baseUniq(baseFlatten(arrays, false, true)); + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); }); /** * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). + * invoked for each element of each `arrays` to generate the criterion by + * which uniqueness is computed. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new array of combined values. * @example * @@ -6706,7 +7312,7 @@ if (isArrayLikeObject(iteratee)) { iteratee = undefined; } - return baseUniq(baseFlatten(arrays, false, true), getIteratee(iteratee)); + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee)); }); /** @@ -6716,6 +7322,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. @@ -6733,17 +7340,18 @@ if (isArrayLikeObject(comparator)) { comparator = undefined; } - return baseUniq(baseFlatten(arrays, false, true), undefined, comparator); + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); }); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. + * for equality comparisons, in which only the first occurrence of each + * element is kept. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. @@ -6765,9 +7373,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * @@ -6791,6 +7401,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [comparator] The comparator invoked per element. @@ -6815,6 +7426,7 @@ * * @static * @memberOf _ + * @since 1.2.0 * @category Array * @param {Array} array The array of grouped elements to process. * @returns {Array} Returns the new array of regrouped elements. @@ -6849,9 +7461,11 @@ * * @static * @memberOf _ + * @since 3.8.0 * @category Array * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine regrouped values. + * @param {Function} [iteratee=_.identity] The function to combine + * regrouped values. * @returns {Array} Returns the new array of regrouped elements. * @example * @@ -6881,6 +7495,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to filter. * @param {...*} [values] The values to exclude. @@ -6897,11 +7512,14 @@ }); /** - * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the given arrays. + * Creates an array of unique values that is the + * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the given arrays. The order of result values is determined by the order + * they occur in the arrays. * * @static * @memberOf _ + * @since 2.4.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of values. @@ -6916,14 +7534,17 @@ /** * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). + * invoked for each element of each `arrays` to generate the criterion by + * which by which they're compared. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new array of values. * @example * @@ -6949,6 +7570,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. @@ -6970,12 +7592,13 @@ }); /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second elements - * of the given arrays, and so on. + * Creates an array of grouped elements, the first of which contains the + * first elements of the given arrays, the second of which contains the + * second elements of the given arrays, and so on. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @returns {Array} Returns the new array of grouped elements. @@ -6988,12 +7611,13 @@ /** * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property names and one of corresponding values. + * one of property identifiers and one of corresponding values. * * @static * @memberOf _ + * @since 0.4.0 * @category Array - * @param {Array} [props=[]] The property names. + * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example @@ -7010,8 +7634,9 @@ * * @static * @memberOf _ + * @since 4.1.0 * @category Array - * @param {Array} [props=[]] The property names. + * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example @@ -7030,6 +7655,7 @@ * * @static * @memberOf _ + * @since 3.8.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @param {Function} [iteratee=_.identity] The function to combine grouped values. @@ -7052,11 +7678,13 @@ /*------------------------------------------------------------------------*/ /** - * Creates a `lodash` object that wraps `value` with explicit method chaining enabled. - * The result of such method chaining must be unwrapped with `_#value`. + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. * * @static * @memberOf _ + * @since 1.3.0 * @category Seq * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` wrapper instance. @@ -7087,10 +7715,11 @@ /** * This method invokes `interceptor` and returns `value`. The interceptor * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain in order to modify intermediate results. + * "tap into" a method chain sequence in order to modify intermediate results. * * @static * @memberOf _ + * @since 0.1.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. @@ -7114,10 +7743,11 @@ /** * This method is like `_.tap` except that it returns the result of `interceptor`. * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain. + * results in a method chain sequence. * * @static * @memberOf _ + * @since 3.0.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. @@ -7142,6 +7772,7 @@ * * @name at * @memberOf _ + * @since 1.0.0 * @category Seq * @param {...(string|string[])} [paths] The property paths of elements to pick, * specified individually or in arrays. @@ -7157,17 +7788,22 @@ * // => ['a', 'c'] */ var wrapperAt = rest(function(paths) { - paths = baseFlatten(paths); + paths = baseFlatten(paths, 1); var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; - if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { + if (length > 1 || this.__actions__.length || + !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); + value.__actions__.push({ + 'func': thru, + 'args': [interceptor], + 'thisArg': undefined + }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined); @@ -7177,10 +7813,11 @@ }); /** - * Enables explicit method chaining on the wrapper object. + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. * * @name chain * @memberOf _ + * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example @@ -7207,10 +7844,11 @@ } /** - * Executes the chained sequence and returns the wrapped result. + * Executes the chain sequence and returns the wrapped result. * * @name commit * @memberOf _ + * @since 3.2.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example @@ -7235,33 +7873,13 @@ return new LodashWrapper(this.value(), this.__chain__); } - /** - * This method is the wrapper version of `_.flatMap`. - * - * @name flatMap - * @memberOf _ - * @category Seq - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _([1, 2]).flatMap(duplicate).value(); - * // => [1, 1, 2, 2] - */ - function wrapperFlatMap(iteratee) { - return this.map(iteratee).flatten(); - } - /** * Gets the next value on a wrapped object following the * [iterator protocol](https://mdn.io/iteration_protocols#iterator). * * @name next * @memberOf _ + * @since 4.0.0 * @category Seq * @returns {Object} Returns the next iterator value. * @example @@ -7292,6 +7910,7 @@ * * @name Symbol.iterator * @memberOf _ + * @since 4.0.0 * @category Seq * @returns {Object} Returns the wrapper object. * @example @@ -7309,10 +7928,11 @@ } /** - * Creates a clone of the chained sequence planting `value` as the wrapped value. + * Creates a clone of the chain sequence planting `value` as the wrapped value. * * @name plant * @memberOf _ + * @since 3.2.0 * @category Seq * @param {*} value The value to plant. * @returns {Object} Returns the new `lodash` wrapper instance. @@ -7358,6 +7978,7 @@ * * @name reverse * @memberOf _ + * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example @@ -7378,17 +7999,22 @@ wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); - wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined }); + wrapped.__actions__.push({ + 'func': thru, + 'args': [reverse], + 'thisArg': undefined + }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); } /** - * Executes the chained sequence to extract the unwrapped value. + * Executes the chain sequence to resolve the unwrapped value. * * @name value * @memberOf _ + * @since 0.1.0 * @alias toJSON, valueOf * @category Seq * @returns {*} Returns the resolved unwrapped value. @@ -7405,15 +8031,17 @@ /** * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is the number of times the key was returned by `iteratee`. - * The iteratee is invoked with one argument: (value). + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the number of times the key was returned by `iteratee`. The + * iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 0.5.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * @@ -7434,19 +8062,22 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false } + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * // The `_.matches` iteratee shorthand. @@ -7471,14 +8102,16 @@ /** * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * @@ -7509,14 +8142,16 @@ /** * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three arguments: - * (value, index|key, collection). + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -7556,9 +8191,11 @@ * * @static * @memberOf _ + * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -7577,15 +8214,17 @@ } /** - * Creates an array of flattened values by running each element in `collection` - * through `iteratee` and concating its result to the other mapped values. - * The iteratee is invoked with three arguments: (value, index|key, collection). + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * @@ -7597,7 +8236,59 @@ * // => [1, 1, 2, 2] */ function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee)); + return baseFlatten(map(collection, iteratee), 1); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); } /** @@ -7605,12 +8296,13 @@ * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * - * **Note:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` - * for object iteration. + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. * * @static * @memberOf _ + * @since 0.1.0 * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. @@ -7621,17 +8313,17 @@ * _([1, 2]).forEach(function(value) { * console.log(value); * }); - * // => logs `1` then `2` + * // => Logs `1` then `2`. * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEach(collection, iteratee) - : baseEach(collection, toFunction(iteratee)); + : baseEach(collection, getIteratee(iteratee)); } /** @@ -7640,6 +8332,7 @@ * * @static * @memberOf _ + * @since 2.0.0 * @alias eachRight * @category Collection * @param {Array|Object} collection The collection to iterate over. @@ -7650,25 +8343,28 @@ * _.forEachRight([1, 2], function(value) { * console.log(value); * }); - * // => logs `2` then `1` + * // => Logs `2` then `1`. */ function forEachRight(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEachRight(collection, iteratee) - : baseEachRight(collection, toFunction(iteratee)); + : baseEachRight(collection, getIteratee(iteratee)); } /** * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is an array of elements responsible for generating the key. - * The iteratee is invoked with one argument: (value). + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * @@ -7688,18 +8384,20 @@ }); /** - * Checks if `value` is in `collection`. If `collection` is a string it's checked - * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * is used for equality comparisons. If `fromIndex` is negative, it's used as * the offset from the end of `collection`. * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {boolean} Returns `true` if `value` is found, else `false`. * @example * @@ -7731,11 +8429,12 @@ /** * Invokes the method at `path` of each element in `collection`, returning * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `methodName` is a function it's - * invoked for, and `this` bound to, each element in `collection`. + * are provided to each invoked method. If `methodName` is a function, it's + * invoked for and `this` bound to, each element in `collection`. * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array|Function|string} path The path of the method to invoke or @@ -7765,15 +8464,17 @@ /** * Creates an object composed of keys generated from the results of running - * each element of `collection` through `iteratee`. The corresponding value - * of each key is the last element responsible for generating the key. The + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * @@ -7795,7 +8496,7 @@ }); /** - * Creates an array of values by running each element in `collection` through + * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * @@ -7803,16 +8504,18 @@ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: - * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, - * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, - * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, - * and `words` + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `take`, `takeRight`, `template`, + * `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * @@ -7848,24 +8551,26 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. + * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] + * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 42 }, + * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { @@ -7889,9 +8594,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the array of grouped elements. * @example * @@ -7922,9 +8629,9 @@ /** * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` through `iteratee`, where each successive + * each element in `collection` thru `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` - * is not given the first element of `collection` is used as the initial + * is not given, the first element of `collection` is used as the initial * value. The iteratee is invoked with four arguments: * (accumulator, value, index|key, collection). * @@ -7937,6 +8644,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -7968,6 +8676,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -7995,9 +8704,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * @@ -8034,6 +8745,7 @@ * * @static * @memberOf _ + * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. @@ -8055,9 +8767,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. - * @param {number} [n=0] The number of elements to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the random elements. * @example * @@ -8067,13 +8781,17 @@ * _.sampleSize([1, 2, 3], 4); * // => [2, 3, 1] */ - function sampleSize(collection, n) { + function sampleSize(collection, n, guard) { var index = -1, result = toArray(collection), length = result.length, lastIndex = length - 1; - n = baseClamp(toInteger(n), 0, length); + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { + n = 1; + } else { + n = baseClamp(toInteger(n), 0, length); + } while (++index < n) { var rand = baseRandom(index, lastIndex), value = result[rand]; @@ -8091,6 +8809,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. @@ -8105,10 +8824,11 @@ /** * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable properties for objects. + * values or the number of own enumerable string keyed properties for objects. * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to inspect. * @returns {number} Returns the collection size. @@ -8131,6 +8851,12 @@ var result = collection.length; return (result && isString(collection)) ? stringSize(collection) : result; } + if (isObjectLike(collection)) { + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + } return keys(collection).length; } @@ -8141,11 +8867,14 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); @@ -8178,36 +8907,38 @@ /** * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through each iteratee. This method + * running each element in a collection thru each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] - * The iteratees to sort by, specified individually or in arrays. + * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])} + * [iteratees=[_.identity]] The iteratees to sort by, specified individually + * or in arrays. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 42 }, + * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, function(o) { return o.user; }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] * * _.sortBy(users, 'user', function(o) { * return Math.floor(o.age / 10); * }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ var sortBy = rest(function(collection, iteratees) { if (collection == null) { @@ -8219,7 +8950,7 @@ } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees.length = 1; } - return baseOrderBy(collection, baseFlatten(iteratees), []); + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); /*------------------------------------------------------------------------*/ @@ -8230,7 +8961,8 @@ * * @static * @memberOf _ - * @type Function + * @since 2.4.0 + * @type {Function} * @category Date * @returns {number} Returns the timestamp. * @example @@ -8238,7 +8970,7 @@ * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); - * // => logs the number of milliseconds it took for the deferred function to be invoked + * // => Logs the number of milliseconds it took for the deferred function to be invoked. */ var now = Date.now; @@ -8250,6 +8982,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {number} n The number of calls before `func` is invoked. * @param {Function} func The function to restrict. @@ -8265,7 +8998,7 @@ * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); - * // => logs 'done saving!' after the two async saves have completed + * // => Logs 'done saving!' after the two async saves have completed. */ function after(n, func) { if (typeof func != 'function') { @@ -8280,15 +9013,16 @@ } /** - * Creates a function that accepts up to `n` arguments, ignoring any - * additional arguments. + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new function. * @example * @@ -8308,6 +9042,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. @@ -8336,8 +9071,7 @@ /** * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and prepends any additional `_.bind` arguments to those provided to the - * bound function. + * and `partials` prepended to the arguments it receives. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. @@ -8347,6 +9081,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. @@ -8372,21 +9107,19 @@ var bind = rest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { - var placeholder = lodash.placeholder || bind.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(bind)); bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); }); /** - * Creates a function that invokes the method at `object[key]` and prepends - * any additional `_.bindKey` arguments to those provided to the bound function. + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. * * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. - * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * methods that may be redefined or don't yet exist. See + * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic @@ -8394,6 +9127,7 @@ * * @static * @memberOf _ + * @since 0.10.0 * @category Function * @param {Object} object The object to invoke the method on. * @param {string} key The key of the method. @@ -8427,9 +9161,7 @@ var bindKey = rest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { - var placeholder = lodash.placeholder || bindKey.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(bindKey)); bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); @@ -8449,10 +9181,11 @@ * * @static * @memberOf _ + * @since 2.0.0 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new curried function. * @example * @@ -8478,7 +9211,7 @@ function curry(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = lodash.placeholder || curry.placeholder; + result.placeholder = curry.placeholder; return result; } @@ -8493,10 +9226,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new curried function. * @example * @@ -8522,7 +9256,7 @@ function curryRight(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = lodash.placeholder || curryRight.placeholder; + result.placeholder = curryRight.placeholder; return result; } @@ -8540,21 +9274,22 @@ * on the trailing edge of the timeout only if the debounced function is * invoked more than once during the `wait` timeout. * - * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=false] Specify invoking on the leading - * edge of the timeout. - * @param {number} [options.maxWait] The maximum time `func` is allowed to be - * delayed before it's invoked. - * @param {boolean} [options.trailing=true] Specify invoking on the trailing - * edge of the timeout. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * @@ -8576,14 +9311,12 @@ * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { - var args, - maxTimeoutId, + var lastArgs, + lastThis, result, - stamp, - thisArg, - timeoutId, - trailingCall, - lastCalled = 0, + timerId, + lastCallTime = 0, + lastInvokeTime = 0, leading = false, maxWait = false, trailing = true; @@ -8598,90 +9331,94 @@ trailing = 'trailing' in options ? !!options.trailing : trailing; } - function cancel() { - if (timeoutId) { - clearTimeout(timeoutId); - } - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - lastCalled = 0; - args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined; + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; } - function complete(isCalled, id) { - if (id) { - clearTimeout(id); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = undefined; - } - } + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; } - function delayed() { - var remaining = wait - (now() - stamp); - if (remaining <= 0 || remaining > wait) { - complete(trailingCall, maxTimeoutId); - } else { - timeoutId = setTimeout(delayed, remaining); + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + result = wait - timeSinceLastCall; + + return maxWait === false ? result : nativeMin(result, maxWait - timeSinceLastInvoke); + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (!lastCallTime || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); } - function flush() { - if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) { - result = func.apply(thisArg, args); + function trailingEdge(time) { + clearTimeout(timerId); + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); } - cancel(); + lastArgs = lastThis = undefined; return result; } - function maxDelayed() { - complete(trailing, timeoutId); + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastCallTime = lastInvokeTime = 0; + lastArgs = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); } function debounced() { - args = arguments; - stamp = now(); - thisArg = this; - trailingCall = trailing && (timeoutId || !leading); + var time = now(), + isInvoking = shouldInvoke(time); - if (maxWait === false) { - var leadingCall = leading && !timeoutId; - } else { - if (!lastCalled && !maxTimeoutId && !leading) { - lastCalled = stamp; - } - var remaining = maxWait - (stamp - lastCalled), - isCalled = remaining <= 0 || remaining > maxWait; + lastArgs = arguments; + lastThis = this; + lastCallTime = time; - if (isCalled) { - if (maxTimeoutId) { - maxTimeoutId = clearTimeout(maxTimeoutId); - } - lastCalled = stamp; - result = func.apply(thisArg, args); + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); } - else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(maxDelayed, remaining); - } - } - if (isCalled && timeoutId) { - timeoutId = clearTimeout(timeoutId); - } - else if (!timeoutId && wait !== maxWait) { - timeoutId = setTimeout(delayed, wait); - } - if (leadingCall) { - isCalled = true; - result = func.apply(thisArg, args); - } - if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = undefined; + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); } return result; } @@ -8696,6 +9433,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke `func` with. @@ -8705,7 +9443,7 @@ * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // => logs 'deferred' after one or more milliseconds + * // => Logs 'deferred' after one or more milliseconds. */ var defer = rest(function(func, args) { return baseDelay(func, 1, args); @@ -8717,6 +9455,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. @@ -8727,7 +9466,7 @@ * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); - * // => logs 'later' after one second + * // => Logs 'later' after one second. */ var delay = rest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); @@ -8738,6 +9477,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to flip arguments for. * @returns {Function} Returns the new function. @@ -8756,18 +9496,20 @@ /** * Creates a function that memoizes the result of `func`. If `resolver` is - * provided it determines the cache key for storing the result based on the + * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. @@ -8812,10 +9554,13 @@ memoized.cache = cache.set(key, result); return result; }; - memoized.cache = new memoize.Cache; + memoized.cache = new (memoize.Cache || MapCache); return memoized; } + // Assign cache to `_.memoize`. + memoize.Cache = MapCache; + /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the @@ -8823,6 +9568,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new function. @@ -8851,6 +9597,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. @@ -8870,10 +9617,11 @@ * corresponding `transforms`. * * @static + * @since 4.0.0 * @memberOf _ * @category Function * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms] The functions to transform + * @param {...(Function|Function[])} [transforms] The functions to transform. * arguments, specified individually or in arrays. * @returns {Function} Returns the new function. * @example @@ -8897,8 +9645,7 @@ * // => [100, 10] */ var overArgs = rest(function(func, transforms) { - transforms = arrayMap(baseFlatten(transforms), getIteratee()); - + transforms = arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), getIteratee()); var funcsLength = transforms.length; return rest(function(args) { var index = -1, @@ -8912,9 +9659,9 @@ }); /** - * Creates a function that invokes `func` with `partial` arguments prepended - * to those provided to the new function. This method is like `_.bind` except - * it does **not** alter the `this` binding. + * Creates a function that invokes `func` with `partials` prepended to the + * arguments it receives. This method is like `_.bind` except it does **not** + * alter the `this` binding. * * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. @@ -8924,6 +9671,7 @@ * * @static * @memberOf _ + * @since 0.2.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. @@ -8944,15 +9692,13 @@ * // => 'hi fred' */ var partial = rest(function(func, partials) { - var placeholder = lodash.placeholder || partial.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(partial)); return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); /** * This method is like `_.partial` except that partially applied arguments - * are appended to those provided to the new function. + * are appended to the arguments it receives. * * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. @@ -8962,6 +9708,7 @@ * * @static * @memberOf _ + * @since 1.0.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. @@ -8982,20 +9729,19 @@ * // => 'hello fred' */ var partialRight = rest(function(func, partials) { - var placeholder = lodash.placeholder || partialRight.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(partialRight)); return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); /** * Creates a function that invokes `func` with arguments arranged according - * to the specified indexes where the argument value at the first index is + * to the specified `indexes` where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} func The function to rearrange arguments for. * @param {...(number|number[])} indexes The arranged argument indexes, @@ -9011,17 +9757,20 @@ * // => ['a', 'b', 'c'] */ var rearg = rest(function(func, indexes) { - return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); + return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1)); }); /** * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. + * created function and arguments from `start` and beyond provided as + * an array. * - * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. @@ -9066,13 +9815,16 @@ } /** - * Creates a function that invokes `func` with the `this` binding of the created - * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). + * Creates a function that invokes `func` with the `this` binding of the + * create function and an array of arguments much like + * [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply). * - * **Note:** This method is based on the [spread operator](https://mdn.io/spread_operator). + * **Note:** This method is based on the + * [spread operator](https://mdn.io/spread_operator). * * @static * @memberOf _ + * @since 3.2.0 * @category Function * @param {Function} func The function to spread arguments over. * @param {number} [start=0] The start position of the spread. @@ -9122,23 +9874,24 @@ * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * - * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the throttled function is - * invoked more than once during the `wait` timeout. + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. * - * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=true] Specify invoking on the leading - * edge of the timeout. - * @param {boolean} [options.trailing=true] Specify invoking on the trailing - * edge of the timeout. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * @@ -9163,7 +9916,11 @@ leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } - return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); } /** @@ -9172,6 +9929,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new function. @@ -9192,9 +9950,10 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {*} value The value to wrap. - * @param {Function} wrapper The wrapper function. + * @param {Function} [wrapper=identity] The wrapper function. * @returns {Function} Returns the new function. * @example * @@ -9212,6 +9971,47 @@ /*------------------------------------------------------------------------*/ + /** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + /** * Creates a shallow clone of `value`. * @@ -9225,6 +10025,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to clone. * @returns {*} Returns the cloned value. @@ -9237,17 +10038,18 @@ * // => true */ function clone(value) { - return baseClone(value); + return baseClone(value, false, true); } /** * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined` + * is invoked to produce the cloned value. If `customizer` returns `undefined`, * cloning is handled by the method instead. The `customizer` is invoked with * up to four arguments; (value [, index|key, object, stack]). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to clone. * @param {Function} [customizer] The function to customize cloning. @@ -9270,7 +10072,7 @@ * // => 0 */ function cloneWith(value, customizer) { - return baseClone(value, false, customizer); + return baseClone(value, false, true, customizer); } /** @@ -9278,6 +10080,7 @@ * * @static * @memberOf _ + * @since 1.0.0 * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. @@ -9290,7 +10093,7 @@ * // => false */ function cloneDeep(value) { - return baseClone(value, true); + return baseClone(value, true, true); } /** @@ -9298,6 +10101,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to recursively clone. * @param {Function} [customizer] The function to customize cloning. @@ -9320,15 +10124,17 @@ * // => 20 */ function cloneDeepWith(value, customizer) { - return baseClone(value, true, customizer); + return baseClone(value, true, true, customizer); } /** - * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. @@ -9362,10 +10168,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. * @example * * _.gt(3, 1); @@ -9386,10 +10194,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. * @example * * _.gte(3, 1); @@ -9410,9 +10220,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArguments(function() { return arguments; }()); @@ -9432,10 +10244,12 @@ * * @static * @memberOf _ - * @type Function + * @since 0.1.0 + * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -9457,10 +10271,11 @@ * * @static * @memberOf _ - * @type Function + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArrayBuffer(new ArrayBuffer(2)); @@ -9480,7 +10295,7 @@ * * @static * @memberOf _ - * @type Function + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -9499,8 +10314,7 @@ * // => false */ function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); + return value != null && isLength(getLength(value)) && !isFunction(value); } /** @@ -9509,10 +10323,11 @@ * * @static * @memberOf _ - * @type Function + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); @@ -9536,9 +10351,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isBoolean(false); @@ -9557,6 +10374,7 @@ * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. @@ -9577,9 +10395,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isDate(new Date); @@ -9597,9 +10417,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @returns {boolean} Returns `true` if `value` is a DOM element, + * else `false`. * @example * * _.isElement(document.body); @@ -9613,14 +10435,20 @@ } /** - * Checks if `value` is empty. A value is considered empty unless it's an - * `arguments` object, array, string, or jQuery-like collection with a length - * greater than `0` or an object with own enumerable properties. + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang - * @param {Array|Object|string} value The value to inspect. + * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * @@ -9641,15 +10469,22 @@ */ function isEmpty(value) { if (isArrayLike(value) && - (isArray(value) || isString(value) || isFunction(value.splice) || isArguments(value))) { + (isArray(value) || isString(value) || isFunction(value.splice) || + isArguments(value) || isBuffer(value))) { return !value.length; } + if (isObjectLike(value)) { + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } - return true; + return !(nonEnumShadows && keys(value).length); } /** @@ -9664,10 +10499,12 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @returns {boolean} Returns `true` if the values are equivalent, + * else `false`. * @example * * var object = { 'user': 'fred' }; @@ -9684,18 +10521,20 @@ } /** - * This method is like `_.isEqual` except that it accepts `customizer` which is - * invoked to compare values. If `customizer` returns `undefined` comparisons are - * handled by the method instead. The `customizer` is invoked with up to six arguments: - * (objValue, othValue [, index|key, object, other, stack]). + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @returns {boolean} Returns `true` if the values are equivalent, + * else `false`. * @example * * function isGreeting(value) { @@ -9726,9 +10565,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @returns {boolean} Returns `true` if `value` is an error object, + * else `false`. * @example * * _.isError(new Error); @@ -9738,20 +10579,26 @@ * // => false */ function isError(value) { - return isObjectLike(value) && - typeof value.message == 'string' && objectToString.call(value) == errorTag; + if (!isObjectLike(value)) { + return false; + } + return (objectToString.call(value) == errorTag) || + (typeof value.message == 'string' && typeof value.name == 'string'); } /** * Checks if `value` is a finite primitive number. * - * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite). + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @returns {boolean} Returns `true` if `value` is a finite number, + * else `false`. * @example * * _.isFinite(3); @@ -9775,9 +10622,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -9788,8 +10637,8 @@ */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -9797,10 +10646,12 @@ /** * Checks if `value` is an integer. * - * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an integer, else `false`. @@ -9825,13 +10676,16 @@ /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. * @example * * _.isLength(3); @@ -9847,15 +10701,18 @@ * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -9884,6 +10741,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. @@ -9910,9 +10768,11 @@ * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isMap(new Map); @@ -9926,13 +10786,15 @@ } /** - * Performs a deep comparison between `object` and `source` to determine if - * `object` contains equivalent property values. + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. This method is + * equivalent to a `_.matches` function when `source` is partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. @@ -9953,12 +10815,13 @@ /** * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined` comparisons + * is invoked to compare values. If `customizer` returns `undefined`, comparisons * are handled by the method instead. The `customizer` is invoked with five * arguments: (objValue, srcValue, index|key, object, source). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. @@ -9990,11 +10853,14 @@ /** * Checks if `value` is `NaN`. * - * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) - * which returns `true` for `undefined` and other non-numeric values. + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. @@ -10014,7 +10880,8 @@ */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. return isNumber(value) && value != +value; } @@ -10023,9 +10890,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. * @example * * _.isNative(Array.prototype.push); @@ -10035,14 +10904,11 @@ * // => false */ function isNative(value) { - if (value == null) { + if (!isObject(value)) { return false; } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } /** @@ -10050,6 +10916,7 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. @@ -10070,6 +10937,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. @@ -10091,14 +10959,16 @@ /** * Checks if `value` is classified as a `Number` primitive or object. * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified - * as numbers, use the `_.isFinite` method. + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isNumber(3); @@ -10124,9 +10994,11 @@ * * @static * @memberOf _ + * @since 0.8.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @returns {boolean} Returns `true` if `value` is a plain object, + * else `false`. * @example * * function Foo() { @@ -10146,17 +11018,15 @@ * // => true */ function isPlainObject(value) { - if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) { + if (!isObjectLike(value) || + objectToString.call(value) != objectTag || isHostObject(value)) { return false; } - var proto = objectProto; - if (typeof value.constructor == 'function') { - proto = getPrototypeOf(value); - } + var proto = getPrototype(value); if (proto === null) { return true; } - var Ctor = proto.constructor; + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return (typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString); } @@ -10166,9 +11036,11 @@ * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isRegExp(/abc/); @@ -10185,13 +11057,16 @@ * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 * double precision number which isn't the result of a rounded unsafe integer. * - * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @returns {boolean} Returns `true` if `value` is a safe integer, + * else `false`. * @example * * _.isSafeInteger(3); @@ -10215,9 +11090,11 @@ * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isSet(new Set); @@ -10234,10 +11111,12 @@ * Checks if `value` is classified as a `String` primitive or object. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isString('abc'); @@ -10256,9 +11135,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isSymbol(Symbol.iterator); @@ -10277,9 +11158,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isTypedArray(new Uint8Array); @@ -10289,13 +11172,15 @@ * // => false */ function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** * Checks if `value` is `undefined`. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. @@ -10317,9 +11202,11 @@ * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isWeakMap(new WeakMap); @@ -10337,9 +11224,11 @@ * * @static * @memberOf _ + * @since 4.3.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isWeakSet(new WeakSet); @@ -10357,10 +11246,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. * @example * * _.lt(1, 3); @@ -10381,10 +11272,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is less than or equal to + * `other`, else `false`. * @example * * _.lte(1, 3); @@ -10404,6 +11297,7 @@ * Converts `value` to an array. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to convert. @@ -10441,10 +11335,12 @@ /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * **Note:** This function is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. @@ -10479,10 +11375,12 @@ * Converts `value` to an integer suitable for use as the length of an * array-like object. * - * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. @@ -10509,6 +11407,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. @@ -10527,6 +11426,12 @@ * // => 3 */ function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } if (isObject(value)) { var other = isFunction(value.valueOf) ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; @@ -10542,11 +11447,12 @@ } /** - * Converts `value` to a plain object flattening inherited enumerable - * properties of `value` to own properties of the plain object. + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. @@ -10574,6 +11480,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. @@ -10601,6 +11508,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. @@ -10624,7 +11532,7 @@ return ''; } if (isSymbol(value)) { - return Symbol ? symbolToString.call(value) : ''; + return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; @@ -10633,15 +11541,16 @@ /*------------------------------------------------------------------------*/ /** - * Assigns own enumerable properties of source objects to the destination - * object. Source objects are applied from left to right. Subsequent sources - * overwrite property assignments of previous sources. + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ + * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. @@ -10663,7 +11572,15 @@ * // => { 'a': 1, 'c': 3, 'e': 5 } */ var assign = createAssigner(function(object, source) { - copyObject(source, keys(source), object); + if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } }); /** @@ -10674,6 +11591,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @alias extend * @category Object * @param {Object} object The destination object. @@ -10696,19 +11614,26 @@ * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } */ var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); + if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + copyObject(source, keysIn(source), object); + return; + } + for (var key in source) { + assignValue(object, key, source[key]); + } }); /** - * This method is like `_.assignIn` except that it accepts `customizer` which - * is invoked to produce the assigned values. If `customizer` returns `undefined` - * assignment is handled by the method instead. The `customizer` is invoked - * with five arguments: (objValue, srcValue, key, object, source). + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ + * @since 4.0.0 * @alias extendWith * @category Object * @param {Object} object The destination object. @@ -10731,15 +11656,16 @@ }); /** - * This method is like `_.assign` except that it accepts `customizer` which - * is invoked to produce the assigned values. If `customizer` returns `undefined` - * assignment is handled by the method instead. The `customizer` is invoked - * with five arguments: (objValue, srcValue, key, object, source). + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. @@ -10765,6 +11691,7 @@ * * @static * @memberOf _ + * @since 1.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths of elements to pick, @@ -10781,15 +11708,17 @@ * // => ['a', 'c'] */ var at = rest(function(object, paths) { - return baseAt(object, baseFlatten(paths)); + return baseAt(object, baseFlatten(paths, 1)); }); /** - * Creates an object that inherits from the `prototype` object. If a `properties` - * object is given its own enumerable properties are assigned to the created object. + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. * * @static * @memberOf _ + * @since 2.3.0 * @category Object * @param {Object} prototype The object to inherit from. * @param {Object} [properties] The properties to assign to the object. @@ -10822,14 +11751,15 @@ } /** - * Assigns own and inherited enumerable properties of source objects to the - * destination object for all destination properties that resolve to `undefined`. - * Source objects are applied from left to right. Once a property is set, - * additional values of the same property are ignored. + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. * * **Note:** This method mutates `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The destination object. @@ -10853,6 +11783,7 @@ * * @static * @memberOf _ + * @since 3.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. @@ -10874,10 +11805,13 @@ * * @static * @memberOf _ + * @since 1.1.0 * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. * @example * * var users = { @@ -10911,10 +11845,13 @@ * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, else `undefined`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. * @example * * var users = { @@ -10943,13 +11880,14 @@ } /** - * Iterates over own and inherited enumerable properties of an object invoking - * `iteratee` for each property. The iteratee is invoked with three arguments: - * (value, key, object). Iteratee functions may exit iteration early by explicitly - * returning `false`. + * Iterates over own and inherited enumerable string keyed properties of an + * object invoking `iteratee` for each property. The iteratee is invoked with + * three arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. * * @static * @memberOf _ + * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -10966,10 +11904,12 @@ * _.forIn(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed) + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). */ function forIn(object, iteratee) { - return object == null ? object : baseFor(object, toFunction(iteratee), keysIn); + return object == null + ? object + : baseFor(object, getIteratee(iteratee), keysIn); } /** @@ -10978,6 +11918,7 @@ * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -10994,20 +11935,23 @@ * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c' + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. */ function forInRight(object, iteratee) { - return object == null ? object : baseForRight(object, toFunction(iteratee), keysIn); + return object == null + ? object + : baseForRight(object, getIteratee(iteratee), keysIn); } /** - * Iterates over own enumerable properties of an object invoking `iteratee` - * for each property. The iteratee is invoked with three arguments: + * Iterates over own enumerable string keyed properties of an object invoking + * `iteratee` for each property. The iteratee is invoked with three arguments: * (value, key, object). Iteratee functions may exit iteration early by * explicitly returning `false`. * * @static * @memberOf _ + * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -11024,10 +11968,10 @@ * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forOwn(object, iteratee) { - return object && baseForOwn(object, toFunction(iteratee)); + return object && baseForOwn(object, getIteratee(iteratee)); } /** @@ -11036,6 +11980,7 @@ * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -11052,10 +11997,10 @@ * _.forOwnRight(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b' + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. */ function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, toFunction(iteratee)); + return object && baseForOwnRight(object, getIteratee(iteratee)); } /** @@ -11063,6 +12008,7 @@ * of `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to inspect. @@ -11089,6 +12035,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. @@ -11110,14 +12057,15 @@ /** * Gets the value at `path` of `object`. If the resolved value is - * `undefined` the `defaultValue` is used in its place. + * `undefined`, the `defaultValue` is used in its place. * * @static * @memberOf _ + * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * @@ -11141,6 +12089,7 @@ * Checks if `path` is a direct property of `object`. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -11148,23 +12097,23 @@ * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * - * var object = { 'a': { 'b': { 'c': 3 } } }; - * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.has(object, 'a'); * // => true * - * _.has(object, 'a.b.c'); + * _.has(object, 'a.b'); * // => true * - * _.has(object, ['a', 'b', 'c']); + * _.has(object, ['a', 'b']); * // => true * * _.has(other, 'a'); * // => false */ function has(object, path) { - return hasPath(object, path, baseHas); + return object != null && hasPath(object, path, baseHas); } /** @@ -11172,37 +12121,39 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * - * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * - * _.hasIn(object, 'a.b.c'); + * _.hasIn(object, 'a.b'); * // => true * - * _.hasIn(object, ['a', 'b', 'c']); + * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { - return hasPath(object, path, baseHasIn); + return object != null && hasPath(object, path, baseHasIn); } /** * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite property - * assignments of previous values. + * If `object` contains duplicate values, subsequent values overwrite + * property assignments of previous values. * * @static * @memberOf _ + * @since 0.7.0 * @category Object * @param {Object} object The object to invert. * @returns {Object} Returns the new inverted object. @@ -11219,16 +12170,18 @@ /** * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` through `iteratee`. - * The corresponding inverted value of each inverted key is an array of keys + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys * responsible for generating the inverted value. The iteratee is invoked * with one argument: (value). * * @static * @memberOf _ + * @since 4.1.0 * @category Object * @param {Object} object The object to invert. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Object} Returns the new inverted object. * @example * @@ -11255,6 +12208,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. @@ -11277,6 +12231,7 @@ * for more details. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -11323,6 +12278,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. @@ -11361,13 +12317,16 @@ /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable - * property of `object` through `iteratee`. + * string keyed property of `object` thru `iteratee`. The iteratee is invoked + * with three arguments: (value, key, object). * * @static * @memberOf _ + * @since 3.8.0 * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * @@ -11387,15 +12346,18 @@ } /** - * Creates an object with the same keys as `object` and values generated by - * running each own enumerable property of `object` through `iteratee`. The - * iteratee function is invoked with three arguments: (value, key, object). + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). * * @static * @memberOf _ + * @since 2.4.0 * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * @@ -11422,17 +12384,19 @@ } /** - * Recursively merges own and inherited enumerable properties of source - * objects into the destination object, skipping source properties that resolve - * to `undefined`. Array and plain object properties are merged recursively. - * Other objects and value types are overridden by assignment. Source objects - * are applied from left to right. Subsequent sources overwrite property - * assignments of previous sources. + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively.Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ + * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. @@ -11457,7 +12421,7 @@ /** * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined` merging is handled by the + * properties. If `customizer` returns `undefined`, merging is handled by the * method instead. The `customizer` is invoked with seven arguments: * (objValue, srcValue, key, object, source, stack). * @@ -11465,6 +12429,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. @@ -11497,14 +12462,16 @@ /** * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that are not omitted. + * own and inherited enumerable string keyed properties of `object` that are + * not omitted. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property names to omit, specified - * individually or in arrays.. + * @param {...(string|string[])} [props] The property identifiers to omit, + * specified individually or in arrays. * @returns {Object} Returns the new object. * @example * @@ -11517,20 +12484,23 @@ if (object == null) { return {}; } - props = arrayMap(baseFlatten(props), String); - return basePick(object, baseDifference(keysIn(object), props)); + props = arrayMap(baseFlatten(props, 1), baseCastKey); + return basePick(object, baseDifference(getAllKeysIn(object), props)); }); /** - * The opposite of `_.pickBy`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that `predicate` - * doesn't return truthy for. + * The opposite of `_.pickBy`; this method creates an object composed of + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The source object. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per property. * @returns {Object} Returns the new object. * @example * @@ -11540,7 +12510,7 @@ * // => { 'b': '2' } */ function omitBy(object, predicate) { - predicate = getIteratee(predicate, 2); + predicate = getIteratee(predicate); return basePickBy(object, function(value, key) { return !predicate(value, key); }); @@ -11550,11 +12520,12 @@ * Creates an object composed of the picked `object` properties. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property names to pick, specified - * individually or in arrays. + * @param {...(string|string[])} [props] The property identifiers to pick, + * specified individually or in arrays. * @returns {Object} Returns the new object. * @example * @@ -11564,7 +12535,7 @@ * // => { 'a': 1, 'c': 3 } */ var pick = rest(function(object, props) { - return object == null ? {} : basePick(object, baseFlatten(props)); + return object == null ? {} : basePick(object, baseFlatten(props, 1)); }); /** @@ -11573,9 +12544,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The source object. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per property. * @returns {Object} Returns the new object. * @example * @@ -11585,20 +12558,21 @@ * // => { 'a': 1, 'c': 3 } */ function pickBy(object, predicate) { - return object == null ? {} : basePickBy(object, getIteratee(predicate, 2)); + return object == null ? {} : basePickBy(object, getIteratee(predicate)); } /** - * This method is like `_.get` except that if the resolved value is a function - * it's invoked with the `this` binding of its parent object and its result - * is returned. + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * @@ -11617,21 +12591,29 @@ * // => 'default' */ function result(object, path, defaultValue) { - if (!isKey(path, object)) { - path = baseToPath(path); - var result = get(object, path); - object = parent(object, path); - } else { - result = object == null ? undefined : object[path]; + path = isKey(path, object) ? [path] : baseCastPath(path); + + var index = -1, + length = path.length; + + // Ensure the loop is entered when path is empty. + if (!length) { + object = undefined; + length = 1; } - if (result === undefined) { - result = defaultValue; + while (++index < length) { + var value = object == null ? undefined : object[path[index]]; + if (value === undefined) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; } - return isFunction(result) ? result.call(object) : result; + return object; } /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, * it's created. Arrays are created for missing index properties while objects * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. @@ -11640,6 +12622,7 @@ * * @static * @memberOf _ + * @since 3.7.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. @@ -11653,7 +12636,7 @@ * console.log(object.a[0].b.c); * // => 4 * - * _.set(object, 'x[0].y.z', 5); + * _.set(object, ['x', '0', 'y', 'z'], 5); * console.log(object.x[0].y.z); * // => 5 */ @@ -11671,6 +12654,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. @@ -11679,8 +12663,10 @@ * @returns {Object} Returns `object`. * @example * - * _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object); - * // => { '0': { '1': { '2': 3 }, 'length': 2 } } + * var object = {}; + * + * _.setWith(object, '[0][1]', 'a', Object); + * // => { '0': { '1': 'a' } } */ function setWith(object, path, value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; @@ -11688,10 +12674,13 @@ } /** - * Creates an array of own enumerable key-value pairs for `object`. + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. * * @static * @memberOf _ + * @since 4.0.0 + * @alias entries * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. @@ -11712,10 +12701,13 @@ } /** - * Creates an array of own and inherited enumerable key-value pairs for `object`. + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. * * @static * @memberOf _ + * @since 4.0.0 + * @alias entriesIn * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. @@ -11737,14 +12729,15 @@ /** * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own enumerable - * properties through `iteratee`, with each invocation potentially mutating - * the `accumulator` object. The iteratee is invoked with four arguments: - * (accumulator, value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. The iteratee is invoked + * with four arguments: (accumulator, value, key, object). Iteratee functions + * may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ + * @since 1.3.0 * @category Object * @param {Array|Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -11773,7 +12766,7 @@ if (isArr) { accumulator = isArray(object) ? new Ctor : []; } else { - accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; } } else { accumulator = {}; @@ -11792,6 +12785,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. @@ -11805,7 +12799,7 @@ * console.log(object); * // => { 'a': [{ 'b': {} }] }; * - * _.unset(object, 'a[0].b.c'); + * _.unset(object, ['a', '0', 'b', 'c']); * // => true * * console.log(object); @@ -11816,11 +12810,72 @@ } /** - * Creates an array of the own enumerable property values of `object`. + * This method is like `_.set` except that accepts `updater` to produce the + * value to set. Use `_.updateWith` to customize `path` creation. The `updater` + * is invoked with one argument: (value). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.update(object, 'a[0].b.c', function(n) { return n * n; }); + * console.log(object.a[0].b.c); + * // => 9 + * + * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); + * console.log(object.x[0].y.z); + * // => 0 + */ + function update(object, path, updater) { + return object == null ? object : baseUpdate(object, path, baseCastFunction(updater)); + } + + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + function updateWith(object, path, updater, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseUpdate(object, path, baseCastFunction(updater), customizer); + } + + /** + * Creates an array of the own enumerable string keyed property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. @@ -11845,12 +12900,14 @@ } /** - * Creates an array of the own and inherited enumerable property values of `object`. + * Creates an array of the own and inherited enumerable string keyed property + * values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ + * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. @@ -11867,7 +12924,7 @@ * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { - return object == null ? baseValues(object, keysIn(object)) : []; + return object == null ? [] : baseValues(object, keysIn(object)); } /*------------------------------------------------------------------------*/ @@ -11877,6 +12934,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Number * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. @@ -11908,12 +12966,13 @@ /** * Checks if `n` is between `start` and up to but not including, `end`. If - * `end` is not specified it's set to `start` with `start` then set to `0`. + * `end` is not specified, it's set to `start` with `start` then set to `0`. * If `start` is greater than `end` the params are swapped to support * negative ranges. * * @static * @memberOf _ + * @since 3.3.0 * @category Number * @param {number} number The number to check. * @param {number} [start=0] The start of the range. @@ -11957,14 +13016,15 @@ /** * Produces a random number between the inclusive `lower` and `upper` bounds. * If only one argument is provided a number between `0` and the given number - * is returned. If `floating` is `true`, or either `lower` or `upper` are floats, - * a floating-point number is returned instead of an integer. + * is returned. If `floating` is `true`, or either `lower` or `upper` are + * floats, a floating-point number is returned instead of an integer. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ + * @since 0.7.0 * @category Number * @param {number} [lower=0] The lower bound. * @param {number} [upper=1] The upper bound. @@ -12030,6 +13090,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. @@ -12038,10 +13099,10 @@ * _.camelCase('Foo Bar'); * // => 'fooBar' * - * _.camelCase('--foo-bar'); + * _.camelCase('--foo-bar--'); * // => 'fooBar' * - * _.camelCase('__foo_bar__'); + * _.camelCase('__FOO_BAR__'); * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { @@ -12055,6 +13116,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. @@ -12068,11 +13130,14 @@ } /** - * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * Deburrs `string` by converting + * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * to basic latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. @@ -12091,11 +13156,13 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to search from. - * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. + * @returns {boolean} Returns `true` if `string` ends with `target`, + * else `false`. * @example * * _.endsWith('abc', 'c'); @@ -12129,20 +13196,22 @@ * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. - * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in IE < 9, they can break out of * attribute values or HTML comments. See [#59](https://html5sec.org/#59), * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) - * for more details. + * [#133](https://html5sec.org/#133) of the + * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. * - * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) - * to reduce XSS vectors. + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. * * @static + * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The string to escape. @@ -12165,6 +13234,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. @@ -12181,10 +13251,12 @@ } /** - * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. @@ -12196,7 +13268,7 @@ * _.kebabCase('fooBar'); * // => 'foo-bar' * - * _.kebabCase('__foo_bar__'); + * _.kebabCase('__FOO_BAR__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { @@ -12208,12 +13280,13 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * - * _.lowerCase('--Foo-Bar'); + * _.lowerCase('--Foo-Bar--'); * // => 'foo bar' * * _.lowerCase('fooBar'); @@ -12231,6 +13304,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. @@ -12244,30 +13318,13 @@ */ var lowerFirst = createCaseFirst('toLowerCase'); - /** - * Converts the first character of `string` to upper case. - * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.upperFirst('fred'); - * // => 'Fred' - * - * _.upperFirst('FRED'); - * // => 'FRED' - */ - var upperFirst = createCaseFirst('toUpperCase'); - /** * Pads `string` on the left and right sides if it's shorter than `length`. * Padding characters are truncated if they can't be evenly divided by `length`. * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. @@ -12288,15 +13345,16 @@ string = toString(string); length = toInteger(length); - var strLength = stringSize(string); + var strLength = length ? stringSize(string) : 0; if (!length || strLength >= length) { return string; } - var mid = (length - strLength) / 2, - leftLength = nativeFloor(mid), - rightLength = nativeCeil(mid); - - return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars); + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); } /** @@ -12305,6 +13363,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. @@ -12323,7 +13382,12 @@ */ function padEnd(string, length, chars) { string = toString(string); - return string + createPadding(string, length, chars); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (string + createPadding(length - strLength, chars)) + : string; } /** @@ -12332,6 +13396,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. @@ -12350,23 +13415,29 @@ */ function padStart(string, length, chars) { string = toString(string); - return createPadding(string, length, chars) + string; + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (createPadding(length - strLength, chars) + string) + : string; } /** * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, - * in which case a `radix` of `16` is used. + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a + * hexadecimal, in which case a `radix` of `16` is used. * - * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2) - * of `parseInt`. + * **Note:** This method aligns with the + * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. * * @static * @memberOf _ + * @since 1.1.0 * @category String * @param {string} string The string to convert. - * @param {number} [radix] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param {number} [radix=10] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {number} Returns the converted integer. * @example * @@ -12378,7 +13449,7 @@ */ function parseInt(string, radix, guard) { // Chrome fails to trim leading whitespace characters. - // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. + // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details. if (guard || radix == null) { radix = 0; } else if (radix) { @@ -12393,9 +13464,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to repeat. - * @param {number} [n=0] The number of times to repeat the string. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the repeated string. * @example * @@ -12408,34 +13481,24 @@ * _.repeat('abc', 0); * // => '' */ - function repeat(string, n) { - string = toString(string); - n = toInteger(n); - - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; + function repeat(string, n, guard) { + if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - string += string; - } while (n); - - return result; + return baseRepeat(toString(string), n); } /** * Replaces matches for `pattern` in `string` with `replacement`. * - * **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace). + * **Note:** This method is based on + * [`String#replace`](https://mdn.io/String/replace). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to modify. * @param {RegExp|string} pattern The pattern to replace. @@ -12454,10 +13517,12 @@ } /** - * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). + * Converts `string` to + * [snake case](https://en.wikipedia.org/wiki/Snake_case). * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. @@ -12469,7 +13534,7 @@ * _.snakeCase('fooBar'); * // => 'foo_bar' * - * _.snakeCase('--foo-bar'); + * _.snakeCase('--FOO-BAR--'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { @@ -12479,10 +13544,12 @@ /** * Splits `string` by `separator`. * - * **Note:** This method is based on [`String#split`](https://mdn.io/String/split). + * **Note:** This method is based on + * [`String#split`](https://mdn.io/String/split). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to split. * @param {RegExp|string} separator The separator pattern to split by. @@ -12494,30 +13561,43 @@ * // => ['a', 'b'] */ function split(string, separator, limit) { - return toString(string).split(separator, limit); + string = toString(string); + if (string && ( + typeof separator == 'string' || + (separator != null && !isRegExp(separator)) + )) { + separator += ''; + if (separator == '' && reHasComplexSymbol.test(string)) { + var strSymbols = stringToArray(string); + return limit === undefined ? strSymbols : strSymbols.slice(0, limit < 0 ? 0 : limit); + } + } + return string.split(separator, limit); } /** - * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ + * @since 3.1.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * - * _.startCase('--foo-bar'); + * _.startCase('--foo-bar--'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * - * _.startCase('__foo_bar__'); - * // => 'Foo Bar' + * _.startCase('__FOO_BAR__'); + * // => 'FOO BAR' */ var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + capitalize(word); + return result + (index ? ' ' : '') + upperFirst(word); }); /** @@ -12525,11 +13605,13 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. * @example * * _.startsWith('abc', 'a'); @@ -12552,7 +13634,7 @@ * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * properties may be accessed as free variables in the template. If a setting - * object is given it takes precedence over `_.templateSettings` values. + * object is given, it takes precedence over `_.templateSettings` values. * * **Note:** In the development build `_.template` utilizes * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) @@ -12565,17 +13647,24 @@ * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @static + * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The template string. - * @param {Object} [options] The options object. - * @param {RegExp} [options.escape] The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as free variables. - * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. - * @param {string} [options.variable] The data object variable name. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='lodash.templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the compiled template function. * @example * @@ -12624,7 +13713,7 @@ * // Use the `sourceURL` option to specify a custom sourceURL for the template. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); - * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector + * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. * * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); @@ -12644,7 +13733,8 @@ * '); */ function template(string, options, guard) { - // Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/) + // Based on John Resig's `tmpl` implementation + // (http://ejohn.org/blog/javascript-micro-templating/) // and Laura Doktorova's doT.js (https://github.com/olado/doT). var settings = lodash.templateSettings; @@ -12737,7 +13827,8 @@ 'return __p\n}'; var result = attempt(function() { - return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues); + return Function(importsKeys, sourceURL + 'return ' + source) + .apply(undefined, importsValues); }); // Provide the compiled function's source by its `toString` method or @@ -12750,17 +13841,19 @@ } /** - * Converts `string`, as a whole, to lower case. + * Converts `string`, as a whole, to lower case just like + * [String#toLowerCase](https://mdn.io/toLowerCase). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * - * _.toLower('--Foo-Bar'); - * // => '--foo-bar' + * _.toLower('--Foo-Bar--'); + * // => '--foo-bar--' * * _.toLower('fooBar'); * // => 'foobar' @@ -12773,17 +13866,19 @@ } /** - * Converts `string`, as a whole, to upper case. + * Converts `string`, as a whole, to upper case just like + * [String#toUpperCase](https://mdn.io/toUpperCase). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * - * _.toUpper('--foo-bar'); - * // => '--FOO-BAR' + * _.toUpper('--foo-bar--'); + * // => '--FOO-BAR--' * * _.toUpper('fooBar'); * // => 'FOOBAR' @@ -12800,10 +13895,11 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -12831,7 +13927,9 @@ var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars); - return strSymbols.slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1).join(''); + return strSymbols + .slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1) + .join(''); } /** @@ -12839,10 +13937,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -12865,7 +13964,9 @@ return string; } var strSymbols = stringToArray(string); - return strSymbols.slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1).join(''); + return strSymbols + .slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1) + .join(''); } /** @@ -12873,10 +13974,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -12899,7 +14001,9 @@ return string; } var strSymbols = stringToArray(string); - return strSymbols.slice(charsStartIndex(strSymbols, stringToArray(chars))).join(''); + return strSymbols + .slice(charsStartIndex(strSymbols, stringToArray(chars))) + .join(''); } /** @@ -12909,9 +14013,10 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to truncate. - * @param {Object} [options] The options object. + * @param {Object} [options={}] The options object. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string to indicate text is omitted. * @param {RegExp|string} [options.separator] The separator pattern to truncate to. @@ -12996,14 +14101,15 @@ /** * The inverse of `_.escape`; this method converts the HTML entities - * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to their - * corresponding characters. + * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to + * their corresponding characters. * - * **Note:** No other HTML entities are unescaped. To unescape additional HTML - * entities use a third-party library like [_he_](https://mths.be/he). + * **Note:** No other HTML entities are unescaped. To unescape additional + * HTML entities use a third-party library like [_he_](https://mths.be/he). * * @static * @memberOf _ + * @since 0.6.0 * @category String * @param {string} [string=''] The string to unescape. * @returns {string} Returns the unescaped string. @@ -13024,6 +14130,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. @@ -13042,15 +14149,35 @@ return result + (index ? ' ' : '') + word.toUpperCase(); }); + /** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ + var upperFirst = createCaseFirst('toUpperCase'); + /** * Splits `string` into an array of its words. * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the words of `string`. * @example * @@ -13078,8 +14205,10 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Function} func The function to attempt. + * @param {...*} [args] The arguments to invoke `func` with. * @returns {*} Returns the `func` result or error object. * @example * @@ -13096,7 +14225,7 @@ try { return apply(func, undefined, args); } catch (e) { - return isObject(e) ? e : new Error(e); + return isError(e) ? e : new Error(e); } }); @@ -13107,6 +14236,7 @@ * **Note:** This method doesn't set the "length" property of bound functions. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {Object} object The object to bind and assign the bound methods to. @@ -13124,10 +14254,10 @@ * * _.bindAll(view, 'onClick'); * jQuery(element).on('click', view.onClick); - * // => logs 'clicked docs' when clicked + * // => Logs 'clicked docs' when clicked. */ var bindAll = rest(function(object, methodNames) { - arrayEach(baseFlatten(methodNames), function(key) { + arrayEach(baseFlatten(methodNames, 1), function(key) { object[key] = bind(object[key], object); }); return object; @@ -13141,6 +14271,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {Array} pairs The predicate-function pairs. * @returns {Function} Returns the new function. @@ -13190,6 +14321,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new function. @@ -13212,6 +14344,7 @@ * * @static * @memberOf _ + * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new function. @@ -13236,6 +14369,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. * @returns {Function} Returns the new function. @@ -13256,6 +14390,7 @@ * invokes the given functions from right to left. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {...(Function|Function[])} [funcs] Functions to invoke. @@ -13276,6 +14411,7 @@ * This method returns the first argument given to it. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. @@ -13293,11 +14429,13 @@ /** * Creates a function that invokes `func` with the arguments of the created - * function. If `func` is a property name the created callback returns the - * property value for a given element. If `func` is an object the created - * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * function. If `func` is a property name, the created function returns the + * property value for a given element. If `func` is an array or object, the + * created function returns `true` for elements that contain the equivalent + * source properties, otherwise it returns `false`. * * @static + * @since 4.0.0 * @memberOf _ * @category Util * @param {*} [func=_.identity] The value to convert to a callback. @@ -13305,34 +14443,47 @@ * @example * * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } * ]; * + * // The `_.matches` iteratee shorthand. + * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); + * // => [{ 'user': 'barney', 'age': 36, 'active': true }] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, _.iteratee(['user', 'fred'])); + * // => [{ 'user': 'fred', 'age': 40 }] + * + * // The `_.property` iteratee shorthand. + * _.map(users, _.iteratee('user')); + * // => ['barney', 'fred'] + * * // Create custom iteratee shorthands. - * _.iteratee = _.wrap(_.iteratee, function(callback, func) { - * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); - * return !p ? callback(func) : function(object) { - * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { + * return !_.isRegExp(func) ? iteratee(func) : function(string) { + * return func.test(string); * }; * }); * - * _.filter(users, 'age > 36'); - * // => [{ 'user': 'fred', 'age': 40 }] + * _.filter(['abc', 'def'], /ef/); + * // => ['def'] */ function iteratee(func) { return baseIteratee(typeof func == 'function' ? func : baseClone(func, true)); } /** - * Creates a function that performs a deep partial comparison between a given + * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent - * property values, else `false`. + * property values, else `false`. The created function is equivalent to + * `_.isMatch` with a `source` partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. @@ -13351,7 +14502,7 @@ } /** - * Creates a function that performs a deep partial comparison between the + * Creates a function that performs a partial deep comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * @@ -13359,6 +14510,7 @@ * * @static * @memberOf _ + * @since 3.2.0 * @category Util * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. @@ -13383,6 +14535,7 @@ * * @static * @memberOf _ + * @since 3.7.0 * @category Util * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. @@ -13390,15 +14543,15 @@ * @example * * var objects = [ - * { 'a': { 'b': { 'c': _.constant(2) } } }, - * { 'a': { 'b': { 'c': _.constant(1) } } } + * { 'a': { 'b': _.constant(2) } }, + * { 'a': { 'b': _.constant(1) } } * ]; * - * _.map(objects, _.method('a.b.c')); + * _.map(objects, _.method('a.b')); * // => [2, 1] * - * _.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] + * _.map(objects, _.method(['a', 'b'])); + * // => [2, 1] */ var method = rest(function(path, args) { return function(object) { @@ -13413,6 +14566,7 @@ * * @static * @memberOf _ + * @since 3.7.0 * @category Util * @param {Object} object The object to query. * @param {...*} [args] The arguments to invoke the method with. @@ -13435,21 +14589,21 @@ }); /** - * Adds all own enumerable function properties of a source object to the - * destination object. If `object` is a function then methods are added to - * its prototype as well. + * Adds all own enumerable string keyed function properties of a source + * object to the destination object. If `object` is a function, then methods + * are added to its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. - * @param {Object} [options] The options object. - * @param {boolean} [options.chain=true] Specify whether the functions added - * are chainable. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.chain=true] Specify whether mixins are chainable. * @returns {Function|Object} Returns `object`. * @example * @@ -13511,6 +14665,7 @@ * the `lodash` function. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @returns {Function} Returns the `lodash` function. @@ -13531,6 +14686,7 @@ * * @static * @memberOf _ + * @since 2.3.0 * @category Util * @example * @@ -13548,6 +14704,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {number} [n=0] The index of the argument to return. * @returns {Function} Returns the new function. @@ -13566,11 +14723,12 @@ } /** - * Creates a function that invokes `iteratees` with the arguments provided - * to the created function and returns their results. + * Creates a function that invokes `iteratees` with the arguments it receives + * and returns their results. * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {...(Function|Function[])} iteratees The iteratees to invoke. * @returns {Function} Returns the new function. @@ -13585,10 +14743,11 @@ /** * Creates a function that checks if **all** of the `predicates` return - * truthy when invoked with the arguments provided to the created function. + * truthy when invoked with the arguments it receives. * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. @@ -13609,10 +14768,11 @@ /** * Creates a function that checks if **any** of the `predicates` return - * truthy when invoked with the arguments provided to the created function. + * truthy when invoked with the arguments it receives. * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. @@ -13636,20 +14796,21 @@ * * @static * @memberOf _ + * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. * @example * * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } * ]; * - * _.map(objects, _.property('a.b.c')); + * _.map(objects, _.property('a.b')); * // => [2, 1] * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { @@ -13662,6 +14823,7 @@ * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Object} object The object to query. * @returns {Function} Returns the new function. @@ -13685,13 +14847,14 @@ /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative - * `start` is specified without an `end` or `step`. If `end` is not specified + * `start` is specified without an `end` or `step`. If `end` is not specified, * it's set to `start` with `start` then set to `0`. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {number} [start=0] The start of the range. @@ -13729,6 +14892,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. @@ -13760,10 +14924,11 @@ var rangeRight = createRange(true); /** - * Invokes the iteratee function `n` times, returning an array of the results - * of each invocation. The iteratee is invoked with one argument; (index). + * Invokes the iteratee `n` times, returning an array of the results of + * each invocation. The iteratee is invoked with one argument; (index). * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {number} n The number of times to invoke `iteratee`. @@ -13785,7 +14950,7 @@ var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); - iteratee = toFunction(iteratee); + iteratee = getIteratee(iteratee); n -= MAX_ARRAY_LENGTH; var result = baseTimes(length, iteratee); @@ -13800,6 +14965,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {*} value The value to convert. * @returns {Array} Returns the new property path array. @@ -13821,16 +14987,20 @@ * // => false */ function toPath(value) { - return isArray(value) ? arrayMap(value, String) : stringToPath(value); + if (isArray(value)) { + return arrayMap(value, baseCastKey); + } + return isSymbol(value) ? [value] : copyArray(stringToPath(value)); } /** - * Generates a unique ID. If `prefix` is given the ID is appended to it. + * Generates a unique ID. If `prefix` is given, the ID is appended to it. * * @static + * @since 0.1.0 * @memberOf _ * @category Util - * @param {string} [prefix] The value to prefix the ID with. + * @param {string} [prefix=''] The value to prefix the ID with. * @returns {string} Returns the unique ID. * @example * @@ -13852,6 +15022,7 @@ * * @static * @memberOf _ + * @since 3.4.0 * @category Math * @param {number} augend The first number in an addition. * @param {number} addend The second number in an addition. @@ -13861,25 +15032,16 @@ * _.add(6, 4); * // => 10 */ - function add(augend, addend) { - var result; - if (augend === undefined && addend === undefined) { - return 0; - } - if (augend !== undefined) { - result = augend; - } - if (addend !== undefined) { - result = result === undefined ? addend : (result + addend); - } - return result; - } + var add = createMathOperation(function(augend, addend) { + return augend + addend; + }); /** * Computes `number` rounded up to `precision`. * * @static * @memberOf _ + * @since 3.10.0 * @category Math * @param {number} number The number to round up. * @param {number} [precision=0] The precision to round up to. @@ -13897,11 +15059,31 @@ */ var ceil = createRound('ceil'); + /** + * Divide two numbers. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Math + * @param {number} dividend The first number in a division. + * @param {number} divisor The second number in a division. + * @returns {number} Returns the quotient. + * @example + * + * _.divide(6, 4); + * // => 1.5 + */ + var divide = createMathOperation(function(dividend, divisor) { + return dividend / divisor; + }); + /** * Computes `number` rounded down to `precision`. * * @static * @memberOf _ + * @since 3.10.0 * @category Math * @param {number} number The number to round down. * @param {number} [precision=0] The precision to round down to. @@ -13920,10 +15102,11 @@ var floor = createRound('floor'); /** - * Computes the maximum value of `array`. If `array` is empty or falsey + * Computes the maximum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. @@ -13949,9 +15132,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {*} Returns the maximum value. * @example * @@ -13975,6 +15160,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the mean. @@ -13984,14 +15170,43 @@ * // => 5 */ function mean(array) { - return sum(array) / (array ? array.length : 0); + return baseMean(array, identity); + } + + /** + * This method is like `_.mean` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be averaged. + * The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Math + * @param {Array} array The array to iterate over. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {number} Returns the mean. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.meanBy(objects, function(o) { return o.n; }); + * // => 5 + * + * // The `_.property` iteratee shorthand. + * _.meanBy(objects, 'n'); + * // => 5 + */ + function meanBy(array, iteratee) { + return baseMean(array, getIteratee(iteratee)); } /** - * Computes the minimum value of `array`. If `array` is empty or falsey + * Computes the minimum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. @@ -14017,9 +15232,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {*} Returns the minimum value. * @example * @@ -14038,11 +15255,31 @@ : undefined; } + /** + * Multiply two numbers. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Math + * @param {number} multiplier The first number in a multiplication. + * @param {number} multiplicand The second number in a multiplication. + * @returns {number} Returns the product. + * @example + * + * _.multiply(6, 4); + * // => 24 + */ + var multiply = createMathOperation(function(multiplier, multiplicand) { + return multiplier * multiplicand; + }); + /** * Computes `number` rounded to `precision`. * * @static * @memberOf _ + * @since 3.10.0 * @category Math * @param {number} number The number to round. * @param {number} [precision=0] The precision to round to. @@ -14065,6 +15302,7 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {number} minuend The first number in a subtraction. * @param {number} subtrahend The second number in a subtraction. @@ -14074,25 +15312,16 @@ * _.subtract(6, 4); * // => 2 */ - function subtract(minuend, subtrahend) { - var result; - if (minuend === undefined && subtrahend === undefined) { - return 0; - } - if (minuend !== undefined) { - result = minuend; - } - if (subtrahend !== undefined) { - result = result === undefined ? subtrahend : (result - subtrahend); - } - return result; - } + var subtract = createMathOperation(function(minuend, subtrahend) { + return minuend - subtrahend; + }); /** * Computes the sum of the values in `array`. * * @static * @memberOf _ + * @since 3.4.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the sum. @@ -14114,9 +15343,11 @@ * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {number} Returns the sum. * @example * @@ -14137,39 +15368,7 @@ /*------------------------------------------------------------------------*/ - // Ensure wrappers are instances of `baseLodash`. - lodash.prototype = baseLodash.prototype; - - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; - - // Avoid inheriting from `Object.prototype` when possible. - Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; - - // Add functions to the `MapCache`. - MapCache.prototype.clear = mapClear; - MapCache.prototype['delete'] = mapDelete; - MapCache.prototype.get = mapGet; - MapCache.prototype.has = mapHas; - MapCache.prototype.set = mapSet; - - // Add functions to the `SetCache`. - SetCache.prototype.push = cachePush; - - // Add functions to the `Stack` cache. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - // Assign cache to `_.memoize`. - memoize.Cache = MapCache; - - // Add functions that return wrapped values when chaining. + // Add methods that return wrapped values in chain sequences. lodash.after = after; lodash.ary = ary; lodash.assign = assign; @@ -14181,6 +15380,7 @@ lodash.bind = bind; lodash.bindAll = bindAll; lodash.bindKey = bindKey; + lodash.castArray = castArray; lodash.chain = chain; lodash.chunk = chunk; lodash.compact = compact; @@ -14207,8 +15407,11 @@ lodash.fill = fill; lodash.filter = filter; lodash.flatMap = flatMap; + lodash.flatMapDeep = flatMapDeep; + lodash.flatMapDepth = flatMapDepth; lodash.flatten = flatten; lodash.flattenDeep = flattenDeep; + lodash.flattenDepth = flattenDepth; lodash.flip = flip; lodash.flow = flow; lodash.flowRight = flowRight; @@ -14258,6 +15461,7 @@ lodash.pull = pull; lodash.pullAll = pullAll; lodash.pullAllBy = pullAllBy; + lodash.pullAllWith = pullAllWith; lodash.pullAt = pullAt; lodash.range = range; lodash.rangeRight = rangeRight; @@ -14300,6 +15504,8 @@ lodash.unset = unset; lodash.unzip = unzip; lodash.unzipWith = unzipWith; + lodash.update = update; + lodash.updateWith = updateWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.without = without; @@ -14314,15 +15520,17 @@ lodash.zipWith = zipWith; // Add aliases. + lodash.entries = toPairs; + lodash.entriesIn = toPairsIn; lodash.extend = assignIn; lodash.extendWith = assignInWith; - // Add functions to `lodash.prototype`. + // Add methods to `lodash.prototype`. mixin(lodash, lodash); /*------------------------------------------------------------------------*/ - // Add functions that return unwrapped values when chaining. + // Add methods that return unwrapped values in chain sequences. lodash.add = add; lodash.attempt = attempt; lodash.camelCase = camelCase; @@ -14334,6 +15542,7 @@ lodash.cloneDeepWith = cloneDeepWith; lodash.cloneWith = cloneWith; lodash.deburr = deburr; + lodash.divide = divide; lodash.endsWith = endsWith; lodash.eq = eq; lodash.escape = escape; @@ -14411,8 +15620,10 @@ lodash.max = max; lodash.maxBy = maxBy; lodash.mean = mean; + lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; + lodash.multiply = multiply; lodash.noConflict = noConflict; lodash.noop = noop; lodash.now = now; @@ -14483,7 +15694,7 @@ * * @static * @memberOf _ - * @type string + * @type {string} */ lodash.VERSION = VERSION; @@ -14505,7 +15716,10 @@ if (filtered) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { - result.__views__.push({ 'size': nativeMin(n, MAX_ARRAY_LENGTH), 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); + result.__views__.push({ + 'size': nativeMin(n, MAX_ARRAY_LENGTH), + 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') + }); } return result; }; @@ -14522,7 +15736,10 @@ LazyWrapper.prototype[methodName] = function(iteratee) { var result = this.clone(); - result.__iteratees__.push({ 'iteratee': getIteratee(iteratee, 3), 'type': type }); + result.__iteratees__.push({ + 'iteratee': getIteratee(iteratee, 3), + 'type': type + }); result.__filtered__ = result.__filtered__ || isFilter; return result; }; @@ -14646,7 +15863,7 @@ }; }); - // Add `Array` and `String` methods to `lodash.prototype`. + // Add `Array` methods to `lodash.prototype`. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', @@ -14655,15 +15872,16 @@ lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { - return func.apply(this.value(), args); + var value = this.value(); + return func.apply(isArray(value) ? value : [], args); } return this[chainName](function(value) { - return func.apply(value, args); + return func.apply(isArray(value) ? value : [], args); }); }; }); - // Map minified function names to their real names. + // Map minified method names to their real names. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { @@ -14674,18 +15892,20 @@ } }); - realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; + realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ + 'name': 'wrapper', + 'func': undefined + }]; - // Add functions to the lazy wrapper. + // Add methods to `LazyWrapper`. LazyWrapper.prototype.clone = lazyClone; LazyWrapper.prototype.reverse = lazyReverse; LazyWrapper.prototype.value = lazyValue; - // Add chaining functions to the `lodash` wrapper. + // Add chain sequence methods to the `lodash` wrapper. lodash.prototype.at = wrapperAt; lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; - lodash.prototype.flatMap = wrapperFlatMap; lodash.prototype.next = wrapperNext; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; diff --git a/tools/eslint/node_modules/lodash/lodash.min.js b/tools/eslint/node_modules/lodash/lodash.min.js new file mode 100644 index 00000000000000..e941d665ff11fd --- /dev/null +++ b/tools/eslint/node_modules/lodash/lodash.min.js @@ -0,0 +1,125 @@ +/** + * @license + * lodash 4.9.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * Build: `lodash -o ./dist/lodash.js` + */ +;(function(){function t(t,n){return t.set(n[0],n[1]),t}function n(t,n){return t.add(n),t}function r(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}function e(t,n,r,e){for(var u=-1,o=t.length;++un&&!o||!u||r&&!i&&f||e&&f)return 1;if(n>t&&!r||!f||o&&!e&&u||i&&u)return-1}return 0}function W(t){return function(n,r){var e; +return n===T&&r===T?0:(n!==T&&(e=n),r!==T&&(e=e===T?r:t(e,r)),e)}}function B(t){return Mt[t]}function C(t){return Lt[t]}function z(t){return"\\"+Ft[t]}function U(t,n,r){var e=t.length;for(n+=r?0:-1;r?n--:++n-1&&0==t%1&&(null==n?9007199254740991:n)>t}function $(t){for(var n,r=[];!(n=t.next()).done;)r.push(n.value); +return r}function D(t){var n=-1,r=Array(t.size);return t.forEach(function(t,e){r[++n]=[e,t]}),r}function F(t,n){for(var r=-1,e=t.length,u=0,o=[];++rr?false:(r==t.length-1?t.pop():zu.call(t,r,1),true)}function qt(t,n){var r=Vt(t,n);return 0>r?T:t[r][1]}function Vt(t,n){for(var r=t.length;r--;)if(je(t[r][0],n))return r;return-1}function Kt(t,n,r){ +var e=Vt(t,n);0>e?t.push([n,r]):t[e][1]=r}function Gt(t,n,r,e){return t===T||je(t,vu[r])&&!du.call(e,r)?n:t}function Ht(t,n,r){(r===T||je(t[n],r))&&(typeof n!="number"||r!==T||n in t)||(t[n]=r)}function Qt(t,n,r){var e=t[n];du.call(t,n)&&je(e,r)&&(r!==T||n in t)||(t[n]=r)}function Xt(t,n,r,e){return ao(t,function(t,u,o){n(e,t,r(t),o)}),e}function tn(t,n){return t&&ur(n,Je(n),t)}function nn(t,n){for(var r=-1,e=null==t,u=n.length,o=Array(u);++rr?r:t),n!==T&&(t=n>t?n:t)),t}function fn(t,n,r,e,o,i,f){var c;if(e&&(c=i?e(t,o,i,f):e(t)),c!==T)return c;if(!Re(t))return t;if(o=ti(t)){if(c=Mr(t),!n)return er(t,c)}else{var a=zr(t),l="[object Function]"==a||"[object GeneratorFunction]"==a;if(ni(t))return Xn(t,n);if("[object Object]"==a||"[object Arguments]"==a||l&&!i){if(M(t))return i?t:{};if(c=Lr(l?{}:t),!n)return ir(t,tn(c,t)); +}else{if(!Ut[a])return i?t:{};c=$r(t,a,fn,n)}}if(f||(f=new Ft),i=f.get(t))return i;if(f.set(t,c),!o)var s=r?bn(t,Je,Cr):Je(t);return u(s||t,function(u,o){s&&(o=u,u=t[o]),Qt(c,o,fn(u,n,r,e,o,t,f))}),c}function cn(t){var n=Je(t),r=n.length;return function(e){if(null==e)return!r;for(var u=r;u--;){var o=n[u],i=t[o],f=e[o];if(f===T&&!(o in Object(e))||!i(f))return false}return true}}function an(t){return Re(t)?Wu(t):{}}function ln(t,n,r){if(typeof t!="function")throw new pu("Expected a function");return Cu(function(){ +t.apply(T,r)},n)}function sn(t,n,r,e){var u=-1,o=f,i=true,l=t.length,s=[],h=n.length;if(!l)return s;r&&(n=a(n,O(r))),e?(o=c,i=false):n.length>=200&&(o=Dt,i=false,n=new $t(n));t:for(;++u0&&r(f)?n>1?_n(f,n-1,r,e,u):l(u,f):e||(u[u.length]=f)}return u}function vn(t,n){return t&&so(t,n,Je)}function gn(t,n){return t&&ho(t,n,Je)}function dn(t,n){return i(n,function(n){return Ee(t[n])})}function yn(t,n){n=Zr(n,t)?[n]:un(n);for(var r=0,e=n.length;null!=t&&e>r;)t=t[n[r++]];return r&&r==e?t:T}function bn(t,n,r){return n=n(t),ti(t)?n:l(n,r(t))}function xn(t,n){return du.call(t,n)||typeof t=="object"&&n in t&&null===Lu(Object(t))}function jn(t,n){return n in Object(t); +}function mn(t,n,r){for(var e=r?c:f,u=t[0].length,o=t.length,i=o,l=Array(o),s=1/0,h=[];i--;){var p=t[i];i&&n&&(p=a(p,O(n))),s=Pu(p.length,s),l[i]=r||!n&&(120>u||120>p.length)?T:new $t(i&&p)}var p=t[0],_=-1,v=l[0];t:for(;++_h.length;){var g=p[_],d=n?n(g):g;if(v?!Dt(v,d):!e(h,d,r)){for(i=o;--i;){var y=l[i];if(y?!Dt(y,d):!e(t[i],d,r))continue t}v&&v.push(d),h.push(g)}}return h}function wn(t,n,r){var e={};return vn(t,function(t,u,o){n(e,r(t),u,o)}),e}function An(t,n,e){return Zr(n,t)||(n=un(n), +t=Jr(t,n),n=ne(n)),n=null==t?t:t[n],null==n?T:r(n,t,e)}function On(t,n,r,e,u){if(t===n)n=true;else if(null==t||null==n||!Re(t)&&!We(n))n=t!==t&&n!==n;else t:{var o=ti(t),i=ti(n),f="[object Array]",c="[object Array]";o||(f=zr(t),f="[object Arguments]"==f?"[object Object]":f),i||(c=zr(n),c="[object Arguments]"==c?"[object Object]":c);var a="[object Object]"==f&&!M(t),i="[object Object]"==c&&!M(n);if((c=f==c)&&!a)u||(u=new Ft),n=o||$e(t)?kr(t,n,On,r,e,u):Er(t,n,f,On,r,e,u);else{if(!(2&e)&&(o=a&&du.call(t,"__wrapped__"), +f=i&&du.call(n,"__wrapped__"),o||f)){t=o?t.value():t,n=f?n.value():n,u||(u=new Ft),n=On(t,n,r,e,u);break t}if(c)n:if(u||(u=new Ft),o=2&e,f=Je(t),i=f.length,c=Je(n).length,i==c||o){for(a=i;a--;){var l=f[a];if(!(o?l in n:xn(n,l))){n=false;break n}}if(c=u.get(t))n=c==n;else{c=true,u.set(t,n);for(var s=o;++ae?c*("desc"==r[e]?-1:1):c;break t}}e=t.b-n.b}return e})}function zn(t,n){return t=Object(t),s(n,function(n,r){return r in t&&(n[r]=t[r]),n},{})}function Un(t,n){for(var r=-1,e=bn(t,Ye,yo),u=e.length,o={};++rn||n>9007199254740991)return r;do n%2&&(r+=t),(n=Mu(n/2))&&(t+=t);while(n);return r}function Pn(t,n,r,e){n=Zr(n,t)?[n]:un(n);for(var u=-1,o=n.length,i=o-1,f=t;null!=f&&++un&&(n=-n>u?0:u+n),r=r>u?u:r,0>r&&(r+=u),u=n>r?0:r-n>>>0,n>>>=0,r=Array(u);++e=u){for(;u>e;){var o=e+u>>>1,i=t[o];(r?n>=i:n>i)&&null!==i?e=o+1:u=o}return u}return Vn(t,n,uu,r)}function Vn(t,n,r,e){ +n=r(n);for(var u=0,o=t?t.length:0,i=n!==n,f=null===n,c=n===T;o>u;){var a=Mu((u+o)/2),l=r(t[a]),s=l!==T,h=l===l;(i?h||e:f?h&&s&&(e||null!=l):c?h&&(e||s):null==l?0:e?n>=l:n>l)?u=a+1:o=a}return Pu(o,4294967294)}function Kn(t,n){for(var r=0,e=t.length,u=t[0],o=n?n(u):u,i=o,f=1,c=[u];++re?n[e]:T);return i}function Xn(t,n){if(n)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function tr(t){var n=new t.constructor(t.byteLength);return new ku(n).set(new ku(t)),n}function nr(t,n,r,e){var u=-1,o=t.length,i=r.length,f=-1,c=n.length,a=Nu(o-i,0),l=Array(c+a);for(e=!e;++fu)&&(l[r[u]]=t[u]);for(;a--;)l[f++]=t[u++];return l}function rr(t,n,r,e){ +var u=-1,o=t.length,i=-1,f=r.length,c=-1,a=n.length,l=Nu(o-f,0),s=Array(l+a);for(e=!e;++uu)&&(s[l+r[i]]=t[u++]);return s}function er(t,n){var r=-1,e=t.length;for(n||(n=Array(e));++r1?r[u-1]:T,i=u>2?r[2]:T,o=typeof o=="function"?(u--,o):T;for(i&&Pr(r[0],r[1],i)&&(o=3>u?T:o,u=1),n=Object(n);++ei&&f[0]!==a&&f[i-1]!==a?[]:F(f,a),i-=c.length,e>i?wr(t,n,dr,u.placeholder,T,f,c,T,T,e-i):r(this&&this!==Jt&&this instanceof u?o:t,this,f); +}var o=_r(t);return u}function gr(t){return be(function(n){n=_n(n,1);var r=n.length,e=r,u=Ot.prototype.thru;for(t&&n.reverse();e--;){var o=n[e];if(typeof o!="function")throw new pu("Expected a function");if(u&&!i&&"wrapper"==Ir(o))var i=new Ot([],true)}for(e=i?e:r;++e=200)return i.plant(e).value(); +for(var u=0,t=r?n[u].apply(this,t):e;++ud)return j=F(b,j),wr(t,n,dr,l.placeholder,r,b,j,f,c,a-d);if(j=h?r:this,y=p?j[t]:t,d=b.length,f){x=b.length;for(var m=Pu(f.length,x),w=er(b);m--;){var A=f[m];b[m]=L(A,x)?w[A]:T}}else v&&d>1&&b.reverse();return s&&d>c&&(b.length=c), +this&&this!==Jt&&this instanceof l&&(y=g||_r(y)),y.apply(j,b)}var s=128&n,h=1&n,p=2&n,_=24&n,v=512&n,g=p?T:_r(t);return l}function yr(t,n){return function(r,e){return wn(r,t,n(e))}}function br(t){return be(function(n){return n=a(_n(n,1,Nr),Sr()),be(function(e){var u=this;return t(n,function(t){return r(t,u,e)})})})}function xr(t,n){n=n===T?" ":n+"";var r=n.length;return 2>r?r?Nn(n,t):n:(r=Nn(n,Uu(t/P(n))),St.test(n)?r.match(It).slice(0,t).join(""):r.slice(0,t))}function jr(t,n,e,u){function o(){for(var n=-1,c=arguments.length,a=-1,l=u.length,s=Array(l+c),h=this&&this!==Jt&&this instanceof o?f:t;++an?1:-1:Ze(e)||0;var u=-1;r=Nu(Uu((r-n)/(e||1)),0);for(var o=Array(r);r--;)o[t?r:++u]=n,n+=e;return o}}function wr(t,n,r,e,u,o,i,f,c,a){var l=8&n;f=f?er(f):T;var s=l?i:T;i=l?T:i;var h=l?o:T;return o=l?T:o,n=(n|(l?32:64))&~(l?64:32),4&n||(n&=-4),n=[t,n,u,h,s,o,i,f,c,a],r=r.apply(T,n), +Tr(t)&&bo(r,n),r.placeholder=e,r}function Ar(t){var n=su[t];return function(t,r){if(t=Ze(t),r=Ne(r)){var e=(Te(t)+"e").split("e"),e=n(e[0]+"e"+(+e[1]+r)),e=(Te(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return n(t)}}function Or(t,n,r,e,u,o,i,f){var c=2&n;if(!c&&typeof t!="function")throw new pu("Expected a function");var a=e?e.length:0;if(a||(n&=-97,e=u=T),i=i===T?i:Nu(Ne(i),0),f=f===T?f:Ne(f),a-=u?u.length:0,64&n){var l=e,s=u;e=u=T}var h=c?T:vo(t);return o=[t,n,r,e,u,l,s,o,i,f],h&&(r=o[1],t=h[1], +n=r|t,e=128==t&&8==r||128==t&&256==r&&h[8]>=o[7].length||384==t&&h[8]>=h[7].length&&8==r,131>n||e)&&(1&t&&(o[2]=h[2],n|=1&r?0:4),(r=h[3])&&(e=o[3],o[3]=e?nr(e,r,h[4]):er(r),o[4]=e?F(o[3],"__lodash_placeholder__"):er(h[4])),(r=h[5])&&(e=o[5],o[5]=e?rr(e,r,h[6]):er(r),o[6]=e?F(o[5],"__lodash_placeholder__"):er(h[6])),(r=h[7])&&(o[7]=er(r)),128&t&&(o[8]=null==o[8]?h[8]:Pu(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=n),t=o[0],n=o[1],r=o[2],e=o[3],u=o[4],f=o[9]=null==o[9]?c?0:t.length:Nu(o[9]-a,0), +!f&&24&n&&(n&=-25),(h?po:bo)(n&&1!=n?8==n||16==n?vr(t,n,f):32!=n&&33!=n||u.length?dr.apply(T,o):jr(t,n,r,e):sr(t,n,r),o)}function kr(t,n,r,e,u,o){var i=-1,f=2&u,c=1&u,a=t.length,l=n.length;if(!(a==l||f&&l>a))return false;if(l=o.get(t))return l==n;for(l=true,o.set(t,n);++in?0:n,e)):[]}function Xr(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Ne(n),n=e-n,Zn(t,0,0>n?0:n)):[]}function te(t){return t?t[0]:T}function ne(t){var n=t?t.length:0;return n?t[n-1]:T}function re(t,n){return t&&t.length&&n&&n.length?$n(t,n):t; +}function ee(t){return t?Tu.call(t):t}function ue(t){if(!t||!t.length)return[];var n=0;return t=i(t,function(t){return Oe(t)?(n=Nu(t.length,n),true):void 0}),w(n,function(n){return a(t,Mn(n))})}function oe(t,n){if(!t||!t.length)return[];var e=ue(t);return null==n?e:a(e,function(t){return r(n,T,t)})}function ie(t){return t=xt(t),t.__chain__=true,t}function fe(t,n){return n(t)}function ce(){return this}function ae(t,n){return typeof n=="function"&&ti(t)?u(t,n):ao(t,Sr(n))}function le(t,n){var r;if(typeof n=="function"&&ti(t)){ +for(r=t.length;r--&&false!==n(t[r],r,t););r=t}else r=lo(t,Sr(n));return r}function se(t,n){return(ti(t)?a:Sn)(t,Sr(n,3))}function he(t,n,r){var e=-1,u=Fe(t),o=u.length,i=o-1;for(n=(r?Pr(t,n,r):n===T)?1:on(Ne(n),0,o);++e=t&&(n=T),r}}function ve(t,n,r){return n=r?T:n,t=Or(t,8,T,T,T,T,T,n),t.placeholder=ve.placeholder,t}function ge(t,n,r){return n=r?T:n,t=Or(t,16,T,T,T,T,T,n),t.placeholder=ge.placeholder,t}function de(t,n,r){function e(n){var r=c,e=a;return c=a=T,p=n,l=t.apply(e,r)}function u(t){var r=t-h;return t-=p,!h||r>=n||0>r||false!==v&&t>=v}function o(){var t=To();if(u(t))return i(t);var r;r=t-p,t=n-(t-h),r=false===v?t:Pu(t,v-r),s=Cu(o,r)}function i(t){return Eu(s),s=T,g&&c?e(t):(c=a=T,l)}function f(){var t=To(),r=u(t); +return c=arguments,a=this,h=t,r?s===T?(p=t=h,s=Cu(o,n),_?e(t):l):(Eu(s),s=Cu(o,n),e(h)):l}var c,a,l,s,h=0,p=0,_=false,v=false,g=true;if(typeof t!="function")throw new pu("Expected a function");return n=Ze(n)||0,Re(r)&&(_=!!r.leading,v="maxWait"in r&&Nu(Ze(r.maxWait)||0,n),g="trailing"in r?!!r.trailing:g),f.cancel=function(){s!==T&&Eu(s),h=p=0,c=a=s=T},f.flush=function(){return s===T?l:i(To())},f}function ye(t,n){function r(){var e=arguments,u=n?n.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=t.apply(this,e), +r.cache=o.set(u,e),e)}if(typeof t!="function"||n&&typeof n!="function")throw new pu("Expected a function");return r.cache=new(ye.Cache||Lt),r}function be(t,n){if(typeof t!="function")throw new pu("Expected a function");return n=Nu(n===T?t.length-1:Ne(n),0),function(){for(var e=arguments,u=-1,o=Nu(e.length-n,0),i=Array(o);++un}function we(t){return Oe(t)&&du.call(t,"callee")&&(!Bu.call(t,"callee")||"[object Arguments]"==xu.call(t))}function Ae(t){return null!=t&&Se(go(t))&&!Ee(t)}function Oe(t){return We(t)&&Ae(t)}function ke(t){return We(t)?"[object Error]"==xu.call(t)||typeof t.message=="string"&&typeof t.name=="string":false}function Ee(t){return t=Re(t)?xu.call(t):"", +"[object Function]"==t||"[object GeneratorFunction]"==t}function Ie(t){return typeof t=="number"&&t==Ne(t)}function Se(t){return typeof t=="number"&&t>-1&&0==t%1&&9007199254740991>=t}function Re(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function We(t){return!!t&&typeof t=="object"}function Be(t){return Re(t)?(Ee(t)||M(t)?mu:yt).test(Yr(t)):false}function Ce(t){return typeof t=="number"||We(t)&&"[object Number]"==xu.call(t)}function ze(t){return!We(t)||"[object Object]"!=xu.call(t)||M(t)?false:(t=Lu(Object(t)), +null===t?true:(t=du.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&gu.call(t)==bu))}function Ue(t){return Re(t)&&"[object RegExp]"==xu.call(t)}function Me(t){return typeof t=="string"||!ti(t)&&We(t)&&"[object String]"==xu.call(t)}function Le(t){return typeof t=="symbol"||We(t)&&"[object Symbol]"==xu.call(t)}function $e(t){return We(t)&&Se(t.length)&&!!zt[xu.call(t)]}function De(t,n){return n>t}function Fe(t){if(!t)return[];if(Ae(t))return Me(t)?t.match(It):er(t);if(Ru&&t[Ru])return $(t[Ru]()); +var n=zr(t);return("[object Map]"==n?D:"[object Set]"==n?N:Xe)(t)}function Ne(t){if(!t)return 0===t?t:0;if(t=Ze(t),t===V||t===-V)return 1.7976931348623157e308*(0>t?-1:1);var n=t%1;return t===t?n?t-n:t:0}function Pe(t){return t?on(Ne(t),0,4294967295):0}function Ze(t){if(typeof t=="number")return t;if(Le(t))return K;if(Re(t)&&(t=Ee(t.valueOf)?t.valueOf():t,t=Re(t)?t+"":t),typeof t!="string")return 0===t?t:+t;t=t.replace(at,"");var n=dt.test(t);return n||bt.test(t)?Pt(t.slice(2),n?2:8):gt.test(t)?K:+t; +}function qe(t){return ur(t,Ye(t))}function Te(t){if(typeof t=="string")return t;if(null==t)return"";if(Le(t))return co?co.call(t):"";var n=t+"";return"0"==n&&1/t==-V?"-0":n}function Ve(t,n,r){return t=null==t?T:yn(t,n),t===T?r:t}function Ke(t,n){return null!=t&&Ur(t,n,xn)}function Ge(t,n){return null!=t&&Ur(t,n,jn)}function Je(t){var n=Vr(t);if(!n&&!Ae(t))return Fu(Object(t));var r,e=Dr(t),u=!!e,e=e||[],o=e.length;for(r in t)!xn(t,r)||u&&("length"==r||L(r,o))||n&&"constructor"==r||e.push(r);return e; +}function Ye(t){for(var n=-1,r=Vr(t),e=In(t),u=e.length,o=Dr(t),i=!!o,o=o||[],f=o.length;++ne.length?Kt(e,t,n):(r.array=null,r.map=new Lt(e))),(r=r.map)&&r.set(t,n),this};var ao=ar(vn),lo=ar(gn,true),so=lr(),ho=lr(true);Iu&&!Bu.call({valueOf:1},"valueOf")&&(In=function(t){return $(Iu(t))});var po=Qu?function(t,n){return Qu.set(t,n),t}:uu,_o=Ju&&2===new Ju([1,2]).size?function(t){ +return new Ju(t)}:fu,vo=Qu?function(t){return Qu.get(t)}:fu,go=Mn("length");Su||(Cr=function(){return[]});var yo=Su?function(t){for(var n=[];t;)l(n,Cr(t)),t=Lu(Object(t));return n}:Cr;(Vu&&"[object DataView]"!=zr(new Vu(new ArrayBuffer(1)))||Ku&&"[object Map]"!=zr(new Ku)||Gu&&"[object Promise]"!=zr(Gu.resolve())||Ju&&"[object Set]"!=zr(new Ju)||Yu&&"[object WeakMap]"!=zr(new Yu))&&(zr=function(t){var n=xu.call(t);if(t=(t="[object Object]"==n?t.constructor:T)?Yr(t):T)switch(t){case no:return"[object DataView]"; +case ro:return"[object Map]";case eo:return"[object Promise]";case uo:return"[object Set]";case oo:return"[object WeakMap]"}return n});var bo=function(){var t=0,n=0;return function(r,e){var u=To(),o=16-(u-n);if(n=u,o>0){if(150<=++t)return r}else t=0;return po(r,e)}}(),xo=ye(function(t){var n=[];return Te(t).replace(it,function(t,r,e,u){n.push(e?u.replace(ht,"$1"):r||t)}),n}),jo=be(function(t,n){return Oe(t)?sn(t,_n(n,1,Oe,true)):[]}),mo=be(function(t,n){var r=ne(n);return Oe(r)&&(r=T),Oe(t)?sn(t,_n(n,1,Oe,true),Sr(r)):[]; +}),wo=be(function(t,n){var r=ne(n);return Oe(r)&&(r=T),Oe(t)?sn(t,_n(n,1,Oe,true),T,r):[]}),Ao=be(function(t){var n=a(t,rn);return n.length&&n[0]===t[0]?mn(n):[]}),Oo=be(function(t){var n=ne(t),r=a(t,rn);return n===ne(r)?n=T:r.pop(),r.length&&r[0]===t[0]?mn(r,Sr(n)):[]}),ko=be(function(t){var n=ne(t),r=a(t,rn);return n===ne(r)?n=T:r.pop(),r.length&&r[0]===t[0]?mn(r,T,n):[]}),Eo=be(re),Io=be(function(t,n){n=a(_n(n,1),String);var r=nn(t,n);return Dn(t,n.sort(R)),r}),So=be(function(t){return Gn(_n(t,1,Oe,true)); +}),Ro=be(function(t){var n=ne(t);return Oe(n)&&(n=T),Gn(_n(t,1,Oe,true),Sr(n))}),Wo=be(function(t){var n=ne(t);return Oe(n)&&(n=T),Gn(_n(t,1,Oe,true),T,n)}),Bo=be(function(t,n){return Oe(t)?sn(t,n):[]}),Co=be(function(t){return Hn(i(t,Oe))}),zo=be(function(t){var n=ne(t);return Oe(n)&&(n=T),Hn(i(t,Oe),Sr(n))}),Uo=be(function(t){var n=ne(t);return Oe(n)&&(n=T),Hn(i(t,Oe),T,n)}),Mo=be(ue),Lo=be(function(t){var n=t.length,n=n>1?t[n-1]:T,n=typeof n=="function"?(t.pop(),n):T;return oe(t,n)}),$o=be(function(t){ +function n(n){return nn(n,t)}t=_n(t,1);var r=t.length,e=r?t[0]:0,u=this.__wrapped__;return 1>=r&&!this.__actions__.length&&u instanceof kt&&L(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:fe,args:[n],thisArg:T}),new Ot(u,this.__chain__).thru(function(t){return r&&!t.length&&t.push(T),t})):this.thru(n)}),Do=fr(function(t,n,r){du.call(t,r)?++t[r]:t[r]=1}),Fo=fr(function(t,n,r){du.call(t,r)?t[r].push(n):t[r]=[n]}),No=be(function(t,n,e){var u=-1,o=typeof n=="function",i=Zr(n),f=Ae(t)?Array(t.length):[]; +return ao(t,function(t){var c=o?n:i&&null!=t?t[n]:T;f[++u]=c?r(c,t,e):An(t,n,e)}),f}),Po=fr(function(t,n,r){t[r]=n}),Zo=fr(function(t,n,r){t[r?0:1].push(n)},function(){return[[],[]]}),qo=be(function(t,n){if(null==t)return[];var r=n.length;return r>1&&Pr(t,n[0],n[1])?n=[]:r>2&&Pr(n[0],n[1],n[2])&&(n.length=1),Cn(t,_n(n,1),[])}),To=au.now,Vo=be(function(t,n,r){var e=1;if(r.length)var u=F(r,Br(Vo)),e=32|e;return Or(t,e,n,r,u)}),Ko=be(function(t,n,r){var e=3;if(r.length)var u=F(r,Br(Ko)),e=32|e;return Or(n,e,t,r,u); +}),Go=be(function(t,n){return ln(t,1,n)}),Jo=be(function(t,n,r){return ln(t,Ze(n)||0,r)});ye.Cache=Lt;var Yo=be(function(t,n){n=a(_n(n,1,Nr),Sr());var e=n.length;return be(function(u){for(var o=-1,i=Pu(u.length,e);++o--t?n.apply(this,arguments):void 0}},xt.ary=pe,xt.assign=ri,xt.assignIn=ei,xt.assignInWith=ui,xt.assignWith=oi,xt.at=ii,xt.before=_e,xt.bind=Vo,xt.bindAll=Oi,xt.bindKey=Ko,xt.castArray=xe,xt.chain=ie,xt.chunk=function(t,n,r){if(n=(r?Pr(t,n,r):n===T)?1:Nu(Ne(n),0),r=t?t.length:0, +!r||1>n)return[];for(var e=0,u=0,o=Array(Uu(r/n));r>e;)o[u++]=Zn(t,e,e+=n);return o},xt.compact=function(t){for(var n=-1,r=t?t.length:0,e=0,u=[];++nt)return t?er(n):[];for(var r=Array(t-1);t--;)r[t-1]=arguments[t];for(var t=_n(r,1),r=-1,e=n.length,u=-1,o=t.length,i=Array(e+o);++rr&&(r=-r>u?0:u+r),e=e===T||e>u?u:Ne(e),0>e&&(e+=u),e=r>e?0:Pe(e);e>r;)t[r++]=n;return t},xt.filter=function(t,n){return(ti(t)?i:pn)(t,Sr(n,3))},xt.flatMap=function(t,n){return _n(se(t,n),1)},xt.flatMapDeep=function(t,n){return _n(se(t,n),V)},xt.flatMapDepth=function(t,n,r){ +return r=r===T?1:Ne(r),_n(se(t,n),r)},xt.flatten=function(t){return t&&t.length?_n(t,1):[]},xt.flattenDeep=function(t){return t&&t.length?_n(t,V):[]},xt.flattenDepth=function(t,n){return t&&t.length?(n=n===T?1:Ne(n),_n(t,n)):[]},xt.flip=function(t){return Or(t,512)},xt.flow=ki,xt.flowRight=Ei,xt.fromPairs=function(t){for(var n=-1,r=t?t.length:0,e={};++nr?0:r)):t.split(n,r)},xt.spread=function(t,n){if(typeof t!="function")throw new pu("Expected a function"); +return n=n===T?0:Nu(Ne(n),0),be(function(e){var u=e[n];return e=e.slice(0,n),u&&l(e,u),r(t,this,e)})},xt.tail=function(t){return Qr(t,1)},xt.take=function(t,n,r){return t&&t.length?(n=r||n===T?1:Ne(n),Zn(t,0,0>n?0:n)):[]},xt.takeRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Ne(n),n=e-n,Zn(t,0>n?0:n,e)):[]},xt.takeRightWhile=function(t,n){return t&&t.length?Jn(t,Sr(n,3),false,true):[]},xt.takeWhile=function(t,n){return t&&t.length?Jn(t,Sr(n,3)):[]},xt.tap=function(t,n){return n(t),t}, +xt.throttle=function(t,n,r){var e=true,u=true;if(typeof t!="function")throw new pu("Expected a function");return Re(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),de(t,n,{leading:e,maxWait:n,trailing:u})},xt.thru=fe,xt.toArray=Fe,xt.toPairs=He,xt.toPairsIn=Qe,xt.toPath=function(t){return ti(t)?a(t,en):Le(t)?[t]:er(xo(t))},xt.toPlainObject=qe,xt.transform=function(t,n,r){var e=ti(t)||$e(t);if(n=Sr(n,4),null==r)if(e||Re(t)){var o=t.constructor;r=e?ti(t)?new o:[]:Ee(o)?an(Lu(Object(t))):{}; +}else r={};return(e?u:vn)(t,function(t,e,u){return n(r,t,e,u)}),r},xt.unary=function(t){return pe(t,1)},xt.union=So,xt.unionBy=Ro,xt.unionWith=Wo,xt.uniq=function(t){return t&&t.length?Gn(t):[]},xt.uniqBy=function(t,n){return t&&t.length?Gn(t,Sr(n)):[]},xt.uniqWith=function(t,n){return t&&t.length?Gn(t,T,n):[]},xt.unset=function(t,n){var r;if(null==t)r=true;else{r=t;var e=n,e=Zr(e,r)?[e]:un(e);r=Jr(r,e),e=ne(e),r=null!=r&&Ke(r,e)?delete r[e]:true}return r},xt.unzip=ue,xt.unzipWith=oe,xt.update=function(t,n,r){ +return null==t?t:Pn(t,n,(typeof r=="function"?r:uu)(yn(t,n)),void 0)},xt.updateWith=function(t,n,r,e){return e=typeof e=="function"?e:T,null!=t&&(t=Pn(t,n,(typeof r=="function"?r:uu)(yn(t,n)),e)),t},xt.values=Xe,xt.valuesIn=function(t){return null==t?[]:k(t,Ye(t))},xt.without=Bo,xt.words=ru,xt.wrap=function(t,n){return n=null==n?uu:n,Ho(n,t)},xt.xor=Co,xt.xorBy=zo,xt.xorWith=Uo,xt.zip=Mo,xt.zipObject=function(t,n){return Qn(t||[],n||[],Qt)},xt.zipObjectDeep=function(t,n){return Qn(t||[],n||[],Pn); +},xt.zipWith=Lo,xt.entries=He,xt.entriesIn=Qe,xt.extend=ei,xt.extendWith=ui,iu(xt,xt),xt.add=Ui,xt.attempt=Ai,xt.camelCase=gi,xt.capitalize=tu,xt.ceil=Mi,xt.clamp=function(t,n,r){return r===T&&(r=n,n=T),r!==T&&(r=Ze(r),r=r===r?r:0),n!==T&&(n=Ze(n),n=n===n?n:0),on(Ze(t),n,r)},xt.clone=function(t){return fn(t,false,true)},xt.cloneDeep=function(t){return fn(t,true,true)},xt.cloneDeepWith=function(t,n){return fn(t,true,true,n)},xt.cloneWith=function(t,n){return fn(t,false,true,n)},xt.deburr=nu,xt.divide=Li,xt.endsWith=function(t,n,r){ +t=Te(t),n=typeof n=="string"?n:n+"";var e=t.length;return r=r===T?e:on(Ne(r),0,e),r-=n.length,r>=0&&t.indexOf(n,r)==r},xt.eq=je,xt.escape=function(t){return(t=Te(t))&&tt.test(t)?t.replace(Q,C):t},xt.escapeRegExp=function(t){return(t=Te(t))&&ct.test(t)?t.replace(ft,"\\$&"):t},xt.every=function(t,n,r){var e=ti(t)?o:hn;return r&&Pr(t,n,r)&&(n=T),e(t,Sr(n,3))},xt.find=function(t,n){if(n=Sr(n,3),ti(t)){var r=g(t,n);return r>-1?t[r]:T}return v(t,n,ao)},xt.findIndex=function(t,n){return t&&t.length?g(t,Sr(n,3)):-1; +},xt.findKey=function(t,n){return v(t,Sr(n,3),vn,true)},xt.findLast=function(t,n){if(n=Sr(n,3),ti(t)){var r=g(t,n,true);return r>-1?t[r]:T}return v(t,n,lo)},xt.findLastIndex=function(t,n){return t&&t.length?g(t,Sr(n,3),true):-1},xt.findLastKey=function(t,n){return v(t,Sr(n,3),gn,true)},xt.floor=$i,xt.forEach=ae,xt.forEachRight=le,xt.forIn=function(t,n){return null==t?t:so(t,Sr(n),Ye)},xt.forInRight=function(t,n){return null==t?t:ho(t,Sr(n),Ye)},xt.forOwn=function(t,n){return t&&vn(t,Sr(n))},xt.forOwnRight=function(t,n){ +return t&&gn(t,Sr(n))},xt.get=Ve,xt.gt=me,xt.gte=function(t,n){return t>=n},xt.has=Ke,xt.hasIn=Ge,xt.head=te,xt.identity=uu,xt.includes=function(t,n,r,e){return t=Ae(t)?t:Xe(t),r=r&&!e?Ne(r):0,e=t.length,0>r&&(r=Nu(e+r,0)),Me(t)?e>=r&&-1r&&(r=Nu(e+r,0)),d(t,n,r)):-1},xt.inRange=function(t,n,r){return n=Ze(n)||0,r===T?(r=n,n=0):r=Ze(r)||0,t=Ze(t),t>=Pu(n,r)&&t=-9007199254740991&&9007199254740991>=t},xt.isSet=function(t){return We(t)&&"[object Set]"==zr(t)},xt.isString=Me,xt.isSymbol=Le,xt.isTypedArray=$e,xt.isUndefined=function(t){return t===T},xt.isWeakMap=function(t){return We(t)&&"[object WeakMap]"==zr(t); +},xt.isWeakSet=function(t){return We(t)&&"[object WeakSet]"==xu.call(t)},xt.join=function(t,n){return t?Du.call(t,n):""},xt.kebabCase=di,xt.last=ne,xt.lastIndexOf=function(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e;if(r!==T&&(u=Ne(r),u=(0>u?Nu(e+u,0):Pu(u,e-1))+1),n!==n)return U(t,u,true);for(;u--;)if(t[u]===n)return u;return-1},xt.lowerCase=yi,xt.lowerFirst=bi,xt.lt=De,xt.lte=function(t,n){return n>=t},xt.max=function(t){return t&&t.length?_(t,uu,me):T},xt.maxBy=function(t,n){return t&&t.length?_(t,Sr(n),me):T; +},xt.mean=function(t){return b(t,uu)},xt.meanBy=function(t,n){return b(t,Sr(n))},xt.min=function(t){return t&&t.length?_(t,uu,De):T},xt.minBy=function(t,n){return t&&t.length?_(t,Sr(n),De):T},xt.multiply=Di,xt.noConflict=function(){return Jt._===this&&(Jt._=ju),this},xt.noop=fu,xt.now=To,xt.pad=function(t,n,r){t=Te(t);var e=(n=Ne(n))?P(t):0;return n&&n>e?(n=(n-e)/2,xr(Mu(n),r)+t+xr(Uu(n),r)):t},xt.padEnd=function(t,n,r){t=Te(t);var e=(n=Ne(n))?P(t):0;return n&&n>e?t+xr(n-e,r):t},xt.padStart=function(t,n,r){ +t=Te(t);var e=(n=Ne(n))?P(t):0;return n&&n>e?xr(n-e,r)+t:t},xt.parseInt=function(t,n,r){return r||null==n?n=0:n&&(n=+n),t=Te(t).replace(at,""),Zu(t,n||(vt.test(t)?16:10))},xt.random=function(t,n,r){if(r&&typeof r!="boolean"&&Pr(t,n,r)&&(n=r=T),r===T&&(typeof n=="boolean"?(r=n,n=T):typeof t=="boolean"&&(r=t,t=T)),t===T&&n===T?(t=0,n=1):(t=Ze(t)||0,n===T?(n=t,t=0):n=Ze(n)||0),t>n){var e=t;t=n,n=e}return r||t%1||n%1?(r=qu(),Pu(t+r*(n-t+Nt("1e-"+((r+"").length-1))),n)):Fn(t,n)},xt.reduce=function(t,n,r){ +var e=ti(t)?s:x,u=3>arguments.length;return e(t,Sr(n,4),r,u,ao)},xt.reduceRight=function(t,n,r){var e=ti(t)?h:x,u=3>arguments.length;return e(t,Sr(n,4),r,u,lo)},xt.repeat=function(t,n,r){return n=(r?Pr(t,n,r):n===T)?1:Ne(n),Nn(Te(t),n)},xt.replace=function(){var t=arguments,n=Te(t[0]);return 3>t.length?n:n.replace(t[1],t[2])},xt.result=function(t,n,r){n=Zr(n,t)?[n]:un(n);var e=-1,u=n.length;for(u||(t=T,u=1);++e0?t[Fn(0,n-1)]:T},xt.size=function(t){if(null==t)return 0;if(Ae(t)){var n=t.length;return n&&Me(t)?P(t):n}return We(t)&&(n=zr(t),"[object Map]"==n||"[object Set]"==n)?t.size:Je(t).length},xt.snakeCase=xi,xt.some=function(t,n,r){var e=ti(t)?p:qn;return r&&Pr(t,n,r)&&(n=T),e(t,Sr(n,3))},xt.sortedIndex=function(t,n){return Tn(t,n)},xt.sortedIndexBy=function(t,n,r){return Vn(t,n,Sr(r))},xt.sortedIndexOf=function(t,n){var r=t?t.length:0; +if(r){var e=Tn(t,n);if(r>e&&je(t[e],n))return e}return-1},xt.sortedLastIndex=function(t,n){return Tn(t,n,true)},xt.sortedLastIndexBy=function(t,n,r){return Vn(t,n,Sr(r),true)},xt.sortedLastIndexOf=function(t,n){if(t&&t.length){var r=Tn(t,n,true)-1;if(je(t[r],n))return r}return-1},xt.startCase=ji,xt.startsWith=function(t,n,r){return t=Te(t),r=on(Ne(r),0,t.length),t.lastIndexOf(n,r)==r},xt.subtract=Ni,xt.sum=function(t){return t&&t.length?m(t,uu):0},xt.sumBy=function(t,n){return t&&t.length?m(t,Sr(n)):0}, +xt.template=function(t,n,r){var e=xt.templateSettings;r&&Pr(t,n,r)&&(n=T),t=Te(t),n=ui({},n,e,Gt),r=ui({},n.imports,e.imports,Gt);var u,o,i=Je(r),f=k(r,i),c=0;r=n.interpolate||mt;var a="__p+='";r=hu((n.escape||mt).source+"|"+r.source+"|"+(r===et?pt:mt).source+"|"+(n.evaluate||mt).source+"|$","g");var l="sourceURL"in n?"//# sourceURL="+n.sourceURL+"\n":"";if(t.replace(r,function(n,r,e,i,f,l){return e||(e=i),a+=t.slice(c,l).replace(wt,z),r&&(u=true,a+="'+__e("+r+")+'"),f&&(o=true,a+="';"+f+";\n__p+='"), +e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+n.length,n}),a+="';",(n=n.variable)||(a="with(obj){"+a+"}"),a=(o?a.replace(G,""):a).replace(J,"$1").replace(Y,"$1;"),a="function("+(n||"obj")+"){"+(n?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",n=Ai(function(){return Function(i,l+"return "+a).apply(T,f)}),n.source=a,ke(n))throw n;return n},xt.times=function(t,n){if(t=Ne(t),1>t||t>9007199254740991)return[]; +var r=4294967295,e=Pu(t,4294967295);for(n=Sr(n),t-=4294967295,e=w(e,n);++r=o)return t;if(o=r-P(e),1>o)return e; +if(r=i?i.slice(0,o).join(""):t.slice(0,o),u===T)return r+e;if(i&&(o+=r.length-o),Ue(u)){if(t.slice(o).search(u)){var f=r;for(u.global||(u=hu(u.source,Te(_t.exec(u))+"g")),u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===T?o:c)}}else t.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),u>-1&&(r=r.slice(0,u)));return r+e},xt.unescape=function(t){return(t=Te(t))&&X.test(t)?t.replace(H,Z):t},xt.uniqueId=function(t){var n=++yu;return Te(t)+n},xt.upperCase=mi,xt.upperFirst=wi,xt.each=ae,xt.eachRight=le,xt.first=te, +iu(xt,function(){var t={};return vn(xt,function(n,r){du.call(xt.prototype,r)||(t[r]=n)}),t}(),{chain:false}),xt.VERSION="4.9.0",u("bind bindKey curry curryRight partial partialRight".split(" "),function(t){xt[t].placeholder=xt}),u(["drop","take"],function(t,n){kt.prototype[t]=function(r){var e=this.__filtered__;if(e&&!n)return new kt(this);r=r===T?1:Nu(Ne(r),0);var u=this.clone();return e?u.__takeCount__=Pu(r,u.__takeCount__):u.__views__.push({size:Pu(r,4294967295),type:t+(0>u.__dir__?"Right":"")}), +u},kt.prototype[t+"Right"]=function(n){return this.reverse()[t](n).reverse()}}),u(["filter","map","takeWhile"],function(t,n){var r=n+1,e=1==r||3==r;kt.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({iteratee:Sr(t,3),type:r}),n.__filtered__=n.__filtered__||e,n}}),u(["head","last"],function(t,n){var r="take"+(n?"Right":"");kt.prototype[t]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(t,n){var r="drop"+(n?"":"Right");kt.prototype[t]=function(){return this.__filtered__?new kt(this):this[r](1); +}}),kt.prototype.compact=function(){return this.filter(uu)},kt.prototype.find=function(t){return this.filter(t).head()},kt.prototype.findLast=function(t){return this.reverse().find(t)},kt.prototype.invokeMap=be(function(t,n){return typeof t=="function"?new kt(this):this.map(function(r){return An(r,t,n)})}),kt.prototype.reject=function(t){return t=Sr(t,3),this.filter(function(n){return!t(n)})},kt.prototype.slice=function(t,n){t=Ne(t);var r=this;return r.__filtered__&&(t>0||0>n)?new kt(r):(0>t?r=r.takeRight(-t):t&&(r=r.drop(t)), +n!==T&&(n=Ne(n),r=0>n?r.dropRight(-n):r.take(n-t)),r)},kt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},kt.prototype.toArray=function(){return this.take(4294967295)},vn(kt.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),e=/^(?:head|last)$/.test(n),u=xt[e?"take"+("last"==n?"Right":""):n],o=e||/^find/.test(n);u&&(xt.prototype[n]=function(){function n(t){return t=u.apply(xt,l([t],f)),e&&h?t[0]:t}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof kt,a=f[0],s=c||ti(i); +s&&r&&typeof a=="function"&&1!=a.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,a=o&&!h,c=c&&!p;return!o&&s?(i=c?i:new kt(this),i=t.apply(i,f),i.__actions__.push({func:fe,args:[n],thisArg:T}),new Ot(i,h)):a&&c?t.apply(this,f):(i=this.thru(n),a?e?i.value()[0]:i.value():i)})}),u("pop push shift sort splice unshift".split(" "),function(t){var n=_u[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",e=/^(?:pop|shift)$/.test(t);xt.prototype[t]=function(){var t=arguments;if(e&&!this.__chain__){ +var u=this.value();return n.apply(ti(u)?u:[],t)}return this[r](function(r){return n.apply(ti(r)?r:[],t)})}}),vn(kt.prototype,function(t,n){var r=xt[n];if(r){var e=r.name+"";(to[e]||(to[e]=[])).push({name:n,func:r})}}),to[dr(T,2).name]=[{name:"wrapper",func:T}],kt.prototype.clone=function(){var t=new kt(this.__wrapped__);return t.__actions__=er(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=er(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=er(this.__views__), +t},kt.prototype.reverse=function(){if(this.__filtered__){var t=new kt(this);t.__dir__=-1,t.__filtered__=true}else t=this.clone(),t.__dir__*=-1;return t},kt.prototype.value=function(){var t,n=this.__wrapped__.value(),r=this.__dir__,e=ti(n),u=0>r,o=e?n.length:0;t=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++co||o==t&&a==t)return Yn(n,this.__actions__);e=[];t:for(;t--&&a>c;){for(u+=r,o=-1,l=n[u];++o=this.__values__.length,n=t?T:this.__values__[this.__index__++];return{done:t,value:n}},xt.prototype.plant=function(t){for(var n,r=this;r instanceof At;){var e=Hr(r);e.__index__=0,e.__values__=T,n?u.__wrapped__=e:n=e;var u=e,r=r.__wrapped__}return u.__wrapped__=t,n},xt.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof kt?(this.__actions__.length&&(t=new kt(this)),t=t.reverse(),t.__actions__.push({func:fe,args:[ee],thisArg:T}),new Ot(t,this.__chain__)):this.thru(ee); +},xt.prototype.toJSON=xt.prototype.valueOf=xt.prototype.value=function(){return Yn(this.__wrapped__,this.__actions__)},Ru&&(xt.prototype[Ru]=ce),xt}var T,V=1/0,K=NaN,G=/\b__p\+='';/g,J=/\b(__p\+=)''\+/g,Y=/(__e\(.*?\)|\b__t\))\+'';/g,H=/&(?:amp|lt|gt|quot|#39|#96);/g,Q=/[&<>"'`]/g,X=RegExp(H.source),tt=RegExp(Q.source),nt=/<%-([\s\S]+?)%>/g,rt=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ot=/^\w*$/,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,ft=/[\\^$.*+?()[\]{}|]/g,ct=RegExp(ft.source),at=/^\s+|\s+$/g,lt=/^\s+/,st=/\s+$/,ht=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,vt=/^0x/i,gt=/^[-+]0x[0-9a-f]+$/i,dt=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,bt=/^0o[0-7]+$/i,xt=/^(?:0|[1-9]\d*)$/,jt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,mt=/($^)/,wt=/['\n\r\u2028\u2029\\]/g,At="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?)*",Ot="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+At,kt="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]?|[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",Et=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),It=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+kt+At,"g"),St=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),Rt=/[a-zA-Z0-9]+/g,Wt=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|\\d+",Ot].join("|"),"g"),Bt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ct="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise Reflect RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),zt={}; +zt["[object Float32Array]"]=zt["[object Float64Array]"]=zt["[object Int8Array]"]=zt["[object Int16Array]"]=zt["[object Int32Array]"]=zt["[object Uint8Array]"]=zt["[object Uint8ClampedArray]"]=zt["[object Uint16Array]"]=zt["[object Uint32Array]"]=true,zt["[object Arguments]"]=zt["[object Array]"]=zt["[object ArrayBuffer]"]=zt["[object Boolean]"]=zt["[object DataView]"]=zt["[object Date]"]=zt["[object Error]"]=zt["[object Function]"]=zt["[object Map]"]=zt["[object Number]"]=zt["[object Object]"]=zt["[object RegExp]"]=zt["[object Set]"]=zt["[object String]"]=zt["[object WeakMap]"]=false; +var Ut={};Ut["[object Arguments]"]=Ut["[object Array]"]=Ut["[object ArrayBuffer]"]=Ut["[object DataView]"]=Ut["[object Boolean]"]=Ut["[object Date]"]=Ut["[object Float32Array]"]=Ut["[object Float64Array]"]=Ut["[object Int8Array]"]=Ut["[object Int16Array]"]=Ut["[object Int32Array]"]=Ut["[object Map]"]=Ut["[object Number]"]=Ut["[object Object]"]=Ut["[object RegExp]"]=Ut["[object Set]"]=Ut["[object String]"]=Ut["[object Symbol]"]=Ut["[object Uint8Array]"]=Ut["[object Uint8ClampedArray]"]=Ut["[object Uint16Array]"]=Ut["[object Uint32Array]"]=true, +Ut["[object Error]"]=Ut["[object Function]"]=Ut["[object WeakMap]"]=false;var Mt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O", +"\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Lt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$t={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Dt={"function":true,object:true},Ft={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029" +},Nt=parseFloat,Pt=parseInt,Zt=Dt[typeof exports]&&exports&&!exports.nodeType?exports:T,qt=Dt[typeof module]&&module&&!module.nodeType?module:T,Tt=qt&&qt.exports===Zt?Zt:T,Vt=S(Dt[typeof self]&&self),Kt=S(Dt[typeof window]&&window),Gt=S(Dt[typeof this]&&this),Jt=S(Zt&&qt&&typeof global=="object"&&global)||Kt!==(Gt&&Gt.window)&&Kt||Vt||Gt||Function("return this")(),Yt=q();(Kt||Vt||{})._=Yt,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return Yt}):Zt&&qt?(Tt&&((qt.exports=Yt)._=Yt), +Zt._=Yt):Jt._=Yt}).call(this); \ No newline at end of file diff --git a/tools/eslint/node_modules/lodash/lowerCase.js b/tools/eslint/node_modules/lodash/lowerCase.js index 4222dcbad1d61d..66c1f499f4151a 100644 --- a/tools/eslint/node_modules/lodash/lowerCase.js +++ b/tools/eslint/node_modules/lodash/lowerCase.js @@ -5,12 +5,13 @@ var createCompounder = require('./_createCompounder'); * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * - * _.lowerCase('--Foo-Bar'); + * _.lowerCase('--Foo-Bar--'); * // => 'foo bar' * * _.lowerCase('fooBar'); diff --git a/tools/eslint/node_modules/lodash/lowerFirst.js b/tools/eslint/node_modules/lodash/lowerFirst.js index 884ec2dec1f039..c08f082b139af2 100644 --- a/tools/eslint/node_modules/lodash/lowerFirst.js +++ b/tools/eslint/node_modules/lodash/lowerFirst.js @@ -5,6 +5,7 @@ var createCaseFirst = require('./_createCaseFirst'); * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. diff --git a/tools/eslint/node_modules/lodash/lt.js b/tools/eslint/node_modules/lodash/lt.js index 4439870a318ee4..4e06fdd028e88e 100644 --- a/tools/eslint/node_modules/lodash/lt.js +++ b/tools/eslint/node_modules/lodash/lt.js @@ -3,10 +3,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. * @example * * _.lt(1, 3); diff --git a/tools/eslint/node_modules/lodash/lte.js b/tools/eslint/node_modules/lodash/lte.js index e2b8ab15a063ee..76e8607fdb8cc2 100644 --- a/tools/eslint/node_modules/lodash/lte.js +++ b/tools/eslint/node_modules/lodash/lte.js @@ -3,10 +3,12 @@ * * @static * @memberOf _ + * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. + * @returns {boolean} Returns `true` if `value` is less than or equal to + * `other`, else `false`. * @example * * _.lte(1, 3); diff --git a/tools/eslint/node_modules/lodash/map.js b/tools/eslint/node_modules/lodash/map.js index d19a9a6c06cedb..cca7bd023f4648 100644 --- a/tools/eslint/node_modules/lodash/map.js +++ b/tools/eslint/node_modules/lodash/map.js @@ -4,7 +4,7 @@ var arrayMap = require('./_arrayMap'), isArray = require('./isArray'); /** - * Creates an array of values by running each element in `collection` through + * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * @@ -12,16 +12,18 @@ var arrayMap = require('./_arrayMap'), * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: - * `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, - * `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, - * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, - * and `words` + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `take`, `takeRight`, `template`, + * `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * diff --git a/tools/eslint/node_modules/lodash/mapKeys.js b/tools/eslint/node_modules/lodash/mapKeys.js index aa3899fa5820ec..0850afd396316f 100644 --- a/tools/eslint/node_modules/lodash/mapKeys.js +++ b/tools/eslint/node_modules/lodash/mapKeys.js @@ -4,13 +4,16 @@ var baseForOwn = require('./_baseForOwn'), /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable - * property of `object` through `iteratee`. + * string keyed property of `object` thru `iteratee`. The iteratee is invoked + * with three arguments: (value, key, object). * * @static * @memberOf _ + * @since 3.8.0 * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * diff --git a/tools/eslint/node_modules/lodash/mapValues.js b/tools/eslint/node_modules/lodash/mapValues.js index c160702f828305..c3af35e823ff5d 100644 --- a/tools/eslint/node_modules/lodash/mapValues.js +++ b/tools/eslint/node_modules/lodash/mapValues.js @@ -2,15 +2,18 @@ var baseForOwn = require('./_baseForOwn'), baseIteratee = require('./_baseIteratee'); /** - * Creates an object with the same keys as `object` and values generated by - * running each own enumerable property of `object` through `iteratee`. The - * iteratee function is invoked with three arguments: (value, key, object). + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). * * @static * @memberOf _ + * @since 2.4.0 * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @example * diff --git a/tools/eslint/node_modules/lodash/matches.js b/tools/eslint/node_modules/lodash/matches.js index 5a2926ae524e8a..16fe16d47ec913 100644 --- a/tools/eslint/node_modules/lodash/matches.js +++ b/tools/eslint/node_modules/lodash/matches.js @@ -2,14 +2,16 @@ var baseClone = require('./_baseClone'), baseMatches = require('./_baseMatches'); /** - * Creates a function that performs a deep partial comparison between a given + * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent - * property values, else `false`. + * property values, else `false`. The created function is equivalent to + * `_.isMatch` with a `source` partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/matchesProperty.js b/tools/eslint/node_modules/lodash/matchesProperty.js index d4356fb956a015..3dd59d5a141049 100644 --- a/tools/eslint/node_modules/lodash/matchesProperty.js +++ b/tools/eslint/node_modules/lodash/matchesProperty.js @@ -2,7 +2,7 @@ var baseClone = require('./_baseClone'), baseMatchesProperty = require('./_baseMatchesProperty'); /** - * Creates a function that performs a deep partial comparison between the + * Creates a function that performs a partial deep comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * @@ -10,6 +10,7 @@ var baseClone = require('./_baseClone'), * * @static * @memberOf _ + * @since 3.2.0 * @category Util * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. diff --git a/tools/eslint/node_modules/lodash/math.js b/tools/eslint/node_modules/lodash/math.js index edfba7f7fe7347..596688748e02f9 100644 --- a/tools/eslint/node_modules/lodash/math.js +++ b/tools/eslint/node_modules/lodash/math.js @@ -1,12 +1,15 @@ module.exports = { 'add': require('./add'), 'ceil': require('./ceil'), + 'divide': require('./divide'), 'floor': require('./floor'), 'max': require('./max'), 'maxBy': require('./maxBy'), 'mean': require('./mean'), + 'meanBy': require('./meanBy'), 'min': require('./min'), 'minBy': require('./minBy'), + 'multiply': require('./multiply'), 'round': require('./round'), 'subtract': require('./subtract'), 'sum': require('./sum'), diff --git a/tools/eslint/node_modules/lodash/max.js b/tools/eslint/node_modules/lodash/max.js index 124b33127dd159..f563459b8aeef5 100644 --- a/tools/eslint/node_modules/lodash/max.js +++ b/tools/eslint/node_modules/lodash/max.js @@ -3,10 +3,11 @@ var baseExtremum = require('./_baseExtremum'), identity = require('./identity'); /** - * Computes the maximum value of `array`. If `array` is empty or falsey + * Computes the maximum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. diff --git a/tools/eslint/node_modules/lodash/maxBy.js b/tools/eslint/node_modules/lodash/maxBy.js index c70395fbfcc7f3..a58dd016371900 100644 --- a/tools/eslint/node_modules/lodash/maxBy.js +++ b/tools/eslint/node_modules/lodash/maxBy.js @@ -9,9 +9,11 @@ var baseExtremum = require('./_baseExtremum'), * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {*} Returns the maximum value. * @example * diff --git a/tools/eslint/node_modules/lodash/mean.js b/tools/eslint/node_modules/lodash/mean.js index 739dc4147f136e..e3ffff67c79b05 100644 --- a/tools/eslint/node_modules/lodash/mean.js +++ b/tools/eslint/node_modules/lodash/mean.js @@ -1,10 +1,12 @@ -var sum = require('./sum'); +var baseMean = require('./_baseMean'), + identity = require('./identity'); /** * Computes the mean of the values in `array`. * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the mean. @@ -14,7 +16,7 @@ var sum = require('./sum'); * // => 5 */ function mean(array) { - return sum(array) / (array ? array.length : 0); + return baseMean(array, identity); } module.exports = mean; diff --git a/tools/eslint/node_modules/lodash/meanBy.js b/tools/eslint/node_modules/lodash/meanBy.js new file mode 100644 index 00000000000000..970d79836766ab --- /dev/null +++ b/tools/eslint/node_modules/lodash/meanBy.js @@ -0,0 +1,32 @@ +var baseIteratee = require('./_baseIteratee'), + baseMean = require('./_baseMean'); + +/** + * This method is like `_.mean` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be averaged. + * The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Math + * @param {Array} array The array to iterate over. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {number} Returns the mean. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.meanBy(objects, function(o) { return o.n; }); + * // => 5 + * + * // The `_.property` iteratee shorthand. + * _.meanBy(objects, 'n'); + * // => 5 + */ +function meanBy(array, iteratee) { + return baseMean(array, baseIteratee(iteratee)); +} + +module.exports = meanBy; diff --git a/tools/eslint/node_modules/lodash/memoize.js b/tools/eslint/node_modules/lodash/memoize.js index 4fe714973475be..b657bbe41e9814 100644 --- a/tools/eslint/node_modules/lodash/memoize.js +++ b/tools/eslint/node_modules/lodash/memoize.js @@ -5,18 +5,20 @@ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that memoizes the result of `func`. If `resolver` is - * provided it determines the cache key for storing the result based on the + * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. @@ -61,7 +63,7 @@ function memoize(func, resolver) { memoized.cache = cache.set(key, result); return result; }; - memoized.cache = new memoize.Cache; + memoized.cache = new (memoize.Cache || MapCache); return memoized; } diff --git a/tools/eslint/node_modules/lodash/merge.js b/tools/eslint/node_modules/lodash/merge.js index 07625956a68e70..61c6e015613ed6 100644 --- a/tools/eslint/node_modules/lodash/merge.js +++ b/tools/eslint/node_modules/lodash/merge.js @@ -2,17 +2,19 @@ var baseMerge = require('./_baseMerge'), createAssigner = require('./_createAssigner'); /** - * Recursively merges own and inherited enumerable properties of source - * objects into the destination object, skipping source properties that resolve - * to `undefined`. Array and plain object properties are merged recursively. - * Other objects and value types are overridden by assignment. Source objects - * are applied from left to right. Subsequent sources overwrite property - * assignments of previous sources. + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively.Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ + * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. diff --git a/tools/eslint/node_modules/lodash/mergeWith.js b/tools/eslint/node_modules/lodash/mergeWith.js index c41390c72805da..8fada62dda3947 100644 --- a/tools/eslint/node_modules/lodash/mergeWith.js +++ b/tools/eslint/node_modules/lodash/mergeWith.js @@ -4,7 +4,7 @@ var baseMerge = require('./_baseMerge'), /** * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined` merging is handled by the + * properties. If `customizer` returns `undefined`, merging is handled by the * method instead. The `customizer` is invoked with seven arguments: * (objValue, srcValue, key, object, source, stack). * @@ -12,6 +12,7 @@ var baseMerge = require('./_baseMerge'), * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. diff --git a/tools/eslint/node_modules/lodash/method.js b/tools/eslint/node_modules/lodash/method.js index 0095361b65b445..12bc4bf59ea0de 100644 --- a/tools/eslint/node_modules/lodash/method.js +++ b/tools/eslint/node_modules/lodash/method.js @@ -7,6 +7,7 @@ var baseInvoke = require('./_baseInvoke'), * * @static * @memberOf _ + * @since 3.7.0 * @category Util * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. @@ -14,15 +15,15 @@ var baseInvoke = require('./_baseInvoke'), * @example * * var objects = [ - * { 'a': { 'b': { 'c': _.constant(2) } } }, - * { 'a': { 'b': { 'c': _.constant(1) } } } + * { 'a': { 'b': _.constant(2) } }, + * { 'a': { 'b': _.constant(1) } } * ]; * - * _.map(objects, _.method('a.b.c')); + * _.map(objects, _.method('a.b')); * // => [2, 1] * - * _.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] + * _.map(objects, _.method(['a', 'b'])); + * // => [2, 1] */ var method = rest(function(path, args) { return function(object) { diff --git a/tools/eslint/node_modules/lodash/methodOf.js b/tools/eslint/node_modules/lodash/methodOf.js index 8601ebaac371a9..edac32f4cd56b5 100644 --- a/tools/eslint/node_modules/lodash/methodOf.js +++ b/tools/eslint/node_modules/lodash/methodOf.js @@ -8,6 +8,7 @@ var baseInvoke = require('./_baseInvoke'), * * @static * @memberOf _ + * @since 3.7.0 * @category Util * @param {Object} object The object to query. * @param {...*} [args] The arguments to invoke the method with. diff --git a/tools/eslint/node_modules/lodash/min.js b/tools/eslint/node_modules/lodash/min.js index 77dde9803d5b91..0852b5dbb00067 100644 --- a/tools/eslint/node_modules/lodash/min.js +++ b/tools/eslint/node_modules/lodash/min.js @@ -3,10 +3,11 @@ var baseExtremum = require('./_baseExtremum'), lt = require('./lt'); /** - * Computes the minimum value of `array`. If `array` is empty or falsey + * Computes the minimum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. diff --git a/tools/eslint/node_modules/lodash/minBy.js b/tools/eslint/node_modules/lodash/minBy.js index 9c40ea64b7e70c..3a4e21205ad6d0 100644 --- a/tools/eslint/node_modules/lodash/minBy.js +++ b/tools/eslint/node_modules/lodash/minBy.js @@ -9,9 +9,11 @@ var baseExtremum = require('./_baseExtremum'), * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {*} Returns the minimum value. * @example * diff --git a/tools/eslint/node_modules/lodash/mixin.js b/tools/eslint/node_modules/lodash/mixin.js index 02e2b6c2719e5a..1e1e38e824b3c0 100644 --- a/tools/eslint/node_modules/lodash/mixin.js +++ b/tools/eslint/node_modules/lodash/mixin.js @@ -7,21 +7,21 @@ var arrayEach = require('./_arrayEach'), keys = require('./keys'); /** - * Adds all own enumerable function properties of a source object to the - * destination object. If `object` is a function then methods are added to - * its prototype as well. + * Adds all own enumerable string keyed function properties of a source + * object to the destination object. If `object` is a function, then methods + * are added to its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. - * @param {Object} [options] The options object. - * @param {boolean} [options.chain=true] Specify whether the functions added - * are chainable. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.chain=true] Specify whether mixins are chainable. * @returns {Function|Object} Returns `object`. * @example * diff --git a/tools/eslint/node_modules/lodash/multiply.js b/tools/eslint/node_modules/lodash/multiply.js new file mode 100644 index 00000000000000..57ba9398554569 --- /dev/null +++ b/tools/eslint/node_modules/lodash/multiply.js @@ -0,0 +1,22 @@ +var createMathOperation = require('./_createMathOperation'); + +/** + * Multiply two numbers. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Math + * @param {number} multiplier The first number in a multiplication. + * @param {number} multiplicand The second number in a multiplication. + * @returns {number} Returns the product. + * @example + * + * _.multiply(6, 4); + * // => 24 + */ +var multiply = createMathOperation(function(multiplier, multiplicand) { + return multiplier * multiplicand; +}); + +module.exports = multiply; diff --git a/tools/eslint/node_modules/lodash/negate.js b/tools/eslint/node_modules/lodash/negate.js index 82479390ad7802..2ad58d6a2d38c8 100644 --- a/tools/eslint/node_modules/lodash/negate.js +++ b/tools/eslint/node_modules/lodash/negate.js @@ -8,6 +8,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/next.js b/tools/eslint/node_modules/lodash/next.js index 24ce3b24c32843..55f949c8cd5bfb 100644 --- a/tools/eslint/node_modules/lodash/next.js +++ b/tools/eslint/node_modules/lodash/next.js @@ -6,6 +6,7 @@ var toArray = require('./toArray'); * * @name next * @memberOf _ + * @since 4.0.0 * @category Seq * @returns {Object} Returns the next iterator value. * @example diff --git a/tools/eslint/node_modules/lodash/noop.js b/tools/eslint/node_modules/lodash/noop.js index 9f63a6633b7371..26e19c31728af4 100644 --- a/tools/eslint/node_modules/lodash/noop.js +++ b/tools/eslint/node_modules/lodash/noop.js @@ -4,6 +4,7 @@ * * @static * @memberOf _ + * @since 2.3.0 * @category Util * @example * diff --git a/tools/eslint/node_modules/lodash/now.js b/tools/eslint/node_modules/lodash/now.js index eca3b9eddea21d..c0656728c9906d 100644 --- a/tools/eslint/node_modules/lodash/now.js +++ b/tools/eslint/node_modules/lodash/now.js @@ -4,7 +4,8 @@ * * @static * @memberOf _ - * @type Function + * @since 2.4.0 + * @type {Function} * @category Date * @returns {number} Returns the timestamp. * @example @@ -12,7 +13,7 @@ * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); - * // => logs the number of milliseconds it took for the deferred function to be invoked + * // => Logs the number of milliseconds it took for the deferred function to be invoked. */ var now = Date.now; diff --git a/tools/eslint/node_modules/lodash/nthArg.js b/tools/eslint/node_modules/lodash/nthArg.js index bf95dd011f8207..6844ac45a1836d 100644 --- a/tools/eslint/node_modules/lodash/nthArg.js +++ b/tools/eslint/node_modules/lodash/nthArg.js @@ -5,6 +5,7 @@ var toInteger = require('./toInteger'); * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {number} [n=0] The index of the argument to return. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/object.js b/tools/eslint/node_modules/lodash/object.js index aab1e8286c6eeb..d6f51c8e1c6d2a 100644 --- a/tools/eslint/node_modules/lodash/object.js +++ b/tools/eslint/node_modules/lodash/object.js @@ -6,6 +6,8 @@ module.exports = { 'create': require('./create'), 'defaults': require('./defaults'), 'defaultsDeep': require('./defaultsDeep'), + 'entries': require('./entries'), + 'entriesIn': require('./entriesIn'), 'extend': require('./extend'), 'extendWith': require('./extendWith'), 'findKey': require('./findKey'), @@ -39,6 +41,8 @@ module.exports = { 'toPairsIn': require('./toPairsIn'), 'transform': require('./transform'), 'unset': require('./unset'), + 'update': require('./update'), + 'updateWith': require('./updateWith'), 'values': require('./values'), 'valuesIn': require('./valuesIn') }; diff --git a/tools/eslint/node_modules/lodash/omit.js b/tools/eslint/node_modules/lodash/omit.js index dd3c70dc6d6ac5..ba30980c1cbe8e 100644 --- a/tools/eslint/node_modules/lodash/omit.js +++ b/tools/eslint/node_modules/lodash/omit.js @@ -1,20 +1,23 @@ var arrayMap = require('./_arrayMap'), + baseCastKey = require('./_baseCastKey'), baseDifference = require('./_baseDifference'), baseFlatten = require('./_baseFlatten'), basePick = require('./_basePick'), - keysIn = require('./keysIn'), + getAllKeysIn = require('./_getAllKeysIn'), rest = require('./rest'); /** * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that are not omitted. + * own and inherited enumerable string keyed properties of `object` that are + * not omitted. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property names to omit, specified - * individually or in arrays.. + * @param {...(string|string[])} [props] The property identifiers to omit, + * specified individually or in arrays. * @returns {Object} Returns the new object. * @example * @@ -27,8 +30,8 @@ var omit = rest(function(object, props) { if (object == null) { return {}; } - props = arrayMap(baseFlatten(props), String); - return basePick(object, baseDifference(keysIn(object), props)); + props = arrayMap(baseFlatten(props, 1), baseCastKey); + return basePick(object, baseDifference(getAllKeysIn(object), props)); }); module.exports = omit; diff --git a/tools/eslint/node_modules/lodash/omitBy.js b/tools/eslint/node_modules/lodash/omitBy.js index d7d045354b4108..79505deafc2c4b 100644 --- a/tools/eslint/node_modules/lodash/omitBy.js +++ b/tools/eslint/node_modules/lodash/omitBy.js @@ -2,15 +2,18 @@ var baseIteratee = require('./_baseIteratee'), basePickBy = require('./_basePickBy'); /** - * The opposite of `_.pickBy`; this method creates an object composed of the - * own and inherited enumerable properties of `object` that `predicate` - * doesn't return truthy for. + * The opposite of `_.pickBy`; this method creates an object composed of + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The source object. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per property. * @returns {Object} Returns the new object. * @example * @@ -20,7 +23,7 @@ var baseIteratee = require('./_baseIteratee'), * // => { 'b': '2' } */ function omitBy(object, predicate) { - predicate = baseIteratee(predicate, 2); + predicate = baseIteratee(predicate); return basePickBy(object, function(value, key) { return !predicate(value, key); }); diff --git a/tools/eslint/node_modules/lodash/once.js b/tools/eslint/node_modules/lodash/once.js index 75f7d99b7797f6..4f66808a164511 100644 --- a/tools/eslint/node_modules/lodash/once.js +++ b/tools/eslint/node_modules/lodash/once.js @@ -7,6 +7,7 @@ var before = require('./before'); * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. diff --git a/tools/eslint/node_modules/lodash/orderBy.js b/tools/eslint/node_modules/lodash/orderBy.js index f1b64f7a29847d..7195c8c737f2fb 100644 --- a/tools/eslint/node_modules/lodash/orderBy.js +++ b/tools/eslint/node_modules/lodash/orderBy.js @@ -9,24 +9,26 @@ var baseOrderBy = require('./_baseOrderBy'), * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. + * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] + * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 42 }, + * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { diff --git a/tools/eslint/node_modules/lodash/over.js b/tools/eslint/node_modules/lodash/over.js index e2a8f45f5cd030..d448cef06b0f28 100644 --- a/tools/eslint/node_modules/lodash/over.js +++ b/tools/eslint/node_modules/lodash/over.js @@ -2,11 +2,12 @@ var arrayMap = require('./_arrayMap'), createOver = require('./_createOver'); /** - * Creates a function that invokes `iteratees` with the arguments provided - * to the created function and returns their results. + * Creates a function that invokes `iteratees` with the arguments it receives + * and returns their results. * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {...(Function|Function[])} iteratees The iteratees to invoke. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/overArgs.js b/tools/eslint/node_modules/lodash/overArgs.js index 0bb760fde8a1fa..a9cb53e88c237f 100644 --- a/tools/eslint/node_modules/lodash/overArgs.js +++ b/tools/eslint/node_modules/lodash/overArgs.js @@ -2,6 +2,7 @@ var apply = require('./_apply'), arrayMap = require('./_arrayMap'), baseFlatten = require('./_baseFlatten'), baseIteratee = require('./_baseIteratee'), + isFlattenableIteratee = require('./_isFlattenableIteratee'), rest = require('./rest'); /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -12,10 +13,11 @@ var nativeMin = Math.min; * corresponding `transforms`. * * @static + * @since 4.0.0 * @memberOf _ * @category Function * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms] The functions to transform + * @param {...(Function|Function[])} [transforms] The functions to transform. * arguments, specified individually or in arrays. * @returns {Function} Returns the new function. * @example @@ -39,8 +41,7 @@ var nativeMin = Math.min; * // => [100, 10] */ var overArgs = rest(function(func, transforms) { - transforms = arrayMap(baseFlatten(transforms), baseIteratee); - + transforms = arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseIteratee); var funcsLength = transforms.length; return rest(function(args) { var index = -1, diff --git a/tools/eslint/node_modules/lodash/overEvery.js b/tools/eslint/node_modules/lodash/overEvery.js index bad7a5a72699bd..28a873907e9b48 100644 --- a/tools/eslint/node_modules/lodash/overEvery.js +++ b/tools/eslint/node_modules/lodash/overEvery.js @@ -3,10 +3,11 @@ var arrayEvery = require('./_arrayEvery'), /** * Creates a function that checks if **all** of the `predicates` return - * truthy when invoked with the arguments provided to the created function. + * truthy when invoked with the arguments it receives. * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/overSome.js b/tools/eslint/node_modules/lodash/overSome.js index fb0001b76fad91..4f31314cc97e59 100644 --- a/tools/eslint/node_modules/lodash/overSome.js +++ b/tools/eslint/node_modules/lodash/overSome.js @@ -3,10 +3,11 @@ var arraySome = require('./_arraySome'), /** * Creates a function that checks if **any** of the `predicates` return - * truthy when invoked with the arguments provided to the created function. + * truthy when invoked with the arguments it receives. * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/package.json b/tools/eslint/node_modules/lodash/package.json index 5cdb591be5ec06..7248c759d9a32e 100644 --- a/tools/eslint/node_modules/lodash/package.json +++ b/tools/eslint/node_modules/lodash/package.json @@ -2,24 +2,24 @@ "_args": [ [ "lodash@^4.0.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "lodash@>=4.0.0 <5.0.0", - "_id": "lodash@4.3.0", + "_id": "lodash@4.9.0", "_inCache": true, "_installable": true, - "_location": "/eslint/lodash", + "_location": "/lodash", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-9-west.internal.npmjs.com", - "tmp": "tmp/lodash-4.3.0.tgz_1454921838929_0.49659619107842445" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/lodash-4.9.0.tgz_1460128953630_0.9709006256889552" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.18", + "_npmVersion": "2.15.3", "_phantomChildren": {}, "_requested": { "name": "lodash", @@ -30,15 +30,15 @@ "type": "range" }, "_requiredBy": [ - "/eslint", - "/eslint/inquirer", - "/eslint/table" + "/", + "/inquirer", + "/table" ], - "_resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz", - "_shasum": "efd9c4a6ec53f3b05412429915c3e4824e4d25a4", + "_resolved": "https://registry.npmjs.org/lodash/-/lodash-4.9.0.tgz", + "_shasum": "4c20d742f03ce85dc700e0dd7ab9bcab85e6fc14", "_shrinkwrap": null, "_spec": "lodash@^4.0.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -49,18 +49,18 @@ }, "contributors": [ { - "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", "url": "http://allyoucanleet.com/" }, { - "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com", "url": "https://github.com/phated" }, { - "email": "mathias@qiwi.be", "name": "Mathias Bynens", + "email": "mathias@qiwi.be", "url": "https://mathiasbynens.be/" } ], @@ -69,8 +69,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "efd9c4a6ec53f3b05412429915c3e4824e4d25a4", - "tarball": "http://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz" + "shasum": "4c20d742f03ce85dc700e0dd7ab9bcab85e6fc14", + "tarball": "https://registry.npmjs.org/lodash/-/lodash-4.9.0.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -83,16 +83,20 @@ "main": "lodash.js", "maintainers": [ { - "email": "john.david.dalton@gmail.com", - "name": "jdalton" + "name": "jdalton", + "email": "john.david.dalton@gmail.com" }, { - "email": "mathias@qiwi.be", - "name": "mathias" + "name": "jridgewell", + "email": "justin+npm@ridgewell.name" + }, + { + "name": "mathias", + "email": "mathias@qiwi.be" }, { - "email": "blaine@iceddev.com", - "name": "phated" + "name": "phated", + "email": "blaine.bublitz@gmail.com" } ], "name": "lodash", @@ -105,5 +109,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.3.0" + "version": "4.9.0" } diff --git a/tools/eslint/node_modules/lodash/pad.js b/tools/eslint/node_modules/lodash/pad.js index aaebdb6d11a948..77e1f1c1ab6c7a 100644 --- a/tools/eslint/node_modules/lodash/pad.js +++ b/tools/eslint/node_modules/lodash/pad.js @@ -13,6 +13,7 @@ var nativeCeil = Math.ceil, * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. @@ -33,15 +34,16 @@ function pad(string, length, chars) { string = toString(string); length = toInteger(length); - var strLength = stringSize(string); + var strLength = length ? stringSize(string) : 0; if (!length || strLength >= length) { return string; } - var mid = (length - strLength) / 2, - leftLength = nativeFloor(mid), - rightLength = nativeCeil(mid); - - return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars); + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); } module.exports = pad; diff --git a/tools/eslint/node_modules/lodash/padEnd.js b/tools/eslint/node_modules/lodash/padEnd.js index a7240fd5375df1..224eb80e99e168 100644 --- a/tools/eslint/node_modules/lodash/padEnd.js +++ b/tools/eslint/node_modules/lodash/padEnd.js @@ -1,4 +1,6 @@ var createPadding = require('./_createPadding'), + stringSize = require('./_stringSize'), + toInteger = require('./toInteger'), toString = require('./toString'); /** @@ -7,6 +9,7 @@ var createPadding = require('./_createPadding'), * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. @@ -25,7 +28,12 @@ var createPadding = require('./_createPadding'), */ function padEnd(string, length, chars) { string = toString(string); - return string + createPadding(string, length, chars); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (string + createPadding(length - strLength, chars)) + : string; } module.exports = padEnd; diff --git a/tools/eslint/node_modules/lodash/padStart.js b/tools/eslint/node_modules/lodash/padStart.js index 52188b17e8b62a..f991866bf36afc 100644 --- a/tools/eslint/node_modules/lodash/padStart.js +++ b/tools/eslint/node_modules/lodash/padStart.js @@ -1,4 +1,6 @@ var createPadding = require('./_createPadding'), + stringSize = require('./_stringSize'), + toInteger = require('./toInteger'), toString = require('./toString'); /** @@ -7,6 +9,7 @@ var createPadding = require('./_createPadding'), * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. @@ -25,7 +28,12 @@ var createPadding = require('./_createPadding'), */ function padStart(string, length, chars) { string = toString(string); - return createPadding(string, length, chars) + string; + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (createPadding(length - strLength, chars) + string) + : string; } module.exports = padStart; diff --git a/tools/eslint/node_modules/lodash/parseInt.js b/tools/eslint/node_modules/lodash/parseInt.js index ae608ce59f949d..fe140f61b13d5b 100644 --- a/tools/eslint/node_modules/lodash/parseInt.js +++ b/tools/eslint/node_modules/lodash/parseInt.js @@ -12,18 +12,19 @@ var nativeParseInt = root.parseInt; /** * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, - * in which case a `radix` of `16` is used. + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a + * hexadecimal, in which case a `radix` of `16` is used. * - * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2) - * of `parseInt`. + * **Note:** This method aligns with the + * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. * * @static * @memberOf _ + * @since 1.1.0 * @category String * @param {string} string The string to convert. - * @param {number} [radix] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param {number} [radix=10] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {number} Returns the converted integer. * @example * @@ -35,7 +36,7 @@ var nativeParseInt = root.parseInt; */ function parseInt(string, radix, guard) { // Chrome fails to trim leading whitespace characters. - // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. + // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details. if (guard || radix == null) { radix = 0; } else if (radix) { diff --git a/tools/eslint/node_modules/lodash/partial.js b/tools/eslint/node_modules/lodash/partial.js index e857ab7d2adbd6..149060e5a72803 100644 --- a/tools/eslint/node_modules/lodash/partial.js +++ b/tools/eslint/node_modules/lodash/partial.js @@ -1,4 +1,5 @@ var createWrapper = require('./_createWrapper'), + getPlaceholder = require('./_getPlaceholder'), replaceHolders = require('./_replaceHolders'), rest = require('./rest'); @@ -6,9 +7,9 @@ var createWrapper = require('./_createWrapper'), var PARTIAL_FLAG = 32; /** - * Creates a function that invokes `func` with `partial` arguments prepended - * to those provided to the new function. This method is like `_.bind` except - * it does **not** alter the `this` binding. + * Creates a function that invokes `func` with `partials` prepended to the + * arguments it receives. This method is like `_.bind` except it does **not** + * alter the `this` binding. * * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. @@ -18,6 +19,7 @@ var PARTIAL_FLAG = 32; * * @static * @memberOf _ + * @since 0.2.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. @@ -38,9 +40,7 @@ var PARTIAL_FLAG = 32; * // => 'hi fred' */ var partial = rest(function(func, partials) { - var placeholder = partial.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(partial)); return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); diff --git a/tools/eslint/node_modules/lodash/partialRight.js b/tools/eslint/node_modules/lodash/partialRight.js index 4fdb470bc133d2..02d14b9a0572e3 100644 --- a/tools/eslint/node_modules/lodash/partialRight.js +++ b/tools/eslint/node_modules/lodash/partialRight.js @@ -1,4 +1,5 @@ var createWrapper = require('./_createWrapper'), + getPlaceholder = require('./_getPlaceholder'), replaceHolders = require('./_replaceHolders'), rest = require('./rest'); @@ -7,7 +8,7 @@ var PARTIAL_RIGHT_FLAG = 64; /** * This method is like `_.partial` except that partially applied arguments - * are appended to those provided to the new function. + * are appended to the arguments it receives. * * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. @@ -17,6 +18,7 @@ var PARTIAL_RIGHT_FLAG = 64; * * @static * @memberOf _ + * @since 1.0.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. @@ -37,9 +39,7 @@ var PARTIAL_RIGHT_FLAG = 64; * // => 'hello fred' */ var partialRight = rest(function(func, partials) { - var placeholder = partialRight.placeholder, - holders = replaceHolders(partials, placeholder); - + var holders = replaceHolders(partials, getPlaceholder(partialRight)); return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); diff --git a/tools/eslint/node_modules/lodash/partition.js b/tools/eslint/node_modules/lodash/partition.js index b5e0e55d7b70d6..2e30e8b97b5e8a 100644 --- a/tools/eslint/node_modules/lodash/partition.js +++ b/tools/eslint/node_modules/lodash/partition.js @@ -8,9 +8,11 @@ var createAggregator = require('./_createAggregator'); * * @static * @memberOf _ + * @since 3.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the array of grouped elements. * @example * diff --git a/tools/eslint/node_modules/lodash/pick.js b/tools/eslint/node_modules/lodash/pick.js index 44745755f74619..32f3584b7b1ab5 100644 --- a/tools/eslint/node_modules/lodash/pick.js +++ b/tools/eslint/node_modules/lodash/pick.js @@ -6,11 +6,12 @@ var baseFlatten = require('./_baseFlatten'), * Creates an object composed of the picked `object` properties. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property names to pick, specified - * individually or in arrays. + * @param {...(string|string[])} [props] The property identifiers to pick, + * specified individually or in arrays. * @returns {Object} Returns the new object. * @example * @@ -20,7 +21,7 @@ var baseFlatten = require('./_baseFlatten'), * // => { 'a': 1, 'c': 3 } */ var pick = rest(function(object, props) { - return object == null ? {} : basePick(object, baseFlatten(props)); + return object == null ? {} : basePick(object, baseFlatten(props, 1)); }); module.exports = pick; diff --git a/tools/eslint/node_modules/lodash/pickBy.js b/tools/eslint/node_modules/lodash/pickBy.js index 611859eff18f27..d355442c9e4d41 100644 --- a/tools/eslint/node_modules/lodash/pickBy.js +++ b/tools/eslint/node_modules/lodash/pickBy.js @@ -7,9 +7,11 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The source object. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per property. * @returns {Object} Returns the new object. * @example * @@ -19,7 +21,7 @@ var baseIteratee = require('./_baseIteratee'), * // => { 'a': 1, 'c': 3 } */ function pickBy(object, predicate) { - return object == null ? {} : basePickBy(object, baseIteratee(predicate, 2)); + return object == null ? {} : basePickBy(object, baseIteratee(predicate)); } module.exports = pickBy; diff --git a/tools/eslint/node_modules/lodash/plant.js b/tools/eslint/node_modules/lodash/plant.js index d01b191cecfa9f..23776f3238bd37 100644 --- a/tools/eslint/node_modules/lodash/plant.js +++ b/tools/eslint/node_modules/lodash/plant.js @@ -2,10 +2,11 @@ var baseLodash = require('./_baseLodash'), wrapperClone = require('./_wrapperClone'); /** - * Creates a clone of the chained sequence planting `value` as the wrapped value. + * Creates a clone of the chain sequence planting `value` as the wrapped value. * * @name plant * @memberOf _ + * @since 3.2.0 * @category Seq * @param {*} value The value to plant. * @returns {Object} Returns the new `lodash` wrapper instance. diff --git a/tools/eslint/node_modules/lodash/property.js b/tools/eslint/node_modules/lodash/property.js index 54e95eb6a81540..0abbe380dc10c6 100644 --- a/tools/eslint/node_modules/lodash/property.js +++ b/tools/eslint/node_modules/lodash/property.js @@ -7,20 +7,21 @@ var baseProperty = require('./_baseProperty'), * * @static * @memberOf _ + * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. * @example * * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } * ]; * - * _.map(objects, _.property('a.b.c')); + * _.map(objects, _.property('a.b')); * // => [2, 1] * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { diff --git a/tools/eslint/node_modules/lodash/propertyOf.js b/tools/eslint/node_modules/lodash/propertyOf.js index 667430e72a8fa2..13bdbbb7bbd65a 100644 --- a/tools/eslint/node_modules/lodash/propertyOf.js +++ b/tools/eslint/node_modules/lodash/propertyOf.js @@ -6,6 +6,7 @@ var baseGet = require('./_baseGet'); * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Object} object The object to query. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/pull.js b/tools/eslint/node_modules/lodash/pull.js index c2f6c1e316be84..f5846fbc196059 100644 --- a/tools/eslint/node_modules/lodash/pull.js +++ b/tools/eslint/node_modules/lodash/pull.js @@ -6,10 +6,12 @@ var pullAll = require('./pullAll'), * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * - * **Note:** Unlike `_.without`, this method mutates `array`. + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. * * @static * @memberOf _ + * @since 2.0.0 * @category Array * @param {Array} array The array to modify. * @param {...*} [values] The values to remove. diff --git a/tools/eslint/node_modules/lodash/pullAll.js b/tools/eslint/node_modules/lodash/pullAll.js index 4eecae61381000..d6ce1bf80ef3bc 100644 --- a/tools/eslint/node_modules/lodash/pullAll.js +++ b/tools/eslint/node_modules/lodash/pullAll.js @@ -7,6 +7,7 @@ var basePullAll = require('./_basePullAll'); * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. diff --git a/tools/eslint/node_modules/lodash/pullAllBy.js b/tools/eslint/node_modules/lodash/pullAllBy.js index 7d732e70ce7260..7192650c371054 100644 --- a/tools/eslint/node_modules/lodash/pullAllBy.js +++ b/tools/eslint/node_modules/lodash/pullAllBy.js @@ -1,19 +1,21 @@ var baseIteratee = require('./_baseIteratee'), - basePullAllBy = require('./_basePullAllBy'); + basePullAll = require('./_basePullAll'); /** * This method is like `_.pullAll` except that it accepts `iteratee` which is * invoked for each element of `array` and `values` to generate the criterion - * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * by which they're compared. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns `array`. * @example * @@ -25,7 +27,7 @@ var baseIteratee = require('./_baseIteratee'), */ function pullAllBy(array, values, iteratee) { return (array && array.length && values && values.length) - ? basePullAllBy(array, values, baseIteratee(iteratee)) + ? basePullAll(array, values, baseIteratee(iteratee)) : array; } diff --git a/tools/eslint/node_modules/lodash/pullAllWith.js b/tools/eslint/node_modules/lodash/pullAllWith.js new file mode 100644 index 00000000000000..1d2fd9f941cb0e --- /dev/null +++ b/tools/eslint/node_modules/lodash/pullAllWith.js @@ -0,0 +1,32 @@ +var basePullAll = require('./_basePullAll'); + +/** + * This method is like `_.pullAll` except that it accepts `comparator` which + * is invoked to compare elements of `array` to `values`. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +function pullAllWith(array, values, comparator) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, undefined, comparator) + : array; +} + +module.exports = pullAllWith; diff --git a/tools/eslint/node_modules/lodash/pullAt.js b/tools/eslint/node_modules/lodash/pullAt.js index 5938c056663298..aeb56699e0d0ad 100644 --- a/tools/eslint/node_modules/lodash/pullAt.js +++ b/tools/eslint/node_modules/lodash/pullAt.js @@ -13,6 +13,7 @@ var arrayMap = require('./_arrayMap'), * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove, @@ -30,7 +31,7 @@ var arrayMap = require('./_arrayMap'), * // => [10, 20] */ var pullAt = rest(function(array, indexes) { - indexes = arrayMap(baseFlatten(indexes), String); + indexes = arrayMap(baseFlatten(indexes, 1), String); var result = baseAt(array, indexes); basePullAt(array, indexes.sort(compareAscending)); diff --git a/tools/eslint/node_modules/lodash/random.js b/tools/eslint/node_modules/lodash/random.js index 2c5895b33f50dc..22e92594c0efb7 100644 --- a/tools/eslint/node_modules/lodash/random.js +++ b/tools/eslint/node_modules/lodash/random.js @@ -12,14 +12,15 @@ var nativeMin = Math.min, /** * Produces a random number between the inclusive `lower` and `upper` bounds. * If only one argument is provided a number between `0` and the given number - * is returned. If `floating` is `true`, or either `lower` or `upper` are floats, - * a floating-point number is returned instead of an integer. + * is returned. If `floating` is `true`, or either `lower` or `upper` are + * floats, a floating-point number is returned instead of an integer. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ + * @since 0.7.0 * @category Number * @param {number} [lower=0] The lower bound. * @param {number} [upper=1] The upper bound. diff --git a/tools/eslint/node_modules/lodash/range.js b/tools/eslint/node_modules/lodash/range.js index 231c2bc1d20459..0b1907964ceae9 100644 --- a/tools/eslint/node_modules/lodash/range.js +++ b/tools/eslint/node_modules/lodash/range.js @@ -3,13 +3,14 @@ var createRange = require('./_createRange'); /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative - * `start` is specified without an `end` or `step`. If `end` is not specified + * `start` is specified without an `end` or `step`. If `end` is not specified, * it's set to `start` with `start` then set to `0`. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {number} [start=0] The start of the range. diff --git a/tools/eslint/node_modules/lodash/rangeRight.js b/tools/eslint/node_modules/lodash/rangeRight.js index 67c2fffa0d62f0..fc580da4f63f9a 100644 --- a/tools/eslint/node_modules/lodash/rangeRight.js +++ b/tools/eslint/node_modules/lodash/rangeRight.js @@ -6,6 +6,7 @@ var createRange = require('./_createRange'); * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. diff --git a/tools/eslint/node_modules/lodash/rearg.js b/tools/eslint/node_modules/lodash/rearg.js index 1fc204afd064eb..912312843b8c3e 100644 --- a/tools/eslint/node_modules/lodash/rearg.js +++ b/tools/eslint/node_modules/lodash/rearg.js @@ -7,12 +7,13 @@ var REARG_FLAG = 256; /** * Creates a function that invokes `func` with arguments arranged according - * to the specified indexes where the argument value at the first index is + * to the specified `indexes` where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * * @static * @memberOf _ + * @since 3.0.0 * @category Function * @param {Function} func The function to rearrange arguments for. * @param {...(number|number[])} indexes The arranged argument indexes, @@ -28,7 +29,7 @@ var REARG_FLAG = 256; * // => ['a', 'b', 'c'] */ var rearg = rest(function(func, indexes) { - return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); + return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1)); }); module.exports = rearg; diff --git a/tools/eslint/node_modules/lodash/reduce.js b/tools/eslint/node_modules/lodash/reduce.js index 98da3ff0a2219d..3fdfd04ecb4a46 100644 --- a/tools/eslint/node_modules/lodash/reduce.js +++ b/tools/eslint/node_modules/lodash/reduce.js @@ -6,9 +6,9 @@ var arrayReduce = require('./_arrayReduce'), /** * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` through `iteratee`, where each successive + * each element in `collection` thru `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` - * is not given the first element of `collection` is used as the initial + * is not given, the first element of `collection` is used as the initial * value. The iteratee is invoked with four arguments: * (accumulator, value, index|key, collection). * @@ -21,6 +21,7 @@ var arrayReduce = require('./_arrayReduce'), * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. diff --git a/tools/eslint/node_modules/lodash/reduceRight.js b/tools/eslint/node_modules/lodash/reduceRight.js index af62c6c191d242..992b661eb38fd3 100644 --- a/tools/eslint/node_modules/lodash/reduceRight.js +++ b/tools/eslint/node_modules/lodash/reduceRight.js @@ -10,6 +10,7 @@ var arrayReduceRight = require('./_arrayReduceRight'), * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. diff --git a/tools/eslint/node_modules/lodash/reject.js b/tools/eslint/node_modules/lodash/reject.js index 81ea0dd552dbe2..92165abb9bbdd1 100644 --- a/tools/eslint/node_modules/lodash/reject.js +++ b/tools/eslint/node_modules/lodash/reject.js @@ -9,9 +9,11 @@ var arrayFilter = require('./_arrayFilter'), * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @example * diff --git a/tools/eslint/node_modules/lodash/remove.js b/tools/eslint/node_modules/lodash/remove.js index bf513906735c16..ef3d68187d52cd 100644 --- a/tools/eslint/node_modules/lodash/remove.js +++ b/tools/eslint/node_modules/lodash/remove.js @@ -3,16 +3,19 @@ var baseIteratee = require('./_baseIteratee'), /** * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked with - * three arguments: (value, index, array). + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). * - * **Note:** Unlike `_.filter`, this method mutates `array`. + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. * * @static * @memberOf _ + * @since 2.0.0 * @category Array * @param {Array} array The array to modify. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the new array of removed elements. * @example * diff --git a/tools/eslint/node_modules/lodash/repeat.js b/tools/eslint/node_modules/lodash/repeat.js index d2a9cd29ff8d73..f4d8c69a0553db 100644 --- a/tools/eslint/node_modules/lodash/repeat.js +++ b/tools/eslint/node_modules/lodash/repeat.js @@ -1,20 +1,18 @@ -var toInteger = require('./toInteger'), +var baseRepeat = require('./_baseRepeat'), + isIterateeCall = require('./_isIterateeCall'), + toInteger = require('./toInteger'), toString = require('./toString'); -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeFloor = Math.floor; - /** * Repeats the given string `n` times. * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to repeat. - * @param {number} [n=0] The number of times to repeat the string. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the repeated string. * @example * @@ -27,25 +25,13 @@ var nativeFloor = Math.floor; * _.repeat('abc', 0); * // => '' */ -function repeat(string, n) { - string = toString(string); - n = toInteger(n); - - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; +function repeat(string, n, guard) { + if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - string += string; - } while (n); - - return result; + return baseRepeat(toString(string), n); } module.exports = repeat; diff --git a/tools/eslint/node_modules/lodash/replace.js b/tools/eslint/node_modules/lodash/replace.js index 908d6a62370c97..6e26ecd8273a3a 100644 --- a/tools/eslint/node_modules/lodash/replace.js +++ b/tools/eslint/node_modules/lodash/replace.js @@ -3,10 +3,12 @@ var toString = require('./toString'); /** * Replaces matches for `pattern` in `string` with `replacement`. * - * **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace). + * **Note:** This method is based on + * [`String#replace`](https://mdn.io/String/replace). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to modify. * @param {RegExp|string} pattern The pattern to replace. diff --git a/tools/eslint/node_modules/lodash/rest.js b/tools/eslint/node_modules/lodash/rest.js index 40856aeee9c5f0..ddb732694734c6 100644 --- a/tools/eslint/node_modules/lodash/rest.js +++ b/tools/eslint/node_modules/lodash/rest.js @@ -9,12 +9,15 @@ var nativeMax = Math.max; /** * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. + * created function and arguments from `start` and beyond provided as + * an array. * - * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. diff --git a/tools/eslint/node_modules/lodash/result.js b/tools/eslint/node_modules/lodash/result.js index 99b7f1bacd8965..caf18b0fb0dc2f 100644 --- a/tools/eslint/node_modules/lodash/result.js +++ b/tools/eslint/node_modules/lodash/result.js @@ -1,20 +1,19 @@ -var baseToPath = require('./_baseToPath'), - get = require('./get'), +var baseCastPath = require('./_baseCastPath'), isFunction = require('./isFunction'), - isKey = require('./_isKey'), - parent = require('./_parent'); + isKey = require('./_isKey'); /** - * This method is like `_.get` except that if the resolved value is a function - * it's invoked with the `this` binding of its parent object and its result - * is returned. + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * @@ -33,17 +32,25 @@ var baseToPath = require('./_baseToPath'), * // => 'default' */ function result(object, path, defaultValue) { - if (!isKey(path, object)) { - path = baseToPath(path); - var result = get(object, path); - object = parent(object, path); - } else { - result = object == null ? undefined : object[path]; + path = isKey(path, object) ? [path] : baseCastPath(path); + + var index = -1, + length = path.length; + + // Ensure the loop is entered when path is empty. + if (!length) { + object = undefined; + length = 1; } - if (result === undefined) { - result = defaultValue; + while (++index < length) { + var value = object == null ? undefined : object[path[index]]; + if (value === undefined) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; } - return isFunction(result) ? result.call(object) : result; + return object; } module.exports = result; diff --git a/tools/eslint/node_modules/lodash/reverse.js b/tools/eslint/node_modules/lodash/reverse.js index 049284911db289..d56699706ce582 100644 --- a/tools/eslint/node_modules/lodash/reverse.js +++ b/tools/eslint/node_modules/lodash/reverse.js @@ -13,7 +13,9 @@ var nativeReverse = arrayProto.reverse; * * @static * @memberOf _ + * @since 4.0.0 * @category Array + * @param {Array} array The array to modify. * @returns {Array} Returns `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/round.js b/tools/eslint/node_modules/lodash/round.js index c5f1f85e6c869a..fccc83101e79b1 100644 --- a/tools/eslint/node_modules/lodash/round.js +++ b/tools/eslint/node_modules/lodash/round.js @@ -5,6 +5,7 @@ var createRound = require('./_createRound'); * * @static * @memberOf _ + * @since 3.10.0 * @category Math * @param {number} number The number to round. * @param {number} [precision=0] The precision to round to. diff --git a/tools/eslint/node_modules/lodash/sample.js b/tools/eslint/node_modules/lodash/sample.js index 1a4d813695f6df..aff8e77d06b51e 100644 --- a/tools/eslint/node_modules/lodash/sample.js +++ b/tools/eslint/node_modules/lodash/sample.js @@ -7,6 +7,7 @@ var baseRandom = require('./_baseRandom'), * * @static * @memberOf _ + * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. diff --git a/tools/eslint/node_modules/lodash/sampleSize.js b/tools/eslint/node_modules/lodash/sampleSize.js index 47e7b116e394ef..29df2e6f222a0e 100644 --- a/tools/eslint/node_modules/lodash/sampleSize.js +++ b/tools/eslint/node_modules/lodash/sampleSize.js @@ -1,5 +1,6 @@ var baseClamp = require('./_baseClamp'), baseRandom = require('./_baseRandom'), + isIterateeCall = require('./_isIterateeCall'), toArray = require('./toArray'), toInteger = require('./toInteger'); @@ -9,9 +10,11 @@ var baseClamp = require('./_baseClamp'), * * @static * @memberOf _ + * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. - * @param {number} [n=0] The number of elements to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the random elements. * @example * @@ -21,13 +24,17 @@ var baseClamp = require('./_baseClamp'), * _.sampleSize([1, 2, 3], 4); * // => [2, 3, 1] */ -function sampleSize(collection, n) { +function sampleSize(collection, n, guard) { var index = -1, result = toArray(collection), length = result.length, lastIndex = length - 1; - n = baseClamp(toInteger(n), 0, length); + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { + n = 1; + } else { + n = baseClamp(toInteger(n), 0, length); + } while (++index < n) { var rand = baseRandom(index, lastIndex), value = result[rand]; diff --git a/tools/eslint/node_modules/lodash/seq.js b/tools/eslint/node_modules/lodash/seq.js index 15aac5a1696e6b..1570c2db7b3843 100644 --- a/tools/eslint/node_modules/lodash/seq.js +++ b/tools/eslint/node_modules/lodash/seq.js @@ -2,7 +2,6 @@ module.exports = { 'at': require('./wrapperAt'), 'chain': require('./chain'), 'commit': require('./commit'), - 'flatMap': require('./wrapperFlatMap'), 'lodash': require('./wrapperLodash'), 'next': require('./next'), 'plant': require('./plant'), diff --git a/tools/eslint/node_modules/lodash/set.js b/tools/eslint/node_modules/lodash/set.js index 9777731d4fb5fa..d6630027f12964 100644 --- a/tools/eslint/node_modules/lodash/set.js +++ b/tools/eslint/node_modules/lodash/set.js @@ -1,7 +1,7 @@ var baseSet = require('./_baseSet'); /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, * it's created. Arrays are created for missing index properties while objects * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. @@ -10,6 +10,7 @@ var baseSet = require('./_baseSet'); * * @static * @memberOf _ + * @since 3.7.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. @@ -23,7 +24,7 @@ var baseSet = require('./_baseSet'); * console.log(object.a[0].b.c); * // => 4 * - * _.set(object, 'x[0].y.z', 5); + * _.set(object, ['x', '0', 'y', 'z'], 5); * console.log(object.x[0].y.z); * // => 5 */ diff --git a/tools/eslint/node_modules/lodash/setWith.js b/tools/eslint/node_modules/lodash/setWith.js index a1a03ccc034949..fb3e0f65a7e1be 100644 --- a/tools/eslint/node_modules/lodash/setWith.js +++ b/tools/eslint/node_modules/lodash/setWith.js @@ -10,6 +10,7 @@ var baseSet = require('./_baseSet'); * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. @@ -18,8 +19,10 @@ var baseSet = require('./_baseSet'); * @returns {Object} Returns `object`. * @example * - * _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object); - * // => { '0': { '1': { '2': 3 }, 'length': 2 } } + * var object = {}; + * + * _.setWith(object, '[0][1]', 'a', Object); + * // => { '0': { '1': 'a' } } */ function setWith(object, path, value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; diff --git a/tools/eslint/node_modules/lodash/shuffle.js b/tools/eslint/node_modules/lodash/shuffle.js index c7abdf25071f5a..88d00cefe38ccd 100644 --- a/tools/eslint/node_modules/lodash/shuffle.js +++ b/tools/eslint/node_modules/lodash/shuffle.js @@ -9,6 +9,7 @@ var MAX_ARRAY_LENGTH = 4294967295; * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. diff --git a/tools/eslint/node_modules/lodash/size.js b/tools/eslint/node_modules/lodash/size.js index fbe2b3b66e349a..2e414ab47ee179 100644 --- a/tools/eslint/node_modules/lodash/size.js +++ b/tools/eslint/node_modules/lodash/size.js @@ -1,14 +1,21 @@ -var isArrayLike = require('./isArrayLike'), +var getTag = require('./_getTag'), + isArrayLike = require('./isArrayLike'), + isObjectLike = require('./isObjectLike'), isString = require('./isString'), keys = require('./keys'), stringSize = require('./_stringSize'); +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + setTag = '[object Set]'; + /** * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable properties for objects. + * values or the number of own enumerable string keyed properties for objects. * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to inspect. * @returns {number} Returns the collection size. @@ -31,6 +38,12 @@ function size(collection) { var result = collection.length; return (result && isString(collection)) ? stringSize(collection) : result; } + if (isObjectLike(collection)) { + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + } return keys(collection).length; } diff --git a/tools/eslint/node_modules/lodash/slice.js b/tools/eslint/node_modules/lodash/slice.js index 324b8391a1f478..ac8cb7546e6091 100644 --- a/tools/eslint/node_modules/lodash/slice.js +++ b/tools/eslint/node_modules/lodash/slice.js @@ -5,11 +5,13 @@ var baseSlice = require('./_baseSlice'), /** * Creates a slice of `array` from `start` up to, but not including, `end`. * - * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice) - * to ensure dense arrays are returned. + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. diff --git a/tools/eslint/node_modules/lodash/snakeCase.js b/tools/eslint/node_modules/lodash/snakeCase.js index 5bfafdf04fec1c..27f2a76764767b 100644 --- a/tools/eslint/node_modules/lodash/snakeCase.js +++ b/tools/eslint/node_modules/lodash/snakeCase.js @@ -1,10 +1,12 @@ var createCompounder = require('./_createCompounder'); /** - * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). + * Converts `string` to + * [snake case](https://en.wikipedia.org/wiki/Snake_case). * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. @@ -16,7 +18,7 @@ var createCompounder = require('./_createCompounder'); * _.snakeCase('fooBar'); * // => 'foo_bar' * - * _.snakeCase('--foo-bar'); + * _.snakeCase('--FOO-BAR--'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { diff --git a/tools/eslint/node_modules/lodash/some.js b/tools/eslint/node_modules/lodash/some.js index 7b17e0f3e6c871..eeb7c18ad218d4 100644 --- a/tools/eslint/node_modules/lodash/some.js +++ b/tools/eslint/node_modules/lodash/some.js @@ -11,11 +11,14 @@ var arraySome = require('./_arraySome'), * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); diff --git a/tools/eslint/node_modules/lodash/sortBy.js b/tools/eslint/node_modules/lodash/sortBy.js index 96cbdb2c6bf24d..17f9748aa12a02 100644 --- a/tools/eslint/node_modules/lodash/sortBy.js +++ b/tools/eslint/node_modules/lodash/sortBy.js @@ -5,36 +5,38 @@ var baseFlatten = require('./_baseFlatten'), /** * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through each iteratee. This method + * running each element in a collection thru each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ + * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] - * The iteratees to sort by, specified individually or in arrays. + * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])} + * [iteratees=[_.identity]] The iteratees to sort by, specified individually + * or in arrays. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 42 }, + * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, function(o) { return o.user; }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] * * _.sortBy(users, 'user', function(o) { * return Math.floor(o.age / 10); * }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ var sortBy = rest(function(collection, iteratees) { if (collection == null) { @@ -46,7 +48,7 @@ var sortBy = rest(function(collection, iteratees) { } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees.length = 1; } - return baseOrderBy(collection, baseFlatten(iteratees), []); + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); module.exports = sortBy; diff --git a/tools/eslint/node_modules/lodash/sortedIndex.js b/tools/eslint/node_modules/lodash/sortedIndex.js index bdb217d81a5a7d..044a57e563a245 100644 --- a/tools/eslint/node_modules/lodash/sortedIndex.js +++ b/tools/eslint/node_modules/lodash/sortedIndex.js @@ -1,15 +1,17 @@ var baseSortedIndex = require('./_baseSortedIndex'); /** - * Uses a binary search to determine the lowest index at which `value` should - * be inserted into `array` in order to maintain its sort order. + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * _.sortedIndex([30, 50], 40); diff --git a/tools/eslint/node_modules/lodash/sortedIndexBy.js b/tools/eslint/node_modules/lodash/sortedIndexBy.js index f3230e10f83116..df05972a3fe2af 100644 --- a/tools/eslint/node_modules/lodash/sortedIndexBy.js +++ b/tools/eslint/node_modules/lodash/sortedIndexBy.js @@ -8,11 +8,14 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; diff --git a/tools/eslint/node_modules/lodash/sortedIndexOf.js b/tools/eslint/node_modules/lodash/sortedIndexOf.js index 7a6caa1200e6d3..2c534d324ed510 100644 --- a/tools/eslint/node_modules/lodash/sortedIndexOf.js +++ b/tools/eslint/node_modules/lodash/sortedIndexOf.js @@ -7,6 +7,7 @@ var baseSortedIndex = require('./_baseSortedIndex'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. diff --git a/tools/eslint/node_modules/lodash/sortedLastIndex.js b/tools/eslint/node_modules/lodash/sortedLastIndex.js index ee679af5769092..919089f4a5a1f4 100644 --- a/tools/eslint/node_modules/lodash/sortedLastIndex.js +++ b/tools/eslint/node_modules/lodash/sortedLastIndex.js @@ -7,10 +7,12 @@ var baseSortedIndex = require('./_baseSortedIndex'); * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * _.sortedLastIndex([4, 5], 4); diff --git a/tools/eslint/node_modules/lodash/sortedLastIndexBy.js b/tools/eslint/node_modules/lodash/sortedLastIndexBy.js index 6517498773dc2b..74e8d7acbfee43 100644 --- a/tools/eslint/node_modules/lodash/sortedLastIndexBy.js +++ b/tools/eslint/node_modules/lodash/sortedLastIndexBy.js @@ -8,11 +8,14 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. * @example * * // The `_.property` iteratee shorthand. diff --git a/tools/eslint/node_modules/lodash/sortedLastIndexOf.js b/tools/eslint/node_modules/lodash/sortedLastIndexOf.js index 5604448837690b..80234de2d04cca 100644 --- a/tools/eslint/node_modules/lodash/sortedLastIndexOf.js +++ b/tools/eslint/node_modules/lodash/sortedLastIndexOf.js @@ -7,6 +7,7 @@ var baseSortedIndex = require('./_baseSortedIndex'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. diff --git a/tools/eslint/node_modules/lodash/sortedUniq.js b/tools/eslint/node_modules/lodash/sortedUniq.js index 6d9b5ba17582d7..866db311e4e968 100644 --- a/tools/eslint/node_modules/lodash/sortedUniq.js +++ b/tools/eslint/node_modules/lodash/sortedUniq.js @@ -6,6 +6,7 @@ var baseSortedUniq = require('./_baseSortedUniq'); * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. diff --git a/tools/eslint/node_modules/lodash/sortedUniqBy.js b/tools/eslint/node_modules/lodash/sortedUniqBy.js index c3aa5c9c6ddf65..b7105922704b44 100644 --- a/tools/eslint/node_modules/lodash/sortedUniqBy.js +++ b/tools/eslint/node_modules/lodash/sortedUniqBy.js @@ -7,6 +7,7 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. diff --git a/tools/eslint/node_modules/lodash/split.js b/tools/eslint/node_modules/lodash/split.js index 6fe9ed102106b3..e53ee99b4da022 100644 --- a/tools/eslint/node_modules/lodash/split.js +++ b/tools/eslint/node_modules/lodash/split.js @@ -1,12 +1,28 @@ -var toString = require('./toString'); +var isRegExp = require('./isRegExp'), + stringToArray = require('./_stringToArray'), + toString = require('./toString'); + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsZWJ = '\\u200d'; + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** * Splits `string` by `separator`. * - * **Note:** This method is based on [`String#split`](https://mdn.io/String/split). + * **Note:** This method is based on + * [`String#split`](https://mdn.io/String/split). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to split. * @param {RegExp|string} separator The separator pattern to split by. @@ -18,7 +34,18 @@ var toString = require('./toString'); * // => ['a', 'b'] */ function split(string, separator, limit) { - return toString(string).split(separator, limit); + string = toString(string); + if (string && ( + typeof separator == 'string' || + (separator != null && !isRegExp(separator)) + )) { + separator += ''; + if (separator == '' && reHasComplexSymbol.test(string)) { + var strSymbols = stringToArray(string); + return limit === undefined ? strSymbols : strSymbols.slice(0, limit < 0 ? 0 : limit); + } + } + return string.split(separator, limit); } module.exports = split; diff --git a/tools/eslint/node_modules/lodash/spread.js b/tools/eslint/node_modules/lodash/spread.js index ea25908367bf4f..c142004c10a928 100644 --- a/tools/eslint/node_modules/lodash/spread.js +++ b/tools/eslint/node_modules/lodash/spread.js @@ -10,13 +10,16 @@ var FUNC_ERROR_TEXT = 'Expected a function'; var nativeMax = Math.max; /** - * Creates a function that invokes `func` with the `this` binding of the created - * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). + * Creates a function that invokes `func` with the `this` binding of the + * create function and an array of arguments much like + * [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply). * - * **Note:** This method is based on the [spread operator](https://mdn.io/spread_operator). + * **Note:** This method is based on the + * [spread operator](https://mdn.io/spread_operator). * * @static * @memberOf _ + * @since 3.2.0 * @category Function * @param {Function} func The function to spread arguments over. * @param {number} [start=0] The start position of the spread. diff --git a/tools/eslint/node_modules/lodash/startCase.js b/tools/eslint/node_modules/lodash/startCase.js index 33013357db46f1..a48f21ce9b3ddf 100644 --- a/tools/eslint/node_modules/lodash/startCase.js +++ b/tools/eslint/node_modules/lodash/startCase.js @@ -1,27 +1,29 @@ -var capitalize = require('./capitalize'), - createCompounder = require('./_createCompounder'); +var createCompounder = require('./_createCompounder'), + upperFirst = require('./upperFirst'); /** - * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ + * @since 3.1.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * - * _.startCase('--foo-bar'); + * _.startCase('--foo-bar--'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * - * _.startCase('__foo_bar__'); - * // => 'Foo Bar' + * _.startCase('__FOO_BAR__'); + * // => 'FOO BAR' */ var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + capitalize(word); + return result + (index ? ' ' : '') + upperFirst(word); }); module.exports = startCase; diff --git a/tools/eslint/node_modules/lodash/startsWith.js b/tools/eslint/node_modules/lodash/startsWith.js index a7c170e55c76d8..367fbecae225f4 100644 --- a/tools/eslint/node_modules/lodash/startsWith.js +++ b/tools/eslint/node_modules/lodash/startsWith.js @@ -7,11 +7,13 @@ var baseClamp = require('./_baseClamp'), * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. * @example * * _.startsWith('abc', 'a'); diff --git a/tools/eslint/node_modules/lodash/subtract.js b/tools/eslint/node_modules/lodash/subtract.js index 9ce53f2a36e2c8..bd4086a0085bab 100644 --- a/tools/eslint/node_modules/lodash/subtract.js +++ b/tools/eslint/node_modules/lodash/subtract.js @@ -1,8 +1,11 @@ +var createMathOperation = require('./_createMathOperation'); + /** * Subtract two numbers. * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {number} minuend The first number in a subtraction. * @param {number} subtrahend The second number in a subtraction. @@ -12,18 +15,8 @@ * _.subtract(6, 4); * // => 2 */ -function subtract(minuend, subtrahend) { - var result; - if (minuend === undefined && subtrahend === undefined) { - return 0; - } - if (minuend !== undefined) { - result = minuend; - } - if (subtrahend !== undefined) { - result = result === undefined ? subtrahend : (result - subtrahend); - } - return result; -} +var subtract = createMathOperation(function(minuend, subtrahend) { + return minuend - subtrahend; +}); module.exports = subtract; diff --git a/tools/eslint/node_modules/lodash/sum.js b/tools/eslint/node_modules/lodash/sum.js index 339dd72cd7efd5..3b07ee40e77d0b 100644 --- a/tools/eslint/node_modules/lodash/sum.js +++ b/tools/eslint/node_modules/lodash/sum.js @@ -6,6 +6,7 @@ var baseSum = require('./_baseSum'), * * @static * @memberOf _ + * @since 3.4.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the sum. diff --git a/tools/eslint/node_modules/lodash/sumBy.js b/tools/eslint/node_modules/lodash/sumBy.js index 9078f6aea236ae..ce73c844908beb 100644 --- a/tools/eslint/node_modules/lodash/sumBy.js +++ b/tools/eslint/node_modules/lodash/sumBy.js @@ -8,9 +8,11 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {number} Returns the sum. * @example * diff --git a/tools/eslint/node_modules/lodash/tail.js b/tools/eslint/node_modules/lodash/tail.js index a8bd9c671543dd..459a8a379365ab 100644 --- a/tools/eslint/node_modules/lodash/tail.js +++ b/tools/eslint/node_modules/lodash/tail.js @@ -5,6 +5,7 @@ var drop = require('./drop'); * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. diff --git a/tools/eslint/node_modules/lodash/take.js b/tools/eslint/node_modules/lodash/take.js index 21b22a4e019262..b7da712ffe5549 100644 --- a/tools/eslint/node_modules/lodash/take.js +++ b/tools/eslint/node_modules/lodash/take.js @@ -6,10 +6,11 @@ var baseSlice = require('./_baseSlice'), * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/takeRight.js b/tools/eslint/node_modules/lodash/takeRight.js index c8deb057c50c41..b11fb34add5e7a 100644 --- a/tools/eslint/node_modules/lodash/takeRight.js +++ b/tools/eslint/node_modules/lodash/takeRight.js @@ -6,10 +6,11 @@ var baseSlice = require('./_baseSlice'), * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/takeRightWhile.js b/tools/eslint/node_modules/lodash/takeRightWhile.js index 1662edcb6ad06d..1d497506187cfe 100644 --- a/tools/eslint/node_modules/lodash/takeRightWhile.js +++ b/tools/eslint/node_modules/lodash/takeRightWhile.js @@ -3,14 +3,16 @@ var baseIteratee = require('./_baseIteratee'), /** * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with three - * arguments: (value, index, array). + * taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/takeWhile.js b/tools/eslint/node_modules/lodash/takeWhile.js index b1fa18b048f0c3..1283755923637c 100644 --- a/tools/eslint/node_modules/lodash/takeWhile.js +++ b/tools/eslint/node_modules/lodash/takeWhile.js @@ -8,9 +8,11 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @param {Array|Function|Object|string} [predicate=_.identity] + * The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * diff --git a/tools/eslint/node_modules/lodash/tap.js b/tools/eslint/node_modules/lodash/tap.js index a3e43a0d33b91c..d00728525ee69c 100644 --- a/tools/eslint/node_modules/lodash/tap.js +++ b/tools/eslint/node_modules/lodash/tap.js @@ -1,10 +1,11 @@ /** * This method invokes `interceptor` and returns `value`. The interceptor * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain in order to modify intermediate results. + * "tap into" a method chain sequence in order to modify intermediate results. * * @static * @memberOf _ + * @since 0.1.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. diff --git a/tools/eslint/node_modules/lodash/template.js b/tools/eslint/node_modules/lodash/template.js index c09fcde87de9b3..304d287259a8e6 100644 --- a/tools/eslint/node_modules/lodash/template.js +++ b/tools/eslint/node_modules/lodash/template.js @@ -15,7 +15,10 @@ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; -/** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ +/** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). + */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to ensure capturing order of template delimiters. */ @@ -29,7 +32,7 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * properties may be accessed as free variables in the template. If a setting - * object is given it takes precedence over `_.templateSettings` values. + * object is given, it takes precedence over `_.templateSettings` values. * * **Note:** In the development build `_.template` utilizes * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) @@ -42,17 +45,24 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @static + * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The template string. - * @param {Object} [options] The options object. - * @param {RegExp} [options.escape] The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as free variables. - * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. - * @param {string} [options.variable] The data object variable name. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the compiled template function. * @example * @@ -101,7 +111,7 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; * // Use the `sourceURL` option to specify a custom sourceURL for the template. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); - * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector + * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. * * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); @@ -121,7 +131,8 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; * '); */ function template(string, options, guard) { - // Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/) + // Based on John Resig's `tmpl` implementation + // (http://ejohn.org/blog/javascript-micro-templating/) // and Laura Doktorova's doT.js (https://github.com/olado/doT). var settings = templateSettings.imports._.templateSettings || templateSettings; @@ -210,7 +221,8 @@ function template(string, options, guard) { 'return __p\n}'; var result = attempt(function() { - return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues); + return Function(importsKeys, sourceURL + 'return ' + source) + .apply(undefined, importsValues); }); // Provide the compiled function's source by its `toString` method or diff --git a/tools/eslint/node_modules/lodash/templateSettings.js b/tools/eslint/node_modules/lodash/templateSettings.js index 67dc19b4cdbd5d..bce2f749c10a72 100644 --- a/tools/eslint/node_modules/lodash/templateSettings.js +++ b/tools/eslint/node_modules/lodash/templateSettings.js @@ -10,7 +10,7 @@ var escape = require('./escape'), * * @static * @memberOf _ - * @type Object + * @type {Object} */ var templateSettings = { @@ -18,7 +18,7 @@ var templateSettings = { * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings - * @type RegExp + * @type {RegExp} */ 'escape': reEscape, @@ -26,7 +26,7 @@ var templateSettings = { * Used to detect code to be evaluated. * * @memberOf _.templateSettings - * @type RegExp + * @type {RegExp} */ 'evaluate': reEvaluate, @@ -34,7 +34,7 @@ var templateSettings = { * Used to detect `data` property values to inject. * * @memberOf _.templateSettings - * @type RegExp + * @type {RegExp} */ 'interpolate': reInterpolate, @@ -42,7 +42,7 @@ var templateSettings = { * Used to reference the data object in the template text. * * @memberOf _.templateSettings - * @type string + * @type {string} */ 'variable': '', @@ -50,7 +50,7 @@ var templateSettings = { * Used to import variables into the compiled template. * * @memberOf _.templateSettings - * @type Object + * @type {Object} */ 'imports': { @@ -58,7 +58,7 @@ var templateSettings = { * A reference to the `lodash` function. * * @memberOf _.templateSettings.imports - * @type Function + * @type {Function} */ '_': { 'escape': escape } } diff --git a/tools/eslint/node_modules/lodash/throttle.js b/tools/eslint/node_modules/lodash/throttle.js index ff7dc7579e3beb..d2018859676213 100644 --- a/tools/eslint/node_modules/lodash/throttle.js +++ b/tools/eslint/node_modules/lodash/throttle.js @@ -14,23 +14,24 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * - * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the throttled function is - * invoked more than once during the `wait` timeout. + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. * - * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=true] Specify invoking on the leading - * edge of the timeout. - * @param {boolean} [options.trailing=true] Specify invoking on the trailing - * edge of the timeout. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * @@ -55,7 +56,11 @@ function throttle(func, wait, options) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } - return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); } module.exports = throttle; diff --git a/tools/eslint/node_modules/lodash/thru.js b/tools/eslint/node_modules/lodash/thru.js index 190d7552bb375a..91e132e52cff00 100644 --- a/tools/eslint/node_modules/lodash/thru.js +++ b/tools/eslint/node_modules/lodash/thru.js @@ -1,10 +1,11 @@ /** * This method is like `_.tap` except that it returns the result of `interceptor`. * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain. + * results in a method chain sequence. * * @static * @memberOf _ + * @since 3.0.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. diff --git a/tools/eslint/node_modules/lodash/times.js b/tools/eslint/node_modules/lodash/times.js index b7ede33bd42d18..d0bff577ab240f 100644 --- a/tools/eslint/node_modules/lodash/times.js +++ b/tools/eslint/node_modules/lodash/times.js @@ -1,5 +1,5 @@ -var baseTimes = require('./_baseTimes'), - toFunction = require('./_toFunction'), +var baseIteratee = require('./_baseIteratee'), + baseTimes = require('./_baseTimes'), toInteger = require('./toInteger'); /** Used as references for various `Number` constants. */ @@ -12,10 +12,11 @@ var MAX_ARRAY_LENGTH = 4294967295; var nativeMin = Math.min; /** - * Invokes the iteratee function `n` times, returning an array of the results - * of each invocation. The iteratee is invoked with one argument; (index). + * Invokes the iteratee `n` times, returning an array of the results of + * each invocation. The iteratee is invoked with one argument; (index). * * @static + * @since 0.1.0 * @memberOf _ * @category Util * @param {number} n The number of times to invoke `iteratee`. @@ -37,7 +38,7 @@ function times(n, iteratee) { var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); - iteratee = toFunction(iteratee); + iteratee = baseIteratee(iteratee); n -= MAX_ARRAY_LENGTH; var result = baseTimes(length, iteratee); diff --git a/tools/eslint/node_modules/lodash/toArray.js b/tools/eslint/node_modules/lodash/toArray.js index c342289194395a..6675806bb4dba3 100644 --- a/tools/eslint/node_modules/lodash/toArray.js +++ b/tools/eslint/node_modules/lodash/toArray.js @@ -20,6 +20,7 @@ var iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'sym * Converts `value` to an array. * * @static + * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to convert. diff --git a/tools/eslint/node_modules/lodash/toInteger.js b/tools/eslint/node_modules/lodash/toInteger.js index 2b5060875da25d..459f0c3710bcdc 100644 --- a/tools/eslint/node_modules/lodash/toInteger.js +++ b/tools/eslint/node_modules/lodash/toInteger.js @@ -7,10 +7,12 @@ var INFINITY = 1 / 0, /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * **Note:** This function is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. diff --git a/tools/eslint/node_modules/lodash/toIterator.js b/tools/eslint/node_modules/lodash/toIterator.js index c50c4d17b4ce77..beeed5d55c668c 100644 --- a/tools/eslint/node_modules/lodash/toIterator.js +++ b/tools/eslint/node_modules/lodash/toIterator.js @@ -3,6 +3,7 @@ * * @name Symbol.iterator * @memberOf _ + * @since 4.0.0 * @category Seq * @returns {Object} Returns the wrapper object. * @example diff --git a/tools/eslint/node_modules/lodash/toLength.js b/tools/eslint/node_modules/lodash/toLength.js index c1d64ca2d0de3d..9d415145016687 100644 --- a/tools/eslint/node_modules/lodash/toLength.js +++ b/tools/eslint/node_modules/lodash/toLength.js @@ -8,10 +8,12 @@ var MAX_ARRAY_LENGTH = 4294967295; * Converts `value` to an integer suitable for use as the length of an * array-like object. * - * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. diff --git a/tools/eslint/node_modules/lodash/toLower.js b/tools/eslint/node_modules/lodash/toLower.js index 02111c709a0db2..b4b7858eb03992 100644 --- a/tools/eslint/node_modules/lodash/toLower.js +++ b/tools/eslint/node_modules/lodash/toLower.js @@ -1,17 +1,19 @@ var toString = require('./toString'); /** - * Converts `string`, as a whole, to lower case. + * Converts `string`, as a whole, to lower case just like + * [String#toLowerCase](https://mdn.io/toLowerCase). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * - * _.toLower('--Foo-Bar'); - * // => '--foo-bar' + * _.toLower('--Foo-Bar--'); + * // => '--foo-bar--' * * _.toLower('fooBar'); * // => 'foobar' diff --git a/tools/eslint/node_modules/lodash/toNumber.js b/tools/eslint/node_modules/lodash/toNumber.js index 8fc0a78d7aed53..9baba7059229c8 100644 --- a/tools/eslint/node_modules/lodash/toNumber.js +++ b/tools/eslint/node_modules/lodash/toNumber.js @@ -1,5 +1,6 @@ var isFunction = require('./isFunction'), - isObject = require('./isObject'); + isObject = require('./isObject'), + isSymbol = require('./isSymbol'); /** Used as references for various `Number` constants. */ var NAN = 0 / 0; @@ -24,6 +25,7 @@ var freeParseInt = parseInt; * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. @@ -42,6 +44,12 @@ var freeParseInt = parseInt; * // => 3 */ function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } if (isObject(value)) { var other = isFunction(value.valueOf) ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; diff --git a/tools/eslint/node_modules/lodash/toPairs.js b/tools/eslint/node_modules/lodash/toPairs.js index 8c6e4d0b0dec35..417ac8ce9cb9a1 100644 --- a/tools/eslint/node_modules/lodash/toPairs.js +++ b/tools/eslint/node_modules/lodash/toPairs.js @@ -2,10 +2,13 @@ var baseToPairs = require('./_baseToPairs'), keys = require('./keys'); /** - * Creates an array of own enumerable key-value pairs for `object`. + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. * * @static * @memberOf _ + * @since 4.0.0 + * @alias entries * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. diff --git a/tools/eslint/node_modules/lodash/toPairsIn.js b/tools/eslint/node_modules/lodash/toPairsIn.js index a6f882bc45a5ea..b84ef7e94645e8 100644 --- a/tools/eslint/node_modules/lodash/toPairsIn.js +++ b/tools/eslint/node_modules/lodash/toPairsIn.js @@ -2,10 +2,13 @@ var baseToPairs = require('./_baseToPairs'), keysIn = require('./keysIn'); /** - * Creates an array of own and inherited enumerable key-value pairs for `object`. + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. * * @static * @memberOf _ + * @since 4.0.0 + * @alias entriesIn * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. diff --git a/tools/eslint/node_modules/lodash/toPath.js b/tools/eslint/node_modules/lodash/toPath.js index 270698deff6c44..7fe9fe6d19cdd6 100644 --- a/tools/eslint/node_modules/lodash/toPath.js +++ b/tools/eslint/node_modules/lodash/toPath.js @@ -1,5 +1,8 @@ var arrayMap = require('./_arrayMap'), + baseCastKey = require('./_baseCastKey'), + copyArray = require('./_copyArray'), isArray = require('./isArray'), + isSymbol = require('./isSymbol'), stringToPath = require('./_stringToPath'); /** @@ -7,6 +10,7 @@ var arrayMap = require('./_arrayMap'), * * @static * @memberOf _ + * @since 4.0.0 * @category Util * @param {*} value The value to convert. * @returns {Array} Returns the new property path array. @@ -28,7 +32,10 @@ var arrayMap = require('./_arrayMap'), * // => false */ function toPath(value) { - return isArray(value) ? arrayMap(value, String) : stringToPath(value); + if (isArray(value)) { + return arrayMap(value, baseCastKey); + } + return isSymbol(value) ? [value] : copyArray(stringToPath(value)); } module.exports = toPath; diff --git a/tools/eslint/node_modules/lodash/toPlainObject.js b/tools/eslint/node_modules/lodash/toPlainObject.js index ec6eb699fdd14b..5de79b8b3cd9a7 100644 --- a/tools/eslint/node_modules/lodash/toPlainObject.js +++ b/tools/eslint/node_modules/lodash/toPlainObject.js @@ -2,11 +2,12 @@ var copyObject = require('./_copyObject'), keysIn = require('./keysIn'); /** - * Converts `value` to a plain object flattening inherited enumerable - * properties of `value` to own properties of the plain object. + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. diff --git a/tools/eslint/node_modules/lodash/toSafeInteger.js b/tools/eslint/node_modules/lodash/toSafeInteger.js index 6350b76e936e3e..475874fbffda11 100644 --- a/tools/eslint/node_modules/lodash/toSafeInteger.js +++ b/tools/eslint/node_modules/lodash/toSafeInteger.js @@ -10,6 +10,7 @@ var MAX_SAFE_INTEGER = 9007199254740991; * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. diff --git a/tools/eslint/node_modules/lodash/toString.js b/tools/eslint/node_modules/lodash/toString.js index 1e1d2d8f421532..52ce4785f8ee95 100644 --- a/tools/eslint/node_modules/lodash/toString.js +++ b/tools/eslint/node_modules/lodash/toString.js @@ -6,7 +6,7 @@ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = Symbol ? symbolProto.toString : undefined; + symbolToString = symbolProto ? symbolProto.toString : undefined; /** * Converts `value` to a string if it's not one. An empty string is returned @@ -14,6 +14,7 @@ var symbolProto = Symbol ? Symbol.prototype : undefined, * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. @@ -37,7 +38,7 @@ function toString(value) { return ''; } if (isSymbol(value)) { - return Symbol ? symbolToString.call(value) : ''; + return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; diff --git a/tools/eslint/node_modules/lodash/toUpper.js b/tools/eslint/node_modules/lodash/toUpper.js index 3746142cd1bd4d..b3648e8bf9cd44 100644 --- a/tools/eslint/node_modules/lodash/toUpper.js +++ b/tools/eslint/node_modules/lodash/toUpper.js @@ -1,17 +1,19 @@ var toString = require('./toString'); /** - * Converts `string`, as a whole, to upper case. + * Converts `string`, as a whole, to upper case just like + * [String#toUpperCase](https://mdn.io/toUpperCase). * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * - * _.toUpper('--foo-bar'); - * // => '--FOO-BAR' + * _.toUpper('--foo-bar--'); + * // => '--FOO-BAR--' * * _.toUpper('fooBar'); * // => 'FOOBAR' diff --git a/tools/eslint/node_modules/lodash/transform.js b/tools/eslint/node_modules/lodash/transform.js index 3aa48edb464690..3013a83cb2d161 100644 --- a/tools/eslint/node_modules/lodash/transform.js +++ b/tools/eslint/node_modules/lodash/transform.js @@ -2,6 +2,7 @@ var arrayEach = require('./_arrayEach'), baseCreate = require('./_baseCreate'), baseForOwn = require('./_baseForOwn'), baseIteratee = require('./_baseIteratee'), + getPrototype = require('./_getPrototype'), isArray = require('./isArray'), isFunction = require('./isFunction'), isObject = require('./isObject'), @@ -9,14 +10,15 @@ var arrayEach = require('./_arrayEach'), /** * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own enumerable - * properties through `iteratee`, with each invocation potentially mutating - * the `accumulator` object. The iteratee is invoked with four arguments: - * (accumulator, value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. The iteratee is invoked + * with four arguments: (accumulator, value, key, object). Iteratee functions + * may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ + * @since 1.3.0 * @category Object * @param {Array|Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -45,7 +47,7 @@ function transform(object, iteratee, accumulator) { if (isArr) { accumulator = isArray(object) ? new Ctor : []; } else { - accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; } } else { accumulator = {}; diff --git a/tools/eslint/node_modules/lodash/trim.js b/tools/eslint/node_modules/lodash/trim.js index 47f73b686c7d87..936e801dd7e7ec 100644 --- a/tools/eslint/node_modules/lodash/trim.js +++ b/tools/eslint/node_modules/lodash/trim.js @@ -11,10 +11,11 @@ var reTrim = /^\s+|\s+$/g; * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -42,7 +43,9 @@ function trim(string, chars, guard) { var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars); - return strSymbols.slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1).join(''); + return strSymbols + .slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1) + .join(''); } module.exports = trim; diff --git a/tools/eslint/node_modules/lodash/trimEnd.js b/tools/eslint/node_modules/lodash/trimEnd.js index 743dc41c9dc9aa..51b5599875eaf7 100644 --- a/tools/eslint/node_modules/lodash/trimEnd.js +++ b/tools/eslint/node_modules/lodash/trimEnd.js @@ -10,10 +10,11 @@ var reTrimEnd = /\s+$/; * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -36,7 +37,9 @@ function trimEnd(string, chars, guard) { return string; } var strSymbols = stringToArray(string); - return strSymbols.slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1).join(''); + return strSymbols + .slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1) + .join(''); } module.exports = trimEnd; diff --git a/tools/eslint/node_modules/lodash/trimStart.js b/tools/eslint/node_modules/lodash/trimStart.js index cdd3b6a99bde7a..d8db3724ae15f8 100644 --- a/tools/eslint/node_modules/lodash/trimStart.js +++ b/tools/eslint/node_modules/lodash/trimStart.js @@ -10,10 +10,11 @@ var reTrimStart = /^\s+/; * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -36,7 +37,9 @@ function trimStart(string, chars, guard) { return string; } var strSymbols = stringToArray(string); - return strSymbols.slice(charsStartIndex(strSymbols, stringToArray(chars))).join(''); + return strSymbols + .slice(charsStartIndex(strSymbols, stringToArray(chars))) + .join(''); } module.exports = trimStart; diff --git a/tools/eslint/node_modules/lodash/truncate.js b/tools/eslint/node_modules/lodash/truncate.js index 18b1c39c8152d6..ec7379480b47e6 100644 --- a/tools/eslint/node_modules/lodash/truncate.js +++ b/tools/eslint/node_modules/lodash/truncate.js @@ -31,9 +31,10 @@ var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to truncate. - * @param {Object} [options] The options object. + * @param {Object} [options={}] The options object. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string to indicate text is omitted. * @param {RegExp|string} [options.separator] The separator pattern to truncate to. diff --git a/tools/eslint/node_modules/lodash/unary.js b/tools/eslint/node_modules/lodash/unary.js index c18ebd8cdef0a2..34c144c5dad247 100644 --- a/tools/eslint/node_modules/lodash/unary.js +++ b/tools/eslint/node_modules/lodash/unary.js @@ -6,6 +6,7 @@ var ary = require('./ary'); * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new function. diff --git a/tools/eslint/node_modules/lodash/unescape.js b/tools/eslint/node_modules/lodash/unescape.js index 046893366d4c26..929bb1675d7c0c 100644 --- a/tools/eslint/node_modules/lodash/unescape.js +++ b/tools/eslint/node_modules/lodash/unescape.js @@ -7,14 +7,15 @@ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, /** * The inverse of `_.escape`; this method converts the HTML entities - * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to their - * corresponding characters. + * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to + * their corresponding characters. * - * **Note:** No other HTML entities are unescaped. To unescape additional HTML - * entities use a third-party library like [_he_](https://mths.be/he). + * **Note:** No other HTML entities are unescaped. To unescape additional + * HTML entities use a third-party library like [_he_](https://mths.be/he). * * @static * @memberOf _ + * @since 0.6.0 * @category String * @param {string} [string=''] The string to unescape. * @returns {string} Returns the unescaped string. diff --git a/tools/eslint/node_modules/lodash/union.js b/tools/eslint/node_modules/lodash/union.js index fafe1885e2cad0..1276c886a2de75 100644 --- a/tools/eslint/node_modules/lodash/union.js +++ b/tools/eslint/node_modules/lodash/union.js @@ -1,5 +1,6 @@ var baseFlatten = require('./_baseFlatten'), baseUniq = require('./_baseUniq'), + isArrayLikeObject = require('./isArrayLikeObject'), rest = require('./rest'); /** @@ -9,6 +10,7 @@ var baseFlatten = require('./_baseFlatten'), * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. @@ -18,7 +20,7 @@ var baseFlatten = require('./_baseFlatten'), * // => [2, 1, 4] */ var union = rest(function(arrays) { - return baseUniq(baseFlatten(arrays, false, true)); + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); }); module.exports = union; diff --git a/tools/eslint/node_modules/lodash/unionBy.js b/tools/eslint/node_modules/lodash/unionBy.js index 26050bcd4f785f..f44340cb0748c9 100644 --- a/tools/eslint/node_modules/lodash/unionBy.js +++ b/tools/eslint/node_modules/lodash/unionBy.js @@ -7,14 +7,17 @@ var baseFlatten = require('./_baseFlatten'), /** * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). + * invoked for each element of each `arrays` to generate the criterion by + * which uniqueness is computed. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new array of combined values. * @example * @@ -30,7 +33,7 @@ var unionBy = rest(function(arrays) { if (isArrayLikeObject(iteratee)) { iteratee = undefined; } - return baseUniq(baseFlatten(arrays, false, true), baseIteratee(iteratee)); + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee)); }); module.exports = unionBy; diff --git a/tools/eslint/node_modules/lodash/unionWith.js b/tools/eslint/node_modules/lodash/unionWith.js index 1eca729069e44a..dad71f9f3756a1 100644 --- a/tools/eslint/node_modules/lodash/unionWith.js +++ b/tools/eslint/node_modules/lodash/unionWith.js @@ -11,6 +11,7 @@ var baseFlatten = require('./_baseFlatten'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. @@ -28,7 +29,7 @@ var unionWith = rest(function(arrays) { if (isArrayLikeObject(comparator)) { comparator = undefined; } - return baseUniq(baseFlatten(arrays, false, true), undefined, comparator); + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); }); module.exports = unionWith; diff --git a/tools/eslint/node_modules/lodash/uniq.js b/tools/eslint/node_modules/lodash/uniq.js index fcaec4e4fc2770..0e99ee932b9995 100644 --- a/tools/eslint/node_modules/lodash/uniq.js +++ b/tools/eslint/node_modules/lodash/uniq.js @@ -3,11 +3,12 @@ var baseUniq = require('./_baseUniq'); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. + * for equality comparisons, in which only the first occurrence of each + * element is kept. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. diff --git a/tools/eslint/node_modules/lodash/uniqBy.js b/tools/eslint/node_modules/lodash/uniqBy.js index 4fc843b8a41c2c..91cf9e06328d62 100644 --- a/tools/eslint/node_modules/lodash/uniqBy.js +++ b/tools/eslint/node_modules/lodash/uniqBy.js @@ -8,9 +8,11 @@ var baseIteratee = require('./_baseIteratee'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * diff --git a/tools/eslint/node_modules/lodash/uniqWith.js b/tools/eslint/node_modules/lodash/uniqWith.js index 5bef1515048635..957c17d6a9684c 100644 --- a/tools/eslint/node_modules/lodash/uniqWith.js +++ b/tools/eslint/node_modules/lodash/uniqWith.js @@ -7,6 +7,7 @@ var baseUniq = require('./_baseUniq'); * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [comparator] The comparator invoked per element. diff --git a/tools/eslint/node_modules/lodash/uniqueId.js b/tools/eslint/node_modules/lodash/uniqueId.js index a39b2bcbe2b5a1..ffa8c034722f51 100644 --- a/tools/eslint/node_modules/lodash/uniqueId.js +++ b/tools/eslint/node_modules/lodash/uniqueId.js @@ -4,12 +4,13 @@ var toString = require('./toString'); var idCounter = 0; /** - * Generates a unique ID. If `prefix` is given the ID is appended to it. + * Generates a unique ID. If `prefix` is given, the ID is appended to it. * * @static + * @since 0.1.0 * @memberOf _ * @category Util - * @param {string} [prefix] The value to prefix the ID with. + * @param {string} [prefix=''] The value to prefix the ID with. * @returns {string} Returns the unique ID. * @example * diff --git a/tools/eslint/node_modules/lodash/unset.js b/tools/eslint/node_modules/lodash/unset.js index 91daee09d539b5..723c3d44b2c9ad 100644 --- a/tools/eslint/node_modules/lodash/unset.js +++ b/tools/eslint/node_modules/lodash/unset.js @@ -7,6 +7,7 @@ var baseUnset = require('./_baseUnset'); * * @static * @memberOf _ + * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. @@ -20,7 +21,7 @@ var baseUnset = require('./_baseUnset'); * console.log(object); * // => { 'a': [{ 'b': {} }] }; * - * _.unset(object, 'a[0].b.c'); + * _.unset(object, ['a', '0', 'b', 'c']); * // => true * * console.log(object); diff --git a/tools/eslint/node_modules/lodash/unzip.js b/tools/eslint/node_modules/lodash/unzip.js index 0dddd4447bbd3e..7990d26e85091d 100644 --- a/tools/eslint/node_modules/lodash/unzip.js +++ b/tools/eslint/node_modules/lodash/unzip.js @@ -14,6 +14,7 @@ var nativeMax = Math.max; * * @static * @memberOf _ + * @since 1.2.0 * @category Array * @param {Array} array The array of grouped elements to process. * @returns {Array} Returns the new array of regrouped elements. diff --git a/tools/eslint/node_modules/lodash/unzipWith.js b/tools/eslint/node_modules/lodash/unzipWith.js index b8f5d5e7ec74c1..926c8993d904bf 100644 --- a/tools/eslint/node_modules/lodash/unzipWith.js +++ b/tools/eslint/node_modules/lodash/unzipWith.js @@ -9,9 +9,11 @@ var apply = require('./_apply'), * * @static * @memberOf _ + * @since 3.8.0 * @category Array * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine regrouped values. + * @param {Function} [iteratee=_.identity] The function to combine + * regrouped values. * @returns {Array} Returns the new array of regrouped elements. * @example * diff --git a/tools/eslint/node_modules/lodash/update.js b/tools/eslint/node_modules/lodash/update.js new file mode 100644 index 00000000000000..4b2f560d98443e --- /dev/null +++ b/tools/eslint/node_modules/lodash/update.js @@ -0,0 +1,35 @@ +var baseCastFunction = require('./_baseCastFunction'), + baseUpdate = require('./_baseUpdate'); + +/** + * This method is like `_.set` except that accepts `updater` to produce the + * value to set. Use `_.updateWith` to customize `path` creation. The `updater` + * is invoked with one argument: (value). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.update(object, 'a[0].b.c', function(n) { return n * n; }); + * console.log(object.a[0].b.c); + * // => 9 + * + * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); + * console.log(object.x[0].y.z); + * // => 0 + */ +function update(object, path, updater) { + return object == null ? object : baseUpdate(object, path, baseCastFunction(updater)); +} + +module.exports = update; diff --git a/tools/eslint/node_modules/lodash/updateWith.js b/tools/eslint/node_modules/lodash/updateWith.js new file mode 100644 index 00000000000000..2fee30f1f54d81 --- /dev/null +++ b/tools/eslint/node_modules/lodash/updateWith.js @@ -0,0 +1,33 @@ +var baseCastFunction = require('./_baseCastFunction'), + baseUpdate = require('./_baseUpdate'); + +/** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ +function updateWith(object, path, updater, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseUpdate(object, path, baseCastFunction(updater), customizer); +} + +module.exports = updateWith; diff --git a/tools/eslint/node_modules/lodash/upperCase.js b/tools/eslint/node_modules/lodash/upperCase.js index e09737ffcf89dc..efbb8b06cf4c9e 100644 --- a/tools/eslint/node_modules/lodash/upperCase.js +++ b/tools/eslint/node_modules/lodash/upperCase.js @@ -5,6 +5,7 @@ var createCompounder = require('./_createCompounder'); * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. diff --git a/tools/eslint/node_modules/lodash/upperFirst.js b/tools/eslint/node_modules/lodash/upperFirst.js index 14d74d5c379ecb..1dd64e13561334 100644 --- a/tools/eslint/node_modules/lodash/upperFirst.js +++ b/tools/eslint/node_modules/lodash/upperFirst.js @@ -5,6 +5,7 @@ var createCaseFirst = require('./_createCaseFirst'); * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. diff --git a/tools/eslint/node_modules/lodash/values.js b/tools/eslint/node_modules/lodash/values.js index 70915b59561fb6..738260bcb74a90 100644 --- a/tools/eslint/node_modules/lodash/values.js +++ b/tools/eslint/node_modules/lodash/values.js @@ -2,11 +2,12 @@ var baseValues = require('./_baseValues'), keys = require('./keys'); /** - * Creates an array of the own enumerable property values of `object`. + * Creates an array of the own enumerable string keyed property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static + * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. diff --git a/tools/eslint/node_modules/lodash/valuesIn.js b/tools/eslint/node_modules/lodash/valuesIn.js index 2e8b8ba8e49e7b..6296094207986f 100644 --- a/tools/eslint/node_modules/lodash/valuesIn.js +++ b/tools/eslint/node_modules/lodash/valuesIn.js @@ -2,12 +2,14 @@ var baseValues = require('./_baseValues'), keysIn = require('./keysIn'); /** - * Creates an array of the own and inherited enumerable property values of `object`. + * Creates an array of the own and inherited enumerable string keyed property + * values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ + * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. @@ -24,7 +26,7 @@ var baseValues = require('./_baseValues'), * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { - return object == null ? baseValues(object, keysIn(object)) : []; + return object == null ? [] : baseValues(object, keysIn(object)); } module.exports = valuesIn; diff --git a/tools/eslint/node_modules/lodash/without.js b/tools/eslint/node_modules/lodash/without.js index b7dea5d5cc003f..0900f232ff7c79 100644 --- a/tools/eslint/node_modules/lodash/without.js +++ b/tools/eslint/node_modules/lodash/without.js @@ -9,6 +9,7 @@ var baseDifference = require('./_baseDifference'), * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to filter. * @param {...*} [values] The values to exclude. diff --git a/tools/eslint/node_modules/lodash/words.js b/tools/eslint/node_modules/lodash/words.js index 20ea44987cf78d..c6d712c600cbd2 100644 --- a/tools/eslint/node_modules/lodash/words.js +++ b/tools/eslint/node_modules/lodash/words.js @@ -52,17 +52,18 @@ var reComplexWord = RegExp([ ].join('|'), 'g'); /** Used to detect strings that need a more robust regexp to match words. */ -var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; +var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** * Splits `string` into an array of its words. * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the words of `string`. * @example * diff --git a/tools/eslint/node_modules/lodash/wrap.js b/tools/eslint/node_modules/lodash/wrap.js index 51dcf2fee6b0fb..9a4542de31c5dd 100644 --- a/tools/eslint/node_modules/lodash/wrap.js +++ b/tools/eslint/node_modules/lodash/wrap.js @@ -9,9 +9,10 @@ var identity = require('./identity'), * * @static * @memberOf _ + * @since 0.1.0 * @category Function * @param {*} value The value to wrap. - * @param {Function} wrapper The wrapper function. + * @param {Function} [wrapper=identity] The wrapper function. * @returns {Function} Returns the new function. * @example * diff --git a/tools/eslint/node_modules/lodash/wrapperAt.js b/tools/eslint/node_modules/lodash/wrapperAt.js index ce06e72b983c83..631d7c590945e6 100644 --- a/tools/eslint/node_modules/lodash/wrapperAt.js +++ b/tools/eslint/node_modules/lodash/wrapperAt.js @@ -11,6 +11,7 @@ var LazyWrapper = require('./_LazyWrapper'), * * @name at * @memberOf _ + * @since 1.0.0 * @category Seq * @param {...(string|string[])} [paths] The property paths of elements to pick, * specified individually or in arrays. @@ -26,17 +27,22 @@ var LazyWrapper = require('./_LazyWrapper'), * // => ['a', 'c'] */ var wrapperAt = rest(function(paths) { - paths = baseFlatten(paths); + paths = baseFlatten(paths, 1); var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; - if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { + if (length > 1 || this.__actions__.length || + !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); + value.__actions__.push({ + 'func': thru, + 'args': [interceptor], + 'thisArg': undefined + }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined); diff --git a/tools/eslint/node_modules/lodash/wrapperChain.js b/tools/eslint/node_modules/lodash/wrapperChain.js index 52f85319c861ba..bda2ce69c97c1f 100644 --- a/tools/eslint/node_modules/lodash/wrapperChain.js +++ b/tools/eslint/node_modules/lodash/wrapperChain.js @@ -1,10 +1,11 @@ var chain = require('./chain'); /** - * Enables explicit method chaining on the wrapper object. + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. * * @name chain * @memberOf _ + * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example diff --git a/tools/eslint/node_modules/lodash/wrapperFlatMap.js b/tools/eslint/node_modules/lodash/wrapperFlatMap.js deleted file mode 100644 index 4c2f85b08710ae..00000000000000 --- a/tools/eslint/node_modules/lodash/wrapperFlatMap.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This method is the wrapper version of `_.flatMap`. - * - * @name flatMap - * @memberOf _ - * @category Seq - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _([1, 2]).flatMap(duplicate).value(); - * // => [1, 1, 2, 2] - */ -function wrapperFlatMap(iteratee) { - return this.map(iteratee).flatten(); -} - -module.exports = wrapperFlatMap; diff --git a/tools/eslint/node_modules/lodash/wrapperLodash.js b/tools/eslint/node_modules/lodash/wrapperLodash.js index 3c38eb9cba4b97..c17d6467f294a1 100644 --- a/tools/eslint/node_modules/lodash/wrapperLodash.js +++ b/tools/eslint/node_modules/lodash/wrapperLodash.js @@ -13,25 +13,25 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Creates a `lodash` object which wraps `value` to enable implicit method - * chaining. Methods that operate on and return arrays, collections, and - * functions can be chained together. Methods that retrieve a single value or - * may return a primitive value will automatically end the chain sequence and - * return the unwrapped value. Otherwise, the value must be unwrapped with - * `_#value`. + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. * - * Explicit chaining, which must be unwrapped with `_#value` in all cases, - * may be enabled using `_.chain`. + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. * * The execution of chained methods is lazy, that is, it's deferred until * `_#value` is implicitly or explicitly called. * - * Lazy evaluation allows several methods to support shortcut fusion. Shortcut - * fusion is an optimization to merge iteratee calls; this avoids the creation - * of intermediate arrays and can greatly reduce the number of iteratee executions. - * Sections of a chain sequence qualify for shortcut fusion if the section is - * applied to an array of at least two hundred elements and any iteratees - * accept only one argument. The heuristic for whether a section qualifies - * for shortcut fusion is subject to change. + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array of at least `200` elements + * and any iteratees accept only one argument. The heuristic for whether a + * section qualifies for shortcut fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. @@ -50,51 +50,55 @@ var hasOwnProperty = objectProto.hasOwnProperty; * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` * * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, - * `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`, - * `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, - * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, - * `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, - * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`, - * `flowRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, - * `intersection`, `intersectionBy`, `intersectionWith`, `invert`, `invertBy`, - * `invokeMap`, `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, - * `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, - * `method`, `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, - * `orderBy`, `over`, `overArgs`, `overEvery`, `overSome`, `partial`, - * `partialRight`, `partition`, `pick`, `pickBy`, `plant`, `property`, - * `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, - * `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`, `sampleSize`, - * `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, - * `thru`, `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, - * `transform`, `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, - * `uniqWith`, `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, - * `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`, - * `zipObjectDeep`, and `zipWith` + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` * * The wrapper methods that are **not** chainable by default are: * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, - * `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, - * `findLast`, `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`, + * `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`, + * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`, + * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, + * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`, + * `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`, + * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`, - * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, `isMatchWith`, - * `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`, - * `isPlainObject`, `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`, - * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, - * `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`, + * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`, + * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, + * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, + * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, + * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, + * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, * `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`, * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, - * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toLower`, - * `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, - * `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, - * `upperCase`, `upperFirst`, `value`, and `words` + * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`, + * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`, + * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, + * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` * * @name _ * @constructor @@ -136,5 +140,6 @@ function lodash(value) { // Ensure wrappers are instances of `baseLodash`. lodash.prototype = baseLodash.prototype; +lodash.prototype.constructor = lodash; module.exports = lodash; diff --git a/tools/eslint/node_modules/lodash/wrapperReverse.js b/tools/eslint/node_modules/lodash/wrapperReverse.js index 51d44b9ba8824d..e93112a21acea3 100644 --- a/tools/eslint/node_modules/lodash/wrapperReverse.js +++ b/tools/eslint/node_modules/lodash/wrapperReverse.js @@ -10,6 +10,7 @@ var LazyWrapper = require('./_LazyWrapper'), * * @name reverse * @memberOf _ + * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example @@ -30,7 +31,11 @@ function wrapperReverse() { wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); - wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined }); + wrapped.__actions__.push({ + 'func': thru, + 'args': [reverse], + 'thisArg': undefined + }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); diff --git a/tools/eslint/node_modules/lodash/wrapperValue.js b/tools/eslint/node_modules/lodash/wrapperValue.js index e04329a0395414..f56c2dadedbf29 100644 --- a/tools/eslint/node_modules/lodash/wrapperValue.js +++ b/tools/eslint/node_modules/lodash/wrapperValue.js @@ -1,10 +1,11 @@ var baseWrapperValue = require('./_baseWrapperValue'); /** - * Executes the chained sequence to extract the unwrapped value. + * Executes the chain sequence to resolve the unwrapped value. * * @name value * @memberOf _ + * @since 0.1.0 * @alias toJSON, valueOf * @category Seq * @returns {*} Returns the resolved unwrapped value. diff --git a/tools/eslint/node_modules/lodash/xor.js b/tools/eslint/node_modules/lodash/xor.js index e92eee2e07ad46..7ec0c295afec21 100644 --- a/tools/eslint/node_modules/lodash/xor.js +++ b/tools/eslint/node_modules/lodash/xor.js @@ -4,11 +4,14 @@ var arrayFilter = require('./_arrayFilter'), rest = require('./rest'); /** - * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the given arrays. + * Creates an array of unique values that is the + * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the given arrays. The order of result values is determined by the order + * they occur in the arrays. * * @static * @memberOf _ + * @since 2.4.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of values. diff --git a/tools/eslint/node_modules/lodash/xorBy.js b/tools/eslint/node_modules/lodash/xorBy.js index ec905845bcba65..efb977d2127efd 100644 --- a/tools/eslint/node_modules/lodash/xorBy.js +++ b/tools/eslint/node_modules/lodash/xorBy.js @@ -7,14 +7,17 @@ var arrayFilter = require('./_arrayFilter'), /** * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). + * invoked for each element of each `arrays` to generate the criterion by + * which by which they're compared. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. - * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @param {Array|Function|Object|string} [iteratee=_.identity] + * The iteratee invoked per element. * @returns {Array} Returns the new array of values. * @example * diff --git a/tools/eslint/node_modules/lodash/xorWith.js b/tools/eslint/node_modules/lodash/xorWith.js index f35bc7abde5fea..d1335b837a2356 100644 --- a/tools/eslint/node_modules/lodash/xorWith.js +++ b/tools/eslint/node_modules/lodash/xorWith.js @@ -11,6 +11,7 @@ var arrayFilter = require('./_arrayFilter'), * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. diff --git a/tools/eslint/node_modules/lodash/zip.js b/tools/eslint/node_modules/lodash/zip.js index 2300a2bfd03fb0..e1cbbbbc518b27 100644 --- a/tools/eslint/node_modules/lodash/zip.js +++ b/tools/eslint/node_modules/lodash/zip.js @@ -2,12 +2,13 @@ var rest = require('./rest'), unzip = require('./unzip'); /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second elements - * of the given arrays, and so on. + * Creates an array of grouped elements, the first of which contains the + * first elements of the given arrays, the second of which contains the + * second elements of the given arrays, and so on. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @returns {Array} Returns the new array of grouped elements. diff --git a/tools/eslint/node_modules/lodash/zipObject.js b/tools/eslint/node_modules/lodash/zipObject.js index 11c160ff69fc7d..23fdf1417d1d52 100644 --- a/tools/eslint/node_modules/lodash/zipObject.js +++ b/tools/eslint/node_modules/lodash/zipObject.js @@ -3,12 +3,13 @@ var assignValue = require('./_assignValue'), /** * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property names and one of corresponding values. + * one of property identifiers and one of corresponding values. * * @static * @memberOf _ + * @since 0.4.0 * @category Array - * @param {Array} [props=[]] The property names. + * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example diff --git a/tools/eslint/node_modules/lodash/zipObjectDeep.js b/tools/eslint/node_modules/lodash/zipObjectDeep.js index 09eb541c53021c..7c858f844f4910 100644 --- a/tools/eslint/node_modules/lodash/zipObjectDeep.js +++ b/tools/eslint/node_modules/lodash/zipObjectDeep.js @@ -6,8 +6,9 @@ var baseSet = require('./_baseSet'), * * @static * @memberOf _ + * @since 4.1.0 * @category Array - * @param {Array} [props=[]] The property names. + * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example diff --git a/tools/eslint/node_modules/lodash/zipWith.js b/tools/eslint/node_modules/lodash/zipWith.js index d1d4bf3e55b40d..d01b6388c5b906 100644 --- a/tools/eslint/node_modules/lodash/zipWith.js +++ b/tools/eslint/node_modules/lodash/zipWith.js @@ -8,6 +8,7 @@ var rest = require('./rest'), * * @static * @memberOf _ + * @since 3.8.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @param {Function} [iteratee=_.identity] The function to combine grouped values. diff --git a/tools/eslint/node_modules/minimatch/package.json b/tools/eslint/node_modules/minimatch/package.json index ce3be5e2602daa..3e4dee3e5de202 100644 --- a/tools/eslint/node_modules/minimatch/package.json +++ b/tools/eslint/node_modules/minimatch/package.json @@ -2,14 +2,14 @@ "_args": [ [ "minimatch@2 || 3", - "/Users/trott/test/node_modules/eslint/node_modules/glob" + "/Users/silverwind/git/node/tools/package/package/node_modules/globby/node_modules/glob" ] ], "_from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0", "_id": "minimatch@3.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/minimatch", + "_location": "/minimatch", "_nodeVersion": "4.0.0", "_npmUser": { "email": "isaacs@npmjs.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/glob", - "/eslint/rimraf/glob" + "/glob", + "/globby/glob" ], "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz", "_shasum": "5236157a51e4f004c177fb3c527ff7dd78f0ef83", "_shrinkwrap": null, "_spec": "minimatch@2 || 3", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/glob", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/globby/node_modules/glob", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -53,7 +53,7 @@ "directories": {}, "dist": { "shasum": "5236157a51e4f004c177fb3c527ff7dd78f0ef83", - "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz" + "tarball": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz" }, "engines": { "node": "*" @@ -67,8 +67,8 @@ "main": "minimatch.js", "maintainers": [ { - "email": "i@izs.me", - "name": "isaacs" + "name": "isaacs", + "email": "i@izs.me" } ], "name": "minimatch", diff --git a/tools/eslint/node_modules/minimist/.travis.yml b/tools/eslint/node_modules/minimist/.travis.yml deleted file mode 100644 index cc4dba29d959a2..00000000000000 --- a/tools/eslint/node_modules/minimist/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/tools/eslint/node_modules/minimist/example/parse.js b/tools/eslint/node_modules/minimist/example/parse.js deleted file mode 100644 index abff3e8ee8f5ef..00000000000000 --- a/tools/eslint/node_modules/minimist/example/parse.js +++ /dev/null @@ -1,2 +0,0 @@ -var argv = require('../')(process.argv.slice(2)); -console.dir(argv); diff --git a/tools/eslint/node_modules/minimist/package.json b/tools/eslint/node_modules/minimist/package.json index ff82eed7c13b9a..d60f3487d516f6 100644 --- a/tools/eslint/node_modules/minimist/package.json +++ b/tools/eslint/node_modules/minimist/package.json @@ -2,14 +2,14 @@ "_args": [ [ "minimist@0.0.8", - "/Users/trott/test/node_modules/eslint/node_modules/mkdirp" + "/Users/silverwind/git/node/tools/package/package/node_modules/mkdirp" ] ], "_from": "minimist@0.0.8", "_id": "minimist@0.0.8", "_inCache": true, "_installable": true, - "_location": "/eslint/minimist", + "_location": "/minimist", "_npmUser": { "email": "mail@substack.net", "name": "substack" @@ -25,13 +25,13 @@ "type": "version" }, "_requiredBy": [ - "/eslint/mkdirp" + "/mkdirp" ], "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d", "_shrinkwrap": null, "_spec": "minimist@0.0.8", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/mkdirp", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/mkdirp", "author": { "email": "mail@substack.net", "name": "James Halliday", @@ -49,21 +49,21 @@ "directories": {}, "dist": { "shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d", - "tarball": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" + "tarball": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" }, "homepage": "https://github.com/substack/minimist", "keywords": [ "argv", "getopt", - "parser", - "optimist" + "optimist", + "parser" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" } ], "name": "minimist", @@ -78,14 +78,14 @@ }, "testling": { "browsers": [ - "ie/6..latest", - "ff/5", - "firefox/latest", "chrome/10", "chrome/latest", + "ff/5", + "firefox/latest", + "ie/6..latest", + "opera/12", "safari/5.1", - "safari/latest", - "opera/12" + "safari/latest" ], "files": "test/*.js" }, diff --git a/tools/eslint/node_modules/minimist/test/dash.js b/tools/eslint/node_modules/minimist/test/dash.js deleted file mode 100644 index 8b034b99a9eace..00000000000000 --- a/tools/eslint/node_modules/minimist/test/dash.js +++ /dev/null @@ -1,24 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('-', function (t) { - t.plan(5); - t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); - t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); - t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); - t.deepEqual( - parse([ '-b', '-' ], { boolean: 'b' }), - { b: true, _: [ '-' ] } - ); - t.deepEqual( - parse([ '-s', '-' ], { string: 's' }), - { s: '-', _: [] } - ); -}); - -test('-a -- b', function (t) { - t.plan(3); - t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); -}); diff --git a/tools/eslint/node_modules/minimist/test/default_bool.js b/tools/eslint/node_modules/minimist/test/default_bool.js deleted file mode 100644 index f0041ee40cd05f..00000000000000 --- a/tools/eslint/node_modules/minimist/test/default_bool.js +++ /dev/null @@ -1,20 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('boolean default true', function (t) { - var argv = parse([], { - boolean: 'sometrue', - default: { sometrue: true } - }); - t.equal(argv.sometrue, true); - t.end(); -}); - -test('boolean default false', function (t) { - var argv = parse([], { - boolean: 'somefalse', - default: { somefalse: false } - }); - t.equal(argv.somefalse, false); - t.end(); -}); diff --git a/tools/eslint/node_modules/minimist/test/dotted.js b/tools/eslint/node_modules/minimist/test/dotted.js deleted file mode 100644 index ef0ae349bf3bf5..00000000000000 --- a/tools/eslint/node_modules/minimist/test/dotted.js +++ /dev/null @@ -1,16 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('dotted alias', function (t) { - var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 22); - t.equal(argv.aa.bb, 22); - t.end(); -}); - -test('dotted default', function (t) { - var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 11); - t.equal(argv.aa.bb, 11); - t.end(); -}); diff --git a/tools/eslint/node_modules/minimist/test/long.js b/tools/eslint/node_modules/minimist/test/long.js deleted file mode 100644 index 5d3a1e09d3b64c..00000000000000 --- a/tools/eslint/node_modules/minimist/test/long.js +++ /dev/null @@ -1,31 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('long opts', function (t) { - t.deepEqual( - parse([ '--bool' ]), - { bool : true, _ : [] }, - 'long boolean' - ); - t.deepEqual( - parse([ '--pow', 'xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture sp' - ); - t.deepEqual( - parse([ '--pow=xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture eq' - ); - t.deepEqual( - parse([ '--host', 'localhost', '--port', '555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures sp' - ); - t.deepEqual( - parse([ '--host=localhost', '--port=555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures eq' - ); - t.end(); -}); diff --git a/tools/eslint/node_modules/minimist/test/parse.js b/tools/eslint/node_modules/minimist/test/parse.js deleted file mode 100644 index 47e92237fb0bbc..00000000000000 --- a/tools/eslint/node_modules/minimist/test/parse.js +++ /dev/null @@ -1,318 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse args', function (t) { - t.deepEqual( - parse([ '--no-moo' ]), - { moo : false, _ : [] }, - 'no' - ); - t.deepEqual( - parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), - { v : ['a','b','c'], _ : [] }, - 'multi' - ); - t.end(); -}); - -test('comprehensive', function (t) { - t.deepEqual( - parse([ - '--name=meowmers', 'bare', '-cats', 'woo', - '-h', 'awesome', '--multi=quux', - '--key', 'value', - '-b', '--bool', '--no-meep', '--multi=baz', - '--', '--not-a-flag', 'eek' - ]), - { - c : true, - a : true, - t : true, - s : 'woo', - h : 'awesome', - b : true, - bool : true, - key : 'value', - multi : [ 'quux', 'baz' ], - meep : false, - name : 'meowmers', - _ : [ 'bare', '--not-a-flag', 'eek' ] - } - ); - t.end(); -}); - -test('nums', function (t) { - var argv = parse([ - '-x', '1234', - '-y', '5.67', - '-z', '1e7', - '-w', '10f', - '--hex', '0xdeadbeef', - '789' - ]); - t.deepEqual(argv, { - x : 1234, - y : 5.67, - z : 1e7, - w : '10f', - hex : 0xdeadbeef, - _ : [ 789 ] - }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv.y, 'number'); - t.deepEqual(typeof argv.z, 'number'); - t.deepEqual(typeof argv.w, 'string'); - t.deepEqual(typeof argv.hex, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); - -test('flag boolean', function (t) { - var argv = parse([ '-t', 'moo' ], { boolean: 't' }); - t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('flag boolean value', function (t) { - var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { - boolean: [ 't', 'verbose' ], - default: { verbose: true } - }); - - t.deepEqual(argv, { - verbose: false, - t: true, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('flag boolean default false', function (t) { - var argv = parse(['moo'], { - boolean: ['t', 'verbose'], - default: { verbose: false, t: false } - }); - - t.deepEqual(argv, { - verbose: false, - t: false, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); - -}); - -test('boolean groups', function (t) { - var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { - boolean: ['x','y','z'] - }); - - t.deepEqual(argv, { - x : true, - y : false, - z : true, - _ : [ 'one', 'two', 'three' ] - }); - - t.deepEqual(typeof argv.x, 'boolean'); - t.deepEqual(typeof argv.y, 'boolean'); - t.deepEqual(typeof argv.z, 'boolean'); - t.end(); -}); - -test('newlines in params' , function (t) { - var args = parse([ '-s', "X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - - // reproduce in bash: - // VALUE="new - // line" - // node program.js --s="$VALUE" - args = parse([ "--s=X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - t.end(); -}); - -test('strings' , function (t) { - var s = parse([ '-s', '0001234' ], { string: 's' }).s; - t.equal(s, '0001234'); - t.equal(typeof s, 'string'); - - var x = parse([ '-x', '56' ], { string: 'x' }).x; - t.equal(x, '56'); - t.equal(typeof x, 'string'); - t.end(); -}); - -test('stringArgs', function (t) { - var s = parse([ ' ', ' ' ], { string: '_' })._; - t.same(s.length, 2); - t.same(typeof s[0], 'string'); - t.same(s[0], ' '); - t.same(typeof s[1], 'string'); - t.same(s[1], ' '); - t.end(); -}); - -test('empty strings', function(t) { - var s = parse([ '-s' ], { string: 's' }).s; - t.equal(s, ''); - t.equal(typeof s, 'string'); - - var str = parse([ '--str' ], { string: 'str' }).str; - t.equal(str, ''); - t.equal(typeof str, 'string'); - - var letters = parse([ '-art' ], { - string: [ 'a', 't' ] - }); - - t.equal(letters.a, ''); - t.equal(letters.r, true); - t.equal(letters.t, ''); - - t.end(); -}); - - -test('slashBreak', function (t) { - t.same( - parse([ '-I/foo/bar/baz' ]), - { I : '/foo/bar/baz', _ : [] } - ); - t.same( - parse([ '-xyz/foo/bar/baz' ]), - { x : true, y : true, z : '/foo/bar/baz', _ : [] } - ); - t.end(); -}); - -test('alias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: 'zoom' } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.f, 11); - t.end(); -}); - -test('multiAlias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: [ 'zm', 'zoom' ] } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.z, argv.zm); - t.equal(argv.f, 11); - t.end(); -}); - -test('nested dotted objects', function (t) { - var argv = parse([ - '--foo.bar', '3', '--foo.baz', '4', - '--foo.quux.quibble', '5', '--foo.quux.o_O', - '--beep.boop' - ]); - - t.same(argv.foo, { - bar : 3, - baz : 4, - quux : { - quibble : 5, - o_O : true - } - }); - t.same(argv.beep, { boop : true }); - t.end(); -}); - -test('boolean and alias with chainable api', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = parse(aliased, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var propertyArgv = parse(regular, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - alias: { 'h': 'herp' }, - boolean: 'herp' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias using explicit true', function (t) { - var aliased = [ '-h', 'true' ]; - var regular = [ '--herp', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -// regression, see https://github.com/substack/node-optimist/issues/71 -test('boolean and --x=true', function(t) { - var parsed = parse(['--boool', '--other=true'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'true'); - - parsed = parse(['--boool', '--other=false'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'false'); - t.end(); -}); diff --git a/tools/eslint/node_modules/minimist/test/parse_modified.js b/tools/eslint/node_modules/minimist/test/parse_modified.js deleted file mode 100644 index 7c4c2abe397797..00000000000000 --- a/tools/eslint/node_modules/minimist/test/parse_modified.js +++ /dev/null @@ -1,9 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse with modifier functions' , function (t) { - t.plan(1); - - var argv = parse([ '-b', '123' ], { boolean: 'b' }); - t.deepEqual(argv, { b: true, _: ['123'] }); -}); diff --git a/tools/eslint/node_modules/minimist/test/short.js b/tools/eslint/node_modules/minimist/test/short.js deleted file mode 100644 index ac18880f1eb50c..00000000000000 --- a/tools/eslint/node_modules/minimist/test/short.js +++ /dev/null @@ -1,67 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('numeric short args', function (t) { - t.plan(2); - t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); - t.deepEqual( - parse([ '-123', '456' ]), - { 1: true, 2: true, 3: 456, _: [] } - ); -}); - -test('short', function (t) { - t.deepEqual( - parse([ '-b' ]), - { b : true, _ : [] }, - 'short boolean' - ); - t.deepEqual( - parse([ 'foo', 'bar', 'baz' ]), - { _ : [ 'foo', 'bar', 'baz' ] }, - 'bare' - ); - t.deepEqual( - parse([ '-cats' ]), - { c : true, a : true, t : true, s : true, _ : [] }, - 'group' - ); - t.deepEqual( - parse([ '-cats', 'meow' ]), - { c : true, a : true, t : true, s : 'meow', _ : [] }, - 'short group next' - ); - t.deepEqual( - parse([ '-h', 'localhost' ]), - { h : 'localhost', _ : [] }, - 'short capture' - ); - t.deepEqual( - parse([ '-h', 'localhost', '-p', '555' ]), - { h : 'localhost', p : 555, _ : [] }, - 'short captures' - ); - t.end(); -}); - -test('mixed short bool and capture', function (t) { - t.same( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); - -test('short and long', function (t) { - t.deepEqual( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); diff --git a/tools/eslint/node_modules/minimist/test/whitespace.js b/tools/eslint/node_modules/minimist/test/whitespace.js deleted file mode 100644 index 8a52a58cecfd7a..00000000000000 --- a/tools/eslint/node_modules/minimist/test/whitespace.js +++ /dev/null @@ -1,8 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('whitespace should be whitespace' , function (t) { - t.plan(1); - var x = parse([ '-x', '\t' ]).x; - t.equal(x, '\t'); -}); diff --git a/tools/eslint/node_modules/mkdirp/.travis.yml b/tools/eslint/node_modules/mkdirp/.travis.yml deleted file mode 100644 index 74c57bf15e2391..00000000000000 --- a/tools/eslint/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.12" - - "iojs" -before_install: - - npm install -g npm@~1.4.6 diff --git a/tools/eslint/node_modules/mkdirp/examples/pow.js b/tools/eslint/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e6924212e6a244..00000000000000 --- a/tools/eslint/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/tools/eslint/node_modules/mkdirp/package.json b/tools/eslint/node_modules/mkdirp/package.json index 4adbeb98dd6054..15795ba7b304e2 100644 --- a/tools/eslint/node_modules/mkdirp/package.json +++ b/tools/eslint/node_modules/mkdirp/package.json @@ -2,14 +2,14 @@ "_args": [ [ "mkdirp@^0.5.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "mkdirp@>=0.5.0 <0.6.0", "_id": "mkdirp@0.5.1", "_inCache": true, "_installable": true, - "_location": "/eslint/mkdirp", + "_location": "/mkdirp", "_nodeVersion": "2.0.0", "_npmUser": { "email": "substack@gmail.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint", - "/eslint/write" + "/", + "/write" ], "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903", "_shrinkwrap": null, "_spec": "mkdirp@^0.5.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "mail@substack.net", "name": "James Halliday", @@ -56,20 +56,20 @@ "directories": {}, "dist": { "shasum": "30057438eac6cf7f8c4767f38648d6697d75c903", - "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" + "tarball": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" }, "gitHead": "d4eff0f06093aed4f387e88e9fc301cb76beedc7", "homepage": "https://github.com/substack/node-mkdirp#readme", "keywords": [ - "mkdir", - "directory" + "directory", + "mkdir" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" } ], "name": "mkdirp", diff --git a/tools/eslint/node_modules/mkdirp/test/chmod.js b/tools/eslint/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 6a404b932f941f..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,41 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); -var _0744 = parseInt('0744', 8); - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -test('chmod-pre', function (t) { - var mode = _0744 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & _0777, mode, 'should be 0744'); - t.end(); - }); - }); -}); - -test('chmod', function (t) { - var mode = _0755 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.end(); - }); - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/clobber.js b/tools/eslint/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 2433b9ad548557..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,38 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; -var _0755 = parseInt('0755', 8); - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -// a file in the way -var itw = ps.slice(0, 3).join('/'); - - -test('clobber-pre', function (t) { - console.error("about to write to "+itw) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); - - fs.stat(itw, function (er, stat) { - t.ifError(er) - t.ok(stat && stat.isFile(), 'should be file') - t.end() - }) -}) - -test('clobber', function (t) { - t.plan(2); - mkdirp(file, _0755, function (err) { - t.ok(err); - t.equal(err.code, 'ENOTDIR'); - t.end(); - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/mkdirp.js b/tools/eslint/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index 1983e70941fb0e..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('woo', function (t) { - t.plan(5); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, _0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }) - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/opts_fs.js b/tools/eslint/node_modules/mkdirp/test/opts_fs.js deleted file mode 100644 index 7da51ec25a3f32..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/opts_fs.js +++ /dev/null @@ -1,29 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var test = require('tap').test; -var mockfs = require('mock-fs'); -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('opts.fs', function (t) { - t.plan(5); - - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/beep/boop/' + [x,y,z].join('/'); - var xfs = mockfs.fs(); - - mkdirp(file, { fs: xfs, mode: _0755 }, function (err) { - t.ifError(err); - xfs.exists(file, function (ex) { - t.ok(ex, 'created file'); - xfs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/opts_fs_sync.js b/tools/eslint/node_modules/mkdirp/test/opts_fs_sync.js deleted file mode 100644 index e80e9be84b5d80..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/opts_fs_sync.js +++ /dev/null @@ -1,27 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var test = require('tap').test; -var mockfs = require('mock-fs'); -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('opts.fs sync', function (t) { - t.plan(4); - - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/beep/boop/' + [x,y,z].join('/'); - var xfs = mockfs.fs(); - - mkdirp.sync(file, { fs: xfs, mode: _0755 }); - xfs.exists(file, function (ex) { - t.ok(ex, 'created file'); - xfs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/perm.js b/tools/eslint/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 652586ed1d9fb9..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('async perm', function (t) { - t.plan(5); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - - mkdirp(file, _0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }) - }); -}); - -test('async root perm', function (t) { - mkdirp('/tmp', _0755, function (err) { - if (err) t.fail(err); - t.end(); - }); - t.end(); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/perm_sync.js b/tools/eslint/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index f82842bfc1c3d5..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,36 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('sync perm', function (t) { - t.plan(4); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - - mkdirp.sync(file, _0755); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); -}); - -test('sync root perm', function (t) { - t.plan(3); - - var file = '/tmp'; - mkdirp.sync(file, _0755); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/race.js b/tools/eslint/node_modules/mkdirp/test/race.js deleted file mode 100644 index cba90799d9ceff..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,37 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('race', function (t) { - t.plan(10); - var ps = [ '', 'tmp' ]; - - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); - } - var file = ps.join('/'); - - var res = 2; - mk(file); - - mk(file); - - function mk (file, cb) { - mkdirp(file, _0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }) - }); - } -}); diff --git a/tools/eslint/node_modules/mkdirp/test/rel.js b/tools/eslint/node_modules/mkdirp/test/rel.js deleted file mode 100644 index 90b13566824bb7..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('rel', function (t) { - t.plan(5); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var cwd = process.cwd(); - process.chdir('/tmp'); - - var file = [x,y,z].join('/'); - - mkdirp(file, _0755, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - process.chdir(cwd); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }) - }) - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/return.js b/tools/eslint/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e5613e3f9..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, '/tmp/' + x); - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, null); - }); - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/return_sync.js b/tools/eslint/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d3558d6f0..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - // Note that this will throw on failure, which will fail the test. - var made = mkdirp.sync(file); - t.equal(made, '/tmp/' + x); - - // making the same file again should have no effect. - made = mkdirp.sync(file); - t.equal(made, null); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/root.js b/tools/eslint/node_modules/mkdirp/test/root.js deleted file mode 100644 index 9e7d079d9fc757..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/root.js +++ /dev/null @@ -1,19 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; -var _0755 = parseInt('0755', 8); - -test('root', function (t) { - // '/' on unix, 'c:/' on windows. - var file = path.resolve('/'); - - mkdirp(file, _0755, function (err) { - if (err) throw err - fs.stat(file, function (er, stat) { - if (er) throw er - t.ok(stat.isDirectory(), 'target is a directory'); - t.end(); - }) - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/sync.js b/tools/eslint/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 8c8dc938c8b4a8..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('sync', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, _0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0755); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/umask.js b/tools/eslint/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 09bcd2d8864572..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('implicit mode from umask', function (t) { - t.plan(5); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, function (err) { - t.ifError(err); - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, _0777 & (~process.umask())); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }) - }); -}); diff --git a/tools/eslint/node_modules/mkdirp/test/umask_sync.js b/tools/eslint/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index 11a76147496a52..00000000000000 --- a/tools/eslint/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var exists = fs.exists || path.exists; -var test = require('tap').test; -var _0777 = parseInt('0777', 8); -var _0755 = parseInt('0755', 8); - -test('umask sync modes', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file); - } catch (err) { - t.fail(err); - return t.end(); - } - - exists(file, function (ex) { - t.ok(ex, 'file created'); - fs.stat(file, function (err, stat) { - t.ifError(err); - t.equal(stat.mode & _0777, (_0777 & (~process.umask()))); - t.ok(stat.isDirectory(), 'target not a directory'); - }); - }); -}); diff --git a/tools/eslint/node_modules/ms/.npmignore b/tools/eslint/node_modules/ms/.npmignore deleted file mode 100644 index d1aa0ce42e1360..00000000000000 --- a/tools/eslint/node_modules/ms/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -test -History.md -Makefile -component.json diff --git a/tools/eslint/node_modules/ms/History.md b/tools/eslint/node_modules/ms/History.md deleted file mode 100644 index 32fdfc17623565..00000000000000 --- a/tools/eslint/node_modules/ms/History.md +++ /dev/null @@ -1,66 +0,0 @@ - -0.7.1 / 2015-04-20 -================== - - * prevent extraordinary long inputs (@evilpacket) - * Fixed broken readme link - -0.7.0 / 2014-11-24 -================== - - * add time abbreviations, updated tests and readme for the new units - * fix example in the readme. - * add LICENSE file - -0.6.2 / 2013-12-05 -================== - - * Adding repository section to package.json to suppress warning from NPM. - -0.6.1 / 2013-05-10 -================== - - * fix singularization [visionmedia] - -0.6.0 / 2013-03-15 -================== - - * fix minutes - -0.5.1 / 2013-02-24 -================== - - * add component namespace - -0.5.0 / 2012-11-09 -================== - - * add short formatting as default and .long option - * add .license property to component.json - * add version to component.json - -0.4.0 / 2012-10-22 -================== - - * add rounding to fix crazy decimals - -0.3.0 / 2012-09-07 -================== - - * fix `ms()` [visionmedia] - -0.2.0 / 2012-09-03 -================== - - * add component.json [visionmedia] - * add days support [visionmedia] - * add hours support [visionmedia] - * add minutes support [visionmedia] - * add seconds support [visionmedia] - * add ms string support [visionmedia] - * refactor tests to facilitate ms(number) [visionmedia] - -0.1.0 / 2012-03-07 -================== - - * Initial release diff --git a/tools/eslint/node_modules/ms/package.json b/tools/eslint/node_modules/ms/package.json index d6d6925988ef40..bbe7f3a4214e7c 100644 --- a/tools/eslint/node_modules/ms/package.json +++ b/tools/eslint/node_modules/ms/package.json @@ -2,14 +2,14 @@ "_args": [ [ "ms@0.7.1", - "/Users/trott/test/node_modules/eslint/node_modules/debug" + "/Users/silverwind/git/node/tools/package/package/node_modules/debug" ] ], "_from": "ms@0.7.1", "_id": "ms@0.7.1", "_inCache": true, "_installable": true, - "_location": "/eslint/ms", + "_location": "/ms", "_nodeVersion": "0.12.2", "_npmUser": { "email": "rauchg@gmail.com", @@ -26,13 +26,13 @@ "type": "version" }, "_requiredBy": [ - "/eslint/debug" + "/debug" ], "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", "_shrinkwrap": null, "_spec": "ms@0.7.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/debug", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/debug", "bugs": { "url": "https://github.com/guille/ms.js/issues" }, @@ -51,15 +51,15 @@ "directories": {}, "dist": { "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + "tarball": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz" }, "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", "homepage": "https://github.com/guille/ms.js", "main": "./index", "maintainers": [ { - "email": "rauchg@gmail.com", - "name": "rauchg" + "name": "rauchg", + "email": "rauchg@gmail.com" } ], "name": "ms", diff --git a/tools/eslint/node_modules/mute-stream/package.json b/tools/eslint/node_modules/mute-stream/package.json index fcacbc893863e7..21873b85d563c2 100644 --- a/tools/eslint/node_modules/mute-stream/package.json +++ b/tools/eslint/node_modules/mute-stream/package.json @@ -2,14 +2,14 @@ "_args": [ [ "mute-stream@0.0.5", - "/Users/trott/test/node_modules/eslint/node_modules/readline2" + "/Users/silverwind/git/node/tools/package/package/node_modules/readline2" ] ], "_from": "mute-stream@0.0.5", "_id": "mute-stream@0.0.5", "_inCache": true, "_installable": true, - "_location": "/eslint/mute-stream", + "_location": "/mute-stream", "_nodeVersion": "2.0.1", "_npmUser": { "email": "isaacs@npmjs.com", @@ -26,13 +26,13 @@ "type": "version" }, "_requiredBy": [ - "/eslint/readline2" + "/readline2" ], "_resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", "_shasum": "8fbfabb0a98a253d3184331f9e8deb7372fac6c0", "_shrinkwrap": null, "_spec": "mute-stream@0.0.5", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/readline2", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/readline2", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -57,15 +57,15 @@ "homepage": "https://github.com/isaacs/mute-stream#readme", "keywords": [ "mute", - "stream", - "pipe" + "pipe", + "stream" ], "license": "ISC", "main": "mute.js", "maintainers": [ { - "email": "i@izs.me", - "name": "isaacs" + "name": "isaacs", + "email": "i@izs.me" } ], "name": "mute-stream", diff --git a/tools/eslint/node_modules/mute-stream/test/basic.js b/tools/eslint/node_modules/mute-stream/test/basic.js deleted file mode 100644 index 41f9e10c385a2f..00000000000000 --- a/tools/eslint/node_modules/mute-stream/test/basic.js +++ /dev/null @@ -1,207 +0,0 @@ -var Stream = require('stream') -var tap = require('tap') -var MS = require('../mute.js') - -// some marker objects -var END = {} -var PAUSE = {} -var RESUME = {} - -function PassThrough () { - Stream.call(this) - this.readable = this.writable = true -} - -PassThrough.prototype = Object.create(Stream.prototype, { - constructor: { - value: PassThrough - }, - write: { - value: function (c) { - this.emit('data', c) - return true - } - }, - end: { - value: function (c) { - if (c) this.write(c) - this.emit('end') - } - }, - pause: { - value: function () { - this.emit('pause') - } - }, - resume: { - value: function () { - this.emit('resume') - } - } -}) - -tap.test('incoming', function (t) { - var ms = new MS - var str = new PassThrough - str.pipe(ms) - - var expect = ['foo', 'boo', END] - ms.on('data', function (c) { - t.equal(c, expect.shift()) - }) - ms.on('end', function () { - t.equal(END, expect.shift()) - t.end() - }) - str.write('foo') - ms.mute() - str.write('bar') - ms.unmute() - str.write('boo') - ms.mute() - str.write('blaz') - str.end('grelb') -}) - -tap.test('outgoing', function (t) { - var ms = new MS - var str = new PassThrough - ms.pipe(str) - - var expect = ['foo', 'boo', END] - str.on('data', function (c) { - t.equal(c, expect.shift()) - }) - str.on('end', function () { - t.equal(END, expect.shift()) - t.end() - }) - - ms.write('foo') - ms.mute() - ms.write('bar') - ms.unmute() - ms.write('boo') - ms.mute() - ms.write('blaz') - ms.end('grelb') -}) - -tap.test('isTTY', function (t) { - var str = new PassThrough - str.isTTY = true - str.columns=80 - str.rows=24 - - var ms = new MS - t.equal(ms.isTTY, false) - t.equal(ms.columns, undefined) - t.equal(ms.rows, undefined) - ms.pipe(str) - t.equal(ms.isTTY, true) - t.equal(ms.columns, 80) - t.equal(ms.rows, 24) - str.isTTY = false - t.equal(ms.isTTY, false) - t.equal(ms.columns, 80) - t.equal(ms.rows, 24) - str.isTTY = true - t.equal(ms.isTTY, true) - t.equal(ms.columns, 80) - t.equal(ms.rows, 24) - ms.isTTY = false - t.equal(ms.isTTY, false) - t.equal(ms.columns, 80) - t.equal(ms.rows, 24) - - ms = new MS - t.equal(ms.isTTY, false) - str.pipe(ms) - t.equal(ms.isTTY, true) - str.isTTY = false - t.equal(ms.isTTY, false) - str.isTTY = true - t.equal(ms.isTTY, true) - ms.isTTY = false - t.equal(ms.isTTY, false) - - t.end() -}) - -tap.test('pause/resume incoming', function (t) { - var str = new PassThrough - var ms = new MS - str.on('pause', function () { - t.equal(PAUSE, expect.shift()) - }) - str.on('resume', function () { - t.equal(RESUME, expect.shift()) - }) - var expect = [PAUSE, RESUME, PAUSE, RESUME] - str.pipe(ms) - ms.pause() - ms.resume() - ms.pause() - ms.resume() - t.equal(expect.length, 0, 'saw all events') - t.end() -}) - -tap.test('replace with *', function (t) { - var str = new PassThrough - var ms = new MS({replace: '*'}) - str.pipe(ms) - var expect = ['foo', '*****', 'bar', '***', 'baz', 'boo', '**', '****'] - - ms.on('data', function (c) { - t.equal(c, expect.shift()) - }) - - str.write('foo') - ms.mute() - str.write('12345') - ms.unmute() - str.write('bar') - ms.mute() - str.write('baz') - ms.unmute() - str.write('baz') - str.write('boo') - ms.mute() - str.write('xy') - str.write('xyzΩ') - - t.equal(expect.length, 0) - t.end() -}) - -tap.test('replace with ~YARG~', function (t) { - var str = new PassThrough - var ms = new MS({replace: '~YARG~'}) - str.pipe(ms) - var expect = ['foo', '~YARG~~YARG~~YARG~~YARG~~YARG~', 'bar', - '~YARG~~YARG~~YARG~', 'baz', 'boo', '~YARG~~YARG~', - '~YARG~~YARG~~YARG~~YARG~'] - - ms.on('data', function (c) { - t.equal(c, expect.shift()) - }) - - // also throw some unicode in there, just for good measure. - str.write('foo') - ms.mute() - str.write('ΩΩ') - ms.unmute() - str.write('bar') - ms.mute() - str.write('Ω') - ms.unmute() - str.write('baz') - str.write('boo') - ms.mute() - str.write('Ω') - str.write('ΩΩ') - - t.equal(expect.length, 0) - t.end() -}) diff --git a/tools/eslint/node_modules/number-is-nan/package.json b/tools/eslint/node_modules/number-is-nan/package.json index 3859d88f652473..536c70fc9c2391 100644 --- a/tools/eslint/node_modules/number-is-nan/package.json +++ b/tools/eslint/node_modules/number-is-nan/package.json @@ -2,14 +2,14 @@ "_args": [ [ "number-is-nan@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/code-point-at" + "/Users/silverwind/git/node/tools/package/package/node_modules/code-point-at" ] ], "_from": "number-is-nan@>=1.0.0 <2.0.0", "_id": "number-is-nan@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/number-is-nan", + "_location": "/number-is-nan", "_nodeVersion": "0.12.3", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/code-point-at", - "/eslint/is-fullwidth-code-point" + "/code-point-at", + "/is-fullwidth-code-point" ], "_resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.0.tgz", "_shasum": "c020f529c5282adfdd233d91d4b181c3d686dc4b", "_shrinkwrap": null, "_spec": "number-is-nan@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/code-point-at", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/code-point-at", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -61,23 +61,23 @@ "gitHead": "0f394b1bc33185c40304363b209e3f0588dbeeb3", "homepage": "https://github.com/sindresorhus/number-is-nan#readme", "keywords": [ - "es6", - "es2015", "ecmascript", + "es2015", + "es6", "harmony", - "ponyfill", - "polyfill", - "shim", - "number", "is", "nan", - "not" + "not", + "number", + "polyfill", + "ponyfill", + "shim" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "number-is-nan", diff --git a/tools/eslint/node_modules/object-assign/package.json b/tools/eslint/node_modules/object-assign/package.json index a1db7ffb298df6..8323c38b91d9ae 100644 --- a/tools/eslint/node_modules/object-assign/package.json +++ b/tools/eslint/node_modules/object-assign/package.json @@ -2,14 +2,14 @@ "_args": [ [ "object-assign@^4.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/file-entry-cache" + "/Users/silverwind/git/node/tools/package/package/node_modules/esrecurse" ] ], "_from": "object-assign@>=4.0.1 <5.0.0", "_id": "object-assign@4.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/object-assign", + "_location": "/object-assign", "_nodeVersion": "3.0.0", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,15 +26,16 @@ "type": "range" }, "_requiredBy": [ - "/eslint/del", - "/eslint/file-entry-cache", - "/eslint/globby" + "/del", + "/esrecurse", + "/file-entry-cache", + "/globby" ], "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.0.1.tgz", "_shasum": "99504456c3598b5cad4fc59c26e8a9bb107fe0bd", "_shrinkwrap": null, "_spec": "object-assign@^4.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/file-entry-cache", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/esrecurse", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -54,7 +55,7 @@ "directories": {}, "dist": { "shasum": "99504456c3598b5cad4fc59c26e8a9bb107fe0bd", - "tarball": "http://registry.npmjs.org/object-assign/-/object-assign-4.0.1.tgz" + "tarball": "https://registry.npmjs.org/object-assign/-/object-assign-4.0.1.tgz" }, "engines": { "node": ">=0.10.0" @@ -65,24 +66,24 @@ "gitHead": "b0c40d37cbc43e89ad3326a9bad4c6b3133ba6d3", "homepage": "https://github.com/sindresorhus/object-assign#readme", "keywords": [ - "object", "assign", - "extend", - "properties", - "es6", + "browser", "ecmascript", + "es6", + "extend", "harmony", + "object", + "polyfill", "ponyfill", "prollyfill", - "polyfill", - "shim", - "browser" + "properties", + "shim" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "object-assign", @@ -99,8 +100,8 @@ "version": "4.0.1", "xo": { "envs": [ - "node", - "mocha" + "mocha", + "node" ] } } diff --git a/tools/eslint/node_modules/once/package.json b/tools/eslint/node_modules/once/package.json index fa7c3b64082ee4..ceb6c170416fbb 100644 --- a/tools/eslint/node_modules/once/package.json +++ b/tools/eslint/node_modules/once/package.json @@ -2,14 +2,14 @@ "_args": [ [ "once@^1.3.0", - "/Users/trott/test/node_modules/eslint/node_modules/glob" + "/Users/silverwind/git/node/tools/package/package/node_modules/globby/node_modules/glob" ] ], "_from": "once@>=1.3.0 <2.0.0", "_id": "once@1.3.3", "_inCache": true, "_installable": true, - "_location": "/eslint/once", + "_location": "/once", "_nodeVersion": "4.0.0", "_npmUser": { "email": "i@izs.me", @@ -26,16 +26,16 @@ "type": "range" }, "_requiredBy": [ - "/eslint/glob", - "/eslint/inflight", - "/eslint/rimraf/glob", - "/eslint/run-async" + "/glob", + "/globby/glob", + "/inflight", + "/run-async" ], "_resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", "_shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20", "_shrinkwrap": null, "_spec": "once@^1.3.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/glob", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/globby/node_modules/glob", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -64,8 +64,8 @@ "gitHead": "2ad558657e17fafd24803217ba854762842e4178", "homepage": "https://github.com/isaacs/once#readme", "keywords": [ - "once", "function", + "once", "one", "single" ], @@ -73,8 +73,8 @@ "main": "once.js", "maintainers": [ { - "email": "i@izs.me", - "name": "isaacs" + "name": "isaacs", + "email": "i@izs.me" } ], "name": "once", diff --git a/tools/eslint/node_modules/onetime/package.json b/tools/eslint/node_modules/onetime/package.json index c2a8f953d97442..e059fd9269e9a4 100644 --- a/tools/eslint/node_modules/onetime/package.json +++ b/tools/eslint/node_modules/onetime/package.json @@ -2,14 +2,14 @@ "_args": [ [ "onetime@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/restore-cursor" + "/Users/silverwind/git/node/tools/package/package/node_modules/restore-cursor" ] ], "_from": "onetime@>=1.0.0 <2.0.0", "_id": "onetime@1.1.0", "_inCache": true, "_installable": true, - "_location": "/eslint/onetime", + "_location": "/onetime", "_nodeVersion": "4.2.1", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/restore-cursor" + "/restore-cursor" ], "_resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "_shasum": "a1f7838f8314c516f05ecefcbc4ccfe04b4ed789", "_shrinkwrap": null, "_spec": "onetime@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/restore-cursor", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/restore-cursor", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -61,18 +61,18 @@ "gitHead": "6fae2fb77b95b49719d1c270d8ba07d9515bdfe8", "homepage": "https://github.com/sindresorhus/onetime", "keywords": [ - "once", - "one", - "single", "call", "function", - "prevent" + "once", + "one", + "prevent", + "single" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "onetime", diff --git a/tools/eslint/node_modules/optionator/CHANGELOG.md b/tools/eslint/node_modules/optionator/CHANGELOG.md deleted file mode 100644 index 050df2a8f69705..00000000000000 --- a/tools/eslint/node_modules/optionator/CHANGELOG.md +++ /dev/null @@ -1,48 +0,0 @@ -# 0.8.1 -- update `fast-levenshtein` dependency - -# 0.8.0 -- update `levn` dependency - supplying a float value to an option with type `Int` now throws an error, instead of silently converting to an `Int` - -# 0.7.1 -- fix bug with use of `defaults` and `concatRepeatedArrays` or `mergeRepeatedObjects` - -# 0.7.0 -- added `concatrepeatedarrays` option: `oneValuePerFlag`, only allows one array value per flag -- added `typeAliases` option -- added `parseArgv` which takes an array and parses with the first two items sliced off -- changed enum help style -- bug fixes (#12) -- use of `concatRepeatedArrays` and `mergeRepeatedObjects` at the top level is deprecated, use it as either a per-option option, or set them in the `defaults` object to set them for all objects - -# 0.6.0 -- added `defaults` lib-option flag, allowing one to set default properties for all options -- added `concatRepeatedArrays` and `mergeRepeatedObjects` as option level properties, allowing you to turn this feature on for specific options only - -# 0.5.0 -- `Boolean` flags with `default: 'true'`, and no short aliases, will by default show the `--no` version in help - -# 0.4.0 -- add `mergeRepeatedObjects` setting - -# 0.3.0 -- add `concatRepeatedArrays` setting -- add `overrideRequired` option setting -- use just Levenshtein string compare algo rather than Levenshtein Damerau to due dependency license issue - -# 0.2.2 -- bug fixes - -# 0.2.1 -- improved interpolation -- added changelog - -# 0.2.0 -- add dependency checks to options - added `dependsOn` as an option property -- add interpolation for `prepend` and `append` text with new `generateHelp` option, `interpolate` - -# 0.1.1 -- update dependencies - -# 0.1.0 -- initial release diff --git a/tools/eslint/node_modules/optionator/package.json b/tools/eslint/node_modules/optionator/package.json index 702bae7628bc16..3bce321a1fd7e1 100644 --- a/tools/eslint/node_modules/optionator/package.json +++ b/tools/eslint/node_modules/optionator/package.json @@ -2,14 +2,14 @@ "_args": [ [ "optionator@^0.8.1", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "optionator@>=0.8.1 <0.9.0", "_id": "optionator@0.8.1", "_inCache": true, "_installable": true, - "_location": "/eslint/optionator", + "_location": "/optionator", "_nodeVersion": "5.3.0", "_npmUser": { "email": "z@georgezahariev.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.1.tgz", "_shasum": "e31b4932cdd5fb862a8b0d10bc63d3ee1ec7d78b", "_shrinkwrap": null, "_spec": "optionator@^0.8.1", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "z@georgezahariev.com", "name": "George Zahariev" @@ -63,24 +63,24 @@ "node": ">= 0.8.0" }, "files": [ - "lib", + "LICENSE", "README.md", - "LICENSE" + "lib" ], "gitHead": "88e905d2546df814bc20ff88af93eec8c47c216c", "homepage": "https://github.com/gkz/optionator", "keywords": [ - "options", + "cli", "flags", "option parsing", - "cli" + "options" ], "license": "MIT", "main": "./lib/", "maintainers": [ { - "email": "z@georgezahariev.com", - "name": "gkz" + "name": "gkz", + "email": "z@georgezahariev.com" } ], "name": "optionator", diff --git a/tools/eslint/node_modules/os-homedir/package.json b/tools/eslint/node_modules/os-homedir/package.json index f23c542f87ca65..356180ab568444 100644 --- a/tools/eslint/node_modules/os-homedir/package.json +++ b/tools/eslint/node_modules/os-homedir/package.json @@ -2,14 +2,14 @@ "_args": [ [ "os-homedir@^1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/user-home" + "/Users/silverwind/git/node/tools/package/package/node_modules/user-home" ] ], "_from": "os-homedir@>=1.0.0 <2.0.0", "_id": "os-homedir@1.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/os-homedir", + "_location": "/os-homedir", "_nodeVersion": "0.12.5", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/user-home" + "/user-home" ], "_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.1.tgz", "_shasum": "0d62bdf44b916fd3bbdcf2cab191948fb094f007", "_shrinkwrap": null, "_spec": "os-homedir@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/user-home", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/user-home", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -63,23 +63,23 @@ "keywords": [ "built-in", "core", - "ponyfill", - "polyfill", - "shim", - "os", - "homedir", - "home", "dir", "directory", "folder", - "user", - "path" + "home", + "homedir", + "os", + "path", + "polyfill", + "ponyfill", + "shim", + "user" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "os-homedir", diff --git a/tools/eslint/node_modules/path-is-absolute/package.json b/tools/eslint/node_modules/path-is-absolute/package.json index 64a8cad46a977a..cab12829266a51 100644 --- a/tools/eslint/node_modules/path-is-absolute/package.json +++ b/tools/eslint/node_modules/path-is-absolute/package.json @@ -2,14 +2,14 @@ "_args": [ [ "path-is-absolute@^1.0.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "path-is-absolute@>=1.0.0 <2.0.0", "_id": "path-is-absolute@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/path-is-absolute", + "_location": "/path-is-absolute", "_nodeVersion": "0.12.0", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,15 +26,15 @@ "type": "range" }, "_requiredBy": [ - "/eslint", - "/eslint/glob", - "/eslint/rimraf/glob" + "/", + "/glob", + "/globby/glob" ], "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz", "_shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", "_shrinkwrap": null, "_spec": "path-is-absolute@^1.0.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -60,29 +60,29 @@ "gitHead": "7a76a0c9f2263192beedbe0a820e4d0baee5b7a1", "homepage": "https://github.com/sindresorhus/path-is-absolute", "keywords": [ - "path", - "paths", - "file", - "dir", "absolute", - "isabsolute", - "is-absolute", "built-in", - "util", - "utils", + "check", "core", - "ponyfill", + "detect", + "dir", + "file", + "is", + "is-absolute", + "isabsolute", + "path", + "paths", "polyfill", + "ponyfill", "shim", - "is", - "detect", - "check" + "util", + "utils" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "path-is-absolute", diff --git a/tools/eslint/node_modules/path-is-inside/package.json b/tools/eslint/node_modules/path-is-inside/package.json index a573737bbc56d5..ffa120b55fb71c 100644 --- a/tools/eslint/node_modules/path-is-inside/package.json +++ b/tools/eslint/node_modules/path-is-inside/package.json @@ -2,14 +2,14 @@ "_args": [ [ "path-is-inside@^1.0.1", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "path-is-inside@>=1.0.1 <2.0.0", "_id": "path-is-inside@1.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/path-is-inside", + "_location": "/path-is-inside", "_npmUser": { "email": "domenic@domenicdenicola.com", "name": "domenic" @@ -25,14 +25,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint", - "/eslint/is-path-inside" + "/", + "/is-path-inside" ], "_resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.1.tgz", "_shasum": "98d8f1d030bf04bd7aeee4a1ba5485d40318fd89", "_shrinkwrap": null, "_spec": "path-is-inside@^1.0.1", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "domenic@domenicdenicola.com", "name": "Domenic Denicola", @@ -54,18 +54,18 @@ }, "homepage": "https://github.com/domenic/path-is-inside", "keywords": [ - "path", "directory", "folder", "inside", + "path", "relative" ], "license": "WTFPL", "main": "lib/path-is-inside.js", "maintainers": [ { - "email": "domenic@domenicdenicola.com", - "name": "domenic" + "name": "domenic", + "email": "domenic@domenicdenicola.com" } ], "name": "path-is-inside", diff --git a/tools/eslint/node_modules/pify/package.json b/tools/eslint/node_modules/pify/package.json index f6466e417525aa..7632bef1df1bd0 100644 --- a/tools/eslint/node_modules/pify/package.json +++ b/tools/eslint/node_modules/pify/package.json @@ -2,14 +2,14 @@ "_args": [ [ "pify@^2.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/del" + "/Users/silverwind/git/node/tools/package/package/node_modules/del" ] ], "_from": "pify@>=2.0.0 <3.0.0", "_id": "pify@2.3.0", "_inCache": true, "_installable": true, - "_location": "/eslint/pify", + "_location": "/pify", "_nodeVersion": "4.2.1", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/del", - "/eslint/globby" + "/del", + "/globby" ], "_resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "_shasum": "ed141a6ac043a849ea588498e7dca8b15330e90c", "_shrinkwrap": null, "_spec": "pify@^2.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/del", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/del", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -53,7 +53,7 @@ "directories": {}, "dist": { "shasum": "ed141a6ac043a849ea588498e7dca8b15330e90c", - "tarball": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz" + "tarball": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" }, "engines": { "node": ">=0.10.0" @@ -64,30 +64,30 @@ "gitHead": "2dd0d8b880e4ebcc5cc33ae126b02647418e4440", "homepage": "https://github.com/sindresorhus/pify", "keywords": [ - "promise", - "promises", - "promisify", - "denodify", - "denodeify", + "async", + "bind", "callback", "cb", + "convert", + "denodeify", + "denodify", + "es2015", "node", + "promise", + "promises", + "promisify", "then", "thenify", - "convert", + "to", "transform", "wrap", - "wrapper", - "bind", - "to", - "async", - "es2015" + "wrapper" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "pify", diff --git a/tools/eslint/node_modules/pinkie-promise/package.json b/tools/eslint/node_modules/pinkie-promise/package.json index bacc5fa1fd65e2..3cd9e76b701ebb 100644 --- a/tools/eslint/node_modules/pinkie-promise/package.json +++ b/tools/eslint/node_modules/pinkie-promise/package.json @@ -2,14 +2,14 @@ "_args": [ [ "pinkie-promise@^2.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/del" + "/Users/silverwind/git/node/tools/package/package/node_modules/del" ] ], "_from": "pinkie-promise@>=2.0.0 <3.0.0", "_id": "pinkie-promise@2.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/pinkie-promise", + "_location": "/pinkie-promise", "_nodeVersion": "4.2.0", "_npmUser": { "email": "floatdrop@gmail.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/del", - "/eslint/globby" + "/del", + "/globby" ], "_resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz", "_shasum": "4c83538de1f6e660c29e0a13446844f7a7e88259", "_shrinkwrap": null, "_spec": "pinkie-promise@^2.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/del", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/del", "author": { "email": "floatdrop@gmail.com", "name": "Vsevolod Strukchinsky", @@ -63,18 +63,18 @@ "gitHead": "f90fcae9838bcae7ae1ae4ebc9b29f11e5db4980", "homepage": "https://github.com/floatdrop/pinkie-promise", "keywords": [ - "promise", - "promises", "es2015", "es6", "polyfill", - "ponyfill" + "ponyfill", + "promise", + "promises" ], "license": "MIT", "maintainers": [ { - "email": "floatdrop@gmail.com", - "name": "floatdrop" + "name": "floatdrop", + "email": "floatdrop@gmail.com" } ], "name": "pinkie-promise", diff --git a/tools/eslint/node_modules/pinkie/package.json b/tools/eslint/node_modules/pinkie/package.json index d0c71a25f94d51..46e4697863967f 100644 --- a/tools/eslint/node_modules/pinkie/package.json +++ b/tools/eslint/node_modules/pinkie/package.json @@ -2,14 +2,14 @@ "_args": [ [ "pinkie@^2.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/pinkie-promise" + "/Users/silverwind/git/node/tools/package/package/node_modules/pinkie-promise" ] ], "_from": "pinkie@>=2.0.0 <3.0.0", "_id": "pinkie@2.0.4", "_inCache": true, "_installable": true, - "_location": "/eslint/pinkie", + "_location": "/pinkie", "_nodeVersion": "4.2.4", "_npmUser": { "email": "floatdrop@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/pinkie-promise" + "/pinkie-promise" ], "_resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", "_shasum": "72556b80cfa0d48a974e80e77248e80ed4f7f870", "_shrinkwrap": null, "_spec": "pinkie@^2.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/pinkie-promise", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/pinkie-promise", "author": { "email": "floatdrop@gmail.com", "name": "Vsevolod Strukchinsky", @@ -65,16 +65,16 @@ "gitHead": "8d4a92447a5c62bff9f89756caeb4c9c8770579b", "homepage": "https://github.com/floatdrop/pinkie", "keywords": [ - "promise", - "promises", "es2015", - "es6" + "es6", + "promise", + "promises" ], "license": "MIT", "maintainers": [ { - "email": "floatdrop@gmail.com", - "name": "floatdrop" + "name": "floatdrop", + "email": "floatdrop@gmail.com" } ], "name": "pinkie", diff --git a/tools/eslint/node_modules/pluralize/package.json b/tools/eslint/node_modules/pluralize/package.json index 7f7650f3712ae0..78369cfcd0cd1a 100644 --- a/tools/eslint/node_modules/pluralize/package.json +++ b/tools/eslint/node_modules/pluralize/package.json @@ -2,14 +2,14 @@ "_args": [ [ "pluralize@^1.2.1", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "pluralize@>=1.2.1 <2.0.0", "_id": "pluralize@1.2.1", "_inCache": true, "_installable": true, - "_location": "/eslint/pluralize", + "_location": "/pluralize", "_nodeVersion": "4.0.0", "_npmUser": { "email": "hello@blakeembrey.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", "_shasum": "d1a21483fd22bb41e58a12fa3421823140897c45", "_shrinkwrap": null, "_spec": "pluralize@^1.2.1", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "hello@blakeembrey.com", "name": "Blake Embrey", @@ -56,15 +56,15 @@ "tarball": "http://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz" }, "files": [ - "pluralize.js", - "LICENSE" + "LICENSE", + "pluralize.js" ], "gitHead": "a956c0dbca8782b588f8cd3229f16e8436d1ee73", "homepage": "https://github.com/blakeembrey/pluralize", "keywords": [ "plural", - "plurals", "pluralize", + "plurals", "singular", "singularize" ], @@ -72,8 +72,8 @@ "main": "pluralize.js", "maintainers": [ { - "email": "me@blakeembrey.com", - "name": "blakeembrey" + "name": "blakeembrey", + "email": "me@blakeembrey.com" } ], "name": "pluralize", diff --git a/tools/eslint/node_modules/prelude-ls/CHANGELOG.md b/tools/eslint/node_modules/prelude-ls/CHANGELOG.md deleted file mode 100644 index c2de12d5672c5c..00000000000000 --- a/tools/eslint/node_modules/prelude-ls/CHANGELOG.md +++ /dev/null @@ -1,99 +0,0 @@ -# 1.1.2 -- add `Func.memoize` -- fix `zip-all` and `zip-with-all` corner case (no input) -- build with LiveScript 1.4.0 - -# 1.1.1 -- curry `unique-by`, `minimum-by` - -# 1.1.0 -- added `List` functions: `maximum-by`, `minimum-by`, `unique-by` -- added `List` functions: `at`, `elem-index`, `elem-indices`, `find-index`, `find-indices` -- added `Str` functions: `capitalize`, `camelize`, `dasherize` -- added `Func` function: `over` - eg. ``same-length = (==) `over` (.length)`` -- exported `Str.repeat` through main `prelude` object -- fixed definition of `foldr` and `foldr1`, the new correct definition is backwards incompatible with the old, incorrect one -- fixed issue with `fix` -- improved code coverage - -# 1.0.3 -- build browser versions - -# 1.0.2 -- bug fix for `flatten` - slight change with bug fix, flattens arrays only, not array-like objects - -# 1.0.1 -- bug fixes for `drop-while` and `take-while` - -# 1.0.0 -* massive update - separated functions into separate modules -* functions do not accept multiple types anymore - use different versions in their respective modules in some cases (eg. `Obj.map`), or use `chars` or `values` in other cases to transform into a list -* objects are no longer transformed into functions, simply use `(obj.)` in LiveScript to do that -* browser version now using browserify - use `prelude = require('prelude-ls')` -* added `compact`, `split`, `flatten`, `difference`, `intersection`, `union`, `count-by`, `group-by`, `chars`, `unchars`, `apply` -* added `lists-to-obj` which takes a list of keys and list of values and zips them up into an object, and the converse `obj-to-lists` -* added `pairs-to-obj` which takes a list of pairs (2 element lists) and creates an object, and the converse `obj-to-pairs` -* removed `cons`, `append` - use the concat operator -* removed `compose` - use the compose operator -* removed `obj-to-func` - use partially applied access (eg. `(obj.)`) -* removed `length` - use `(.length)` -* `sort-by` renamed to `sort-with` -* added new `sort-by` -* removed `compare` - just use the new `sort-by` -* `break-it` renamed `break-list`, (`Str.break-str` for the string version) -* added `Str.repeat` which creates a new string by repeating the input n times -* `unfold` as alias to `unfoldr` is no longer used -* fixed up style and compiled with LiveScript 1.1.1 -* use Make instead of Slake -* greatly improved tests - -# 0.6.0 -* fixed various bugs -* added `fix`, a fixpoint (Y combinator) for anonymous recursive functions -* added `unfoldr` (alias `unfold`) -* calling `replicate` with a string now returns a list of strings -* removed `partial`, just use native partial application in LiveScript using the `_` placeholder, or currying -* added `sort`, `sortBy`, and `compare` - -# 0.5.0 -* removed `lookup` - use (.prop) -* removed `call` - use (.func arg1, arg2) -* removed `pluck` - use map (.prop), xs -* fixed buys wtih `head` and `last` -* added non-minifed browser version, as `prelude-browser.js` -* renamed `prelude-min.js` to `prelude-browser-min.js` -* renamed `zip` to `zipAll` -* renamed `zipWith` to `zipAllWith` -* added `zip`, a curried zip that takes only two arguments -* added `zipWith`, a curried zipWith that takes only two arguments - -# 0.4.0 -* added `parition` function -* added `curry` function -* removed `elem` function (use `in`) -* removed `notElem` function (use `not in`) - -# 0.3.0 -* added `listToObject` -* added `unique` -* added `objToFunc` -* added support for using strings in map and the like -* added support for using objects in map and the like -* added ability to use objects instead of functions in certain cases -* removed `error` (just use throw) -* added `tau` constant -* added `join` -* added `values` -* added `keys` -* added `partial` -* renamed `log` to `ln` -* added alias to `head`: `first` -* added `installPrelude` helper - -# 0.2.0 -* removed functions that simply warp operators as you can now use operators as functions in LiveScript -* `min/max` are now curried and take only 2 arguments -* added `call` - -# 0.1.0 -* initial public release diff --git a/tools/eslint/node_modules/prelude-ls/package.json b/tools/eslint/node_modules/prelude-ls/package.json index a740fa38cc51f5..18f35bcd6c3644 100644 --- a/tools/eslint/node_modules/prelude-ls/package.json +++ b/tools/eslint/node_modules/prelude-ls/package.json @@ -2,14 +2,14 @@ "_args": [ [ "prelude-ls@~1.1.2", - "/Users/trott/test/node_modules/eslint/node_modules/optionator" + "/Users/silverwind/git/node/tools/package/package/node_modules/optionator" ] ], "_from": "prelude-ls@>=1.1.2 <1.2.0", "_id": "prelude-ls@1.1.2", "_inCache": true, "_installable": true, - "_location": "/eslint/prelude-ls", + "_location": "/prelude-ls", "_nodeVersion": "0.11.15", "_npmUser": { "email": "z@georgezahariev.com", @@ -26,15 +26,15 @@ "type": "range" }, "_requiredBy": [ - "/eslint/levn", - "/eslint/optionator", - "/eslint/type-check" + "/levn", + "/optionator", + "/type-check" ], "_resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "_shasum": "21932a549f5e52ffd9a827f570e04be62a97da54", "_shrinkwrap": null, "_spec": "prelude-ls@~1.1.2", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/optionator", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/optionator", "author": { "email": "z@georgezahariev.com", "name": "George Zahariev" @@ -61,25 +61,25 @@ "node": ">= 0.8.0" }, "files": [ - "lib/", + "LICENSE", "README.md", - "LICENSE" + "lib/" ], "gitHead": "d69be8fd8a682321ba24eced17caf3a1b8ca73b8", "homepage": "http://preludels.com", "keywords": [ - "prelude", - "livescript", - "utility", - "ls", + "array", "coffeescript", + "functional", "javascript", "library", - "functional", - "array", "list", + "livescript", + "ls", "object", - "string" + "prelude", + "string", + "utility" ], "licenses": [ { @@ -90,8 +90,8 @@ "main": "lib/", "maintainers": [ { - "email": "z@georgezahariev.com", - "name": "gkz" + "name": "gkz", + "email": "z@georgezahariev.com" } ], "name": "prelude-ls", diff --git a/tools/eslint/node_modules/process-nextick-args/.travis.yml b/tools/eslint/node_modules/process-nextick-args/.travis.yml deleted file mode 100644 index 36201b10017a5e..00000000000000 --- a/tools/eslint/node_modules/process-nextick-args/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.11" - - "0.12" - - "1.7.1" - - 1 - - 2 - - 3 - - 4 - - 5 diff --git a/tools/eslint/node_modules/process-nextick-args/package.json b/tools/eslint/node_modules/process-nextick-args/package.json index 64f80345e8d5a4..0e19c03f4c7a1e 100644 --- a/tools/eslint/node_modules/process-nextick-args/package.json +++ b/tools/eslint/node_modules/process-nextick-args/package.json @@ -2,14 +2,14 @@ "_args": [ [ "process-nextick-args@~1.0.6", - "/Users/trott/test/node_modules/eslint/node_modules/readable-stream" + "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream" ] ], "_from": "process-nextick-args@>=1.0.6 <1.1.0", "_id": "process-nextick-args@1.0.6", "_inCache": true, "_installable": true, - "_location": "/eslint/process-nextick-args", + "_location": "/process-nextick-args", "_nodeVersion": "4.1.1", "_npmUser": { "email": "calvin.metcalf@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/readable-stream" + "/readable-stream" ], "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.6.tgz", "_shasum": "0f96b001cea90b12592ce566edb97ec11e69bd05", "_shrinkwrap": null, "_spec": "process-nextick-args@~1.0.6", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/readable-stream", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream", "author": "", "bugs": { "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" @@ -53,8 +53,8 @@ "main": "index.js", "maintainers": [ { - "email": "calvin.metcalf@gmail.com", - "name": "cwmma" + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" } ], "name": "process-nextick-args", diff --git a/tools/eslint/node_modules/process-nextick-args/test.js b/tools/eslint/node_modules/process-nextick-args/test.js deleted file mode 100644 index ef15721584ac99..00000000000000 --- a/tools/eslint/node_modules/process-nextick-args/test.js +++ /dev/null @@ -1,24 +0,0 @@ -var test = require("tap").test; -var nextTick = require('./'); - -test('should work', function (t) { - t.plan(5); - nextTick(function (a) { - t.ok(a); - nextTick(function (thing) { - t.equals(thing, 7); - }, 7); - }, true); - nextTick(function (a, b, c) { - t.equals(a, 'step'); - t.equals(b, 3); - t.equals(c, 'profit'); - }, 'step', 3, 'profit'); -}); - -test('correct number of arguments', function (t) { - t.plan(1); - nextTick(function () { - t.equals(2, arguments.length, 'correct number'); - }, 1, 2); -}); diff --git a/tools/eslint/node_modules/progress/.npmignore b/tools/eslint/node_modules/progress/.npmignore deleted file mode 100644 index f1250e584c94b8..00000000000000 --- a/tools/eslint/node_modules/progress/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/tools/eslint/node_modules/progress/History.md b/tools/eslint/node_modules/progress/History.md deleted file mode 100644 index 6a02e974ed8e89..00000000000000 --- a/tools/eslint/node_modules/progress/History.md +++ /dev/null @@ -1,77 +0,0 @@ -### 1.1.7 / 2014-06-30 - - * fixed a bug that occurs when a progress bar attempts to draw itself - on a console with very few columns - -### 1.1.6 / 2014-06-16 - - * now prevents progress bar from exceeding TTY width by limiting its width to - the with of the TTY - -### 1.1.5 / 2014-03-25 - - * updated documentation and various other repo maintenance - * updated makefile to run examples with `make` - * removed dependency on readline module - -### 1.1.4 / 2014-03-14 - - * now supports streams, for example output progress bar to stderr, while piping - stdout - * increases performance and flicker by remembering the last drawn progress bar - -### 1.1.3 / 2013-12-31 - - * fixes a bug where bar would bug when initializing - * allows to pass updated tokens when ticking or updating the bar - * fixes a bug where the bar would throw if skipping to far - -### 1.1.2 / 2013-10-17 - - * lets you pass an `fmt` and a `total` instead of an options object - -### 1.1.0 / 2013-09-18 - - * eta and elapsed tokens default to 0.0 instead of ?.? - * better JSDocs - * added back and forth example - * added method to update the progress bar to a specific percentage - * added an option to hide the bar on completion - -### 1.0.1 / 2013-08-07 - - * on os x readline now works, reverting the terminal hack - -### 1.0.0 / 2013-06-18 - - * remove .version - * merge pull request #15 from davglass/readline-osx - * on OSX revert back to terminal hack to avoid a readline bug - -### 0.1.0 / 2012-09-19 - - * fixed logic bug that caused bar to jump one extra space at the end [davglass] - * working with readline impl, even on Windows [davglass] - * using readline instead of the \r hack [davglass] - -### 0.0.5 / 2012-08-07 - - * add ability to tick by zero chunks - tick(0) - * fix ETA. Closes #4 [lwille] - -### 0.0.4 / 2011-11-14 - - * allow more recent versions of node - -### 0.0.3 / 2011-04-20 - - * changed; erase the line when complete - -### 0.0.2 / 2011-04-20 - - * added custom tokens support - * fixed; clear line before writing - -### 0.0.1 / 2010-01-03 - - * initial release diff --git a/tools/eslint/node_modules/progress/package.json b/tools/eslint/node_modules/progress/package.json index c93112fbfa8ae4..8cd6b0a4f9dac7 100644 --- a/tools/eslint/node_modules/progress/package.json +++ b/tools/eslint/node_modules/progress/package.json @@ -2,14 +2,14 @@ "_args": [ [ "progress@^1.1.8", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "progress@>=1.1.8 <2.0.0", "_id": "progress@1.1.8", "_inCache": true, "_installable": true, - "_location": "/eslint/progress", + "_location": "/progress", "_npmUser": { "email": "scalesjordan@gmail.com", "name": "prezjordan" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "_shasum": "e260c78f6161cdd9b0e56cc3e0a85de17c7a57be", "_shrinkwrap": null, "_spec": "progress@^1.1.8", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "tj@vision-media.ca", "name": "TJ Holowaychuk" @@ -41,12 +41,12 @@ }, "contributors": [ { - "email": "christoffer.hallas@gmail.com", - "name": "Christoffer Hallas" + "name": "Christoffer Hallas", + "email": "christoffer.hallas@gmail.com" }, { - "email": "scalesjordan@gmail.com", - "name": "Jordan Scales" + "name": "Jordan Scales", + "email": "scalesjordan@gmail.com" } ], "dependencies": {}, @@ -55,7 +55,7 @@ "directories": {}, "dist": { "shasum": "e260c78f6161cdd9b0e56cc3e0a85de17c7a57be", - "tarball": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz" + "tarball": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz" }, "engines": { "node": ">=0.4.0" @@ -69,16 +69,16 @@ "main": "index", "maintainers": [ { - "email": "tj@vision-media.ca", - "name": "tjholowaychuk" + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" }, { - "email": "christoffer.hallas@forsvikgroup.com", - "name": "hallas" + "name": "hallas", + "email": "christoffer.hallas@forsvikgroup.com" }, { - "email": "scalesjordan@gmail.com", - "name": "prezjordan" + "name": "prezjordan", + "email": "scalesjordan@gmail.com" } ], "name": "progress", diff --git a/tools/eslint/node_modules/read-json-sync/package.json b/tools/eslint/node_modules/read-json-sync/package.json index 30fe718951a567..d2152d45dd57ee 100644 --- a/tools/eslint/node_modules/read-json-sync/package.json +++ b/tools/eslint/node_modules/read-json-sync/package.json @@ -2,14 +2,14 @@ "_args": [ [ "read-json-sync@^1.1.0", - "/Users/trott/test/node_modules/eslint/node_modules/flat-cache" + "/Users/silverwind/git/node/tools/package/package/node_modules/flat-cache" ] ], "_from": "read-json-sync@>=1.1.0 <2.0.0", "_id": "read-json-sync@1.1.1", "_inCache": true, "_installable": true, - "_location": "/eslint/read-json-sync", + "_location": "/read-json-sync", "_nodeVersion": "5.1.0", "_npmUser": { "email": "snnskwtnb@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/flat-cache" + "/flat-cache" ], "_resolved": "https://registry.npmjs.org/read-json-sync/-/read-json-sync-1.1.1.tgz", "_shasum": "43c669ae864aae308dfbbb2721a67e295ec8fff6", "_shrinkwrap": null, "_spec": "read-json-sync@^1.1.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/flat-cache", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/flat-cache", "author": { "name": "Shinnosuke Watanabe", "url": "https://github.com/shinnn" @@ -63,20 +63,20 @@ "homepage": "https://github.com/shinnn/read-json-sync#readme", "keywords": [ "data", - "json", "file", - "read", + "json", "load", "parse", + "read", + "sync", "synchronous", - "synchronously", - "sync" + "synchronously" ], "license": "MIT", "maintainers": [ { - "email": "snnskwtnb@gmail.com", - "name": "shinnn" + "name": "shinnn", + "email": "snnskwtnb@gmail.com" } ], "name": "read-json-sync", diff --git a/tools/eslint/node_modules/readable-stream/.npmignore b/tools/eslint/node_modules/readable-stream/.npmignore deleted file mode 100644 index 38344f87a62766..00000000000000 --- a/tools/eslint/node_modules/readable-stream/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -build/ -test/ -examples/ -fs.js -zlib.js \ No newline at end of file diff --git a/tools/eslint/node_modules/readable-stream/.travis.yml b/tools/eslint/node_modules/readable-stream/.travis.yml deleted file mode 100644 index cfe1c9439388b6..00000000000000 --- a/tools/eslint/node_modules/readable-stream/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -sudo: false -language: node_js -before_install: - - npm install -g npm@2 - - npm install -g npm -notifications: - email: false -matrix: - include: - - node_js: '0.8' - env: TASK=test - - node_js: '0.10' - env: TASK=test - - node_js: '0.11' - env: TASK=test - - node_js: '0.12' - env: TASK=test - - node_js: 1 - env: TASK=test - - node_js: 2 - env: TASK=test - - node_js: 3 - env: TASK=test - - node_js: 4 - env: TASK=test - - node_js: 5 - env: TASK=test - - node_js: node - env: TASK=test - - node_js: node - env: TASK=browser BROWSER_NAME=opera BROWSER_VERSION="11..latest" - - node_js: node - env: TASK=browser BROWSER_NAME=ie BROWSER_VERSION="9..latest" - - node_js: node - env: TASK=browser BROWSER_NAME=chrome BROWSER_VERSION="41..beta" - - node_js: node - env: TASK=browser BROWSER_NAME=firefox BROWSER_VERSION="36..latest" - - node_js: node - env: TASK=browser BROWSER_NAME=ipad BROWSER_VERSION="['6.1', '7.1', '8.2']" - - node_js: node - env: TASK=browser BROWSER_NAME=iphone BROWSER_VERSION="['6.1', '7.1', '8.2']" - - node_js: node - env: TASK=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest" - - node_js: node - env: TASK=browser BROWSER_NAME=android BROWSER_VERSION="4.0..latest" -script: "npm run $TASK" -env: - global: - - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc= - - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI= diff --git a/tools/eslint/node_modules/readable-stream/README.md b/tools/eslint/node_modules/readable-stream/README.md index 77fafa3da15f9f..1a67c48cd031b5 100644 --- a/tools/eslint/node_modules/readable-stream/README.md +++ b/tools/eslint/node_modules/readable-stream/README.md @@ -1,6 +1,6 @@ # readable-stream -***Node-core streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) +***Node-core v5.8.0 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) [![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) diff --git a/tools/eslint/node_modules/readable-stream/doc/stream.markdown b/tools/eslint/node_modules/readable-stream/doc/stream.markdown deleted file mode 100644 index 3988c0cbd0d9c9..00000000000000 --- a/tools/eslint/node_modules/readable-stream/doc/stream.markdown +++ /dev/null @@ -1,1730 +0,0 @@ -# Stream - - Stability: 2 - Stable - -A stream is an abstract interface implemented by various objects in -Node.js. For example a [request to an HTTP server][] is a stream, as is -[stdout][]. Streams are readable, writable, or both. All streams are -instances of [EventEmitter][] - -You can load the Stream base classes by doing `require('stream')`. -There are base classes provided for [Readable][] streams, [Writable][] -streams, [Duplex][] streams, and [Transform][] streams. - -This document is split up into 3 sections. The first explains the -parts of the API that you need to be aware of to use streams in your -programs. If you never implement a streaming API yourself, you can -stop there. - -The second section explains the parts of the API that you need to use -if you implement your own custom streams yourself. The API is -designed to make this easy for you to do. - -The third section goes into more depth about how streams work, -including some of the internal mechanisms and functions that you -should probably not modify unless you definitely know what you are -doing. - - -## API for Stream Consumers - - - -Streams can be either [Readable][], [Writable][], or both ([Duplex][]). - -All streams are EventEmitters, but they also have other custom methods -and properties depending on whether they are Readable, Writable, or -Duplex. - -If a stream is both Readable and Writable, then it implements all of -the methods and events below. So, a [Duplex][] or [Transform][] stream is -fully described by this API, though their implementation may be -somewhat different. - -It is not necessary to implement Stream interfaces in order to consume -streams in your programs. If you **are** implementing streaming -interfaces in your own program, please also refer to -[API for Stream Implementors][] below. - -Almost all Node.js programs, no matter how simple, use Streams in some -way. Here is an example of using Streams in an Node.js program: - -```javascript -var http = require('http'); - -var server = http.createServer(function (req, res) { - // req is an http.IncomingMessage, which is a Readable Stream - // res is an http.ServerResponse, which is a Writable Stream - - var body = ''; - // we want to get the data as utf8 strings - // If you don't set an encoding, then you'll get Buffer objects - req.setEncoding('utf8'); - - // Readable streams emit 'data' events once a listener is added - req.on('data', function (chunk) { - body += chunk; - }); - - // the end event tells you that you have entire body - req.on('end', function () { - try { - var data = JSON.parse(body); - } catch (er) { - // uh oh! bad json! - res.statusCode = 400; - return res.end('error: ' + er.message); - } - - // write back something interesting to the user: - res.write(typeof data); - res.end(); - }); -}); - -server.listen(1337); - -// $ curl localhost:1337 -d '{}' -// object -// $ curl localhost:1337 -d '"foo"' -// string -// $ curl localhost:1337 -d 'not json' -// error: Unexpected token o -``` - -### Class: stream.Duplex - -Duplex streams are streams that implement both the [Readable][] and -[Writable][] interfaces. See above for usage. - -Examples of Duplex streams include: - -* [tcp sockets][] -* [zlib streams][] -* [crypto streams][] - -### Class: stream.Readable - - - -The Readable stream interface is the abstraction for a *source* of -data that you are reading from. In other words, data comes *out* of a -Readable stream. - -A Readable stream will not start emitting data until you indicate that -you are ready to receive it. - -Readable streams have two "modes": a **flowing mode** and a **paused -mode**. When in flowing mode, data is read from the underlying system -and provided to your program as fast as possible. In paused mode, you -must explicitly call `stream.read()` to get chunks of data out. -Streams start out in paused mode. - -**Note**: If no data event handlers are attached, and there are no -[`pipe()`][] destinations, and the stream is switched into flowing -mode, then data will be lost. - -You can switch to flowing mode by doing any of the following: - -* Adding a [`'data'` event][] handler to listen for data. -* Calling the [`resume()`][] method to explicitly open the flow. -* Calling the [`pipe()`][] method to send the data to a [Writable][]. - -You can switch back to paused mode by doing either of the following: - -* If there are no pipe destinations, by calling the [`pause()`][] - method. -* If there are pipe destinations, by removing any [`'data'` event][] - handlers, and removing all pipe destinations by calling the - [`unpipe()`][] method. - -Note that, for backwards compatibility reasons, removing `'data'` -event handlers will **not** automatically pause the stream. Also, if -there are piped destinations, then calling `pause()` will not -guarantee that the stream will *remain* paused once those -destinations drain and ask for more data. - -Examples of readable streams include: - -* [http responses, on the client][] -* [http requests, on the server][] -* [fs read streams][] -* [zlib streams][] -* [crypto streams][] -* [tcp sockets][] -* [child process stdout and stderr][] -* [process.stdin][] - -#### Event: 'close' - -Emitted when the stream and any of its underlying resources (a file -descriptor, for example) have been closed. The event indicates that -no more events will be emitted, and no further computation will occur. - -Not all streams will emit the 'close' event. - -#### Event: 'data' - -* `chunk` {Buffer | String} The chunk of data. - -Attaching a `data` event listener to a stream that has not been -explicitly paused will switch the stream into flowing mode. Data will -then be passed as soon as it is available. - -If you just want to get all the data out of the stream as fast as -possible, this is the best way to do so. - -```javascript -var readable = getReadableStreamSomehow(); -readable.on('data', function(chunk) { - console.log('got %d bytes of data', chunk.length); -}); -``` - -#### Event: 'end' - -This event fires when there will be no more data to read. - -Note that the `end` event **will not fire** unless the data is -completely consumed. This can be done by switching into flowing mode, -or by calling `read()` repeatedly until you get to the end. - -```javascript -var readable = getReadableStreamSomehow(); -readable.on('data', function(chunk) { - console.log('got %d bytes of data', chunk.length); -}); -readable.on('end', function() { - console.log('there will be no more data.'); -}); -``` - -#### Event: 'error' - -* {Error Object} - -Emitted if there was an error receiving data. - -#### Event: 'readable' - -When a chunk of data can be read from the stream, it will emit a -`'readable'` event. - -In some cases, listening for a `'readable'` event will cause some data -to be read into the internal buffer from the underlying system, if it -hadn't already. - -```javascript -var readable = getReadableStreamSomehow(); -readable.on('readable', function() { - // there is some data to read now -}); -``` - -Once the internal buffer is drained, a `readable` event will fire -again when more data is available. - -The `readable` event is not emitted in the "flowing" mode with the -sole exception of the last one, on end-of-stream. - -The 'readable' event indicates that the stream has new information: -either new data is available or the end of the stream has been reached. -In the former case, `.read()` will return that data. In the latter case, -`.read()` will return null. For instance, in the following example, `foo.txt` -is an empty file: - -```javascript -var fs = require('fs'); -var rr = fs.createReadStream('foo.txt'); -rr.on('readable', function() { - console.log('readable:', rr.read()); -}); -rr.on('end', function() { - console.log('end'); -}); -``` - -The output of running this script is: - -``` -bash-3.2$ node test.js -readable: null -end -``` - -#### readable.isPaused() - -* Return: `Boolean` - -This method returns whether or not the `readable` has been **explicitly** -paused by client code (using `readable.pause()` without a corresponding -`readable.resume()`). - -```javascript -var readable = new stream.Readable - -readable.isPaused() // === false -readable.pause() -readable.isPaused() // === true -readable.resume() -readable.isPaused() // === false -``` - -#### readable.pause() - -* Return: `this` - -This method will cause a stream in flowing mode to stop emitting -`data` events, switching out of flowing mode. Any data that becomes -available will remain in the internal buffer. - -```javascript -var readable = getReadableStreamSomehow(); -readable.on('data', function(chunk) { - console.log('got %d bytes of data', chunk.length); - readable.pause(); - console.log('there will be no more data for 1 second'); - setTimeout(function() { - console.log('now data will start flowing again'); - readable.resume(); - }, 1000); -}); -``` - -#### readable.pipe(destination[, options]) - -* `destination` {[Writable][] Stream} The destination for writing data -* `options` {Object} Pipe options - * `end` {Boolean} End the writer when the reader ends. Default = `true` - -This method pulls all the data out of a readable stream, and writes it -to the supplied destination, automatically managing the flow so that -the destination is not overwhelmed by a fast readable stream. - -Multiple destinations can be piped to safely. - -```javascript -var readable = getReadableStreamSomehow(); -var writable = fs.createWriteStream('file.txt'); -// All the data from readable goes into 'file.txt' -readable.pipe(writable); -``` - -This function returns the destination stream, so you can set up pipe -chains like so: - -```javascript -var r = fs.createReadStream('file.txt'); -var z = zlib.createGzip(); -var w = fs.createWriteStream('file.txt.gz'); -r.pipe(z).pipe(w); -``` - -For example, emulating the Unix `cat` command: - -```javascript -process.stdin.pipe(process.stdout); -``` - -By default [`end()`][] is called on the destination when the source stream -emits `end`, so that `destination` is no longer writable. Pass `{ end: -false }` as `options` to keep the destination stream open. - -This keeps `writer` open so that "Goodbye" can be written at the -end. - -```javascript -reader.pipe(writer, { end: false }); -reader.on('end', function() { - writer.end('Goodbye\n'); -}); -``` - -Note that `process.stderr` and `process.stdout` are never closed until -the process exits, regardless of the specified options. - -#### readable.read([size]) - -* `size` {Number} Optional argument to specify how much data to read. -* Return {String | Buffer | null} - -The `read()` method pulls some data out of the internal buffer and -returns it. If there is no data available, then it will return -`null`. - -If you pass in a `size` argument, then it will return that many -bytes. If `size` bytes are not available, then it will return `null`, -unless we've ended, in which case it will return the data remaining -in the buffer. - -If you do not specify a `size` argument, then it will return all the -data in the internal buffer. - -This method should only be called in paused mode. In flowing mode, -this method is called automatically until the internal buffer is -drained. - -```javascript -var readable = getReadableStreamSomehow(); -readable.on('readable', function() { - var chunk; - while (null !== (chunk = readable.read())) { - console.log('got %d bytes of data', chunk.length); - } -}); -``` - -If this method returns a data chunk, then it will also trigger the -emission of a [`'data'` event][]. - -Note that calling `readable.read([size])` after the `end` event has been -triggered will return `null`. No runtime error will be raised. - -#### readable.resume() - -* Return: `this` - -This method will cause the readable stream to resume emitting `data` -events. - -This method will switch the stream into flowing mode. If you do *not* -want to consume the data from a stream, but you *do* want to get to -its `end` event, you can call [`readable.resume()`][] to open the flow of -data. - -```javascript -var readable = getReadableStreamSomehow(); -readable.resume(); -readable.on('end', function() { - console.log('got to the end, but did not read anything'); -}); -``` - -#### readable.setEncoding(encoding) - -* `encoding` {String} The encoding to use. -* Return: `this` - -Call this function to cause the stream to return strings of the -specified encoding instead of Buffer objects. For example, if you do -`readable.setEncoding('utf8')`, then the output data will be -interpreted as UTF-8 data, and returned as strings. If you do -`readable.setEncoding('hex')`, then the data will be encoded in -hexadecimal string format. - -This properly handles multi-byte characters that would otherwise be -potentially mangled if you simply pulled the Buffers directly and -called `buf.toString(encoding)` on them. If you want to read the data -as strings, always use this method. - -```javascript -var readable = getReadableStreamSomehow(); -readable.setEncoding('utf8'); -readable.on('data', function(chunk) { - assert.equal(typeof chunk, 'string'); - console.log('got %d characters of string data', chunk.length); -}); -``` - -#### readable.unpipe([destination]) - -* `destination` {[Writable][] Stream} Optional specific stream to unpipe - -This method will remove the hooks set up for a previous `pipe()` call. - -If the destination is not specified, then all pipes are removed. - -If the destination is specified, but no pipe is set up for it, then -this is a no-op. - -```javascript -var readable = getReadableStreamSomehow(); -var writable = fs.createWriteStream('file.txt'); -// All the data from readable goes into 'file.txt', -// but only for the first second -readable.pipe(writable); -setTimeout(function() { - console.log('stop writing to file.txt'); - readable.unpipe(writable); - console.log('manually close the file stream'); - writable.end(); -}, 1000); -``` - -#### readable.unshift(chunk) - -* `chunk` {Buffer | String} Chunk of data to unshift onto the read queue - -This is useful in certain cases where a stream is being consumed by a -parser, which needs to "un-consume" some data that it has -optimistically pulled out of the source, so that the stream can be -passed on to some other party. - -Note that `stream.unshift(chunk)` cannot be called after the `end` event -has been triggered; a runtime error will be raised. - -If you find that you must often call `stream.unshift(chunk)` in your -programs, consider implementing a [Transform][] stream instead. (See API -for Stream Implementors, below.) - -```javascript -// Pull off a header delimited by \n\n -// use unshift() if we get too much -// Call the callback with (error, header, stream) -var StringDecoder = require('string_decoder').StringDecoder; -function parseHeader(stream, callback) { - stream.on('error', callback); - stream.on('readable', onReadable); - var decoder = new StringDecoder('utf8'); - var header = ''; - function onReadable() { - var chunk; - while (null !== (chunk = stream.read())) { - var str = decoder.write(chunk); - if (str.match(/\n\n/)) { - // found the header boundary - var split = str.split(/\n\n/); - header += split.shift(); - var remaining = split.join('\n\n'); - var buf = new Buffer(remaining, 'utf8'); - if (buf.length) - stream.unshift(buf); - stream.removeListener('error', callback); - stream.removeListener('readable', onReadable); - // now the body of the message can be read from the stream. - callback(null, header, stream); - } else { - // still reading the header. - header += str; - } - } - } -} -``` -Note that, unlike `stream.push(chunk)`, `stream.unshift(chunk)` will not -end the reading process by resetting the internal reading state of the -stream. This can cause unexpected results if `unshift` is called during a -read (i.e. from within a `_read` implementation on a custom stream). Following -the call to `unshift` with an immediate `stream.push('')` will reset the -reading state appropriately, however it is best to simply avoid calling -`unshift` while in the process of performing a read. - -#### readable.wrap(stream) - -* `stream` {Stream} An "old style" readable stream - -Versions of Node.js prior to v0.10 had streams that did not implement the -entire Streams API as it is today. (See "Compatibility" below for -more information.) - -If you are using an older Node.js library that emits `'data'` events and -has a [`pause()`][] method that is advisory only, then you can use the -`wrap()` method to create a [Readable][] stream that uses the old stream -as its data source. - -You will very rarely ever need to call this function, but it exists -as a convenience for interacting with old Node.js programs and libraries. - -For example: - -```javascript -var OldReader = require('./old-api-module.js').OldReader; -var oreader = new OldReader; -var Readable = require('stream').Readable; -var myReader = new Readable().wrap(oreader); - -myReader.on('readable', function() { - myReader.read(); // etc. -}); -``` - -### Class: stream.Transform - -Transform streams are [Duplex][] streams where the output is in some way -computed from the input. They implement both the [Readable][] and -[Writable][] interfaces. See above for usage. - -Examples of Transform streams include: - -* [zlib streams][] -* [crypto streams][] - -### Class: stream.Writable - - - -The Writable stream interface is an abstraction for a *destination* -that you are writing data *to*. - -Examples of writable streams include: - -* [http requests, on the client][] -* [http responses, on the server][] -* [fs write streams][] -* [zlib streams][] -* [crypto streams][] -* [tcp sockets][] -* [child process stdin][] -* [process.stdout][], [process.stderr][] - -#### Event: 'drain' - -If a [`writable.write(chunk)`][] call returns false, then the `drain` -event will indicate when it is appropriate to begin writing more data -to the stream. - -```javascript -// Write the data to the supplied writable stream one million times. -// Be attentive to back-pressure. -function writeOneMillionTimes(writer, data, encoding, callback) { - var i = 1000000; - write(); - function write() { - var ok = true; - do { - i -= 1; - if (i === 0) { - // last time! - writer.write(data, encoding, callback); - } else { - // see if we should continue, or wait - // don't pass the callback, because we're not done yet. - ok = writer.write(data, encoding); - } - } while (i > 0 && ok); - if (i > 0) { - // had to stop early! - // write some more once it drains - writer.once('drain', write); - } - } -} -``` - -#### Event: 'error' - -* {Error object} - -Emitted if there was an error when writing or piping data. - -#### Event: 'finish' - -When the [`end()`][] method has been called, and all data has been flushed -to the underlying system, this event is emitted. - -```javascript -var writer = getWritableStreamSomehow(); -for (var i = 0; i < 100; i ++) { - writer.write('hello, #' + i + '!\n'); -} -writer.end('this is the end\n'); -writer.on('finish', function() { - console.error('all writes are now complete.'); -}); -``` - -#### Event: 'pipe' - -* `src` {[Readable][] Stream} source stream that is piping to this writable - -This is emitted whenever the `pipe()` method is called on a readable -stream, adding this writable to its set of destinations. - -```javascript -var writer = getWritableStreamSomehow(); -var reader = getReadableStreamSomehow(); -writer.on('pipe', function(src) { - console.error('something is piping into the writer'); - assert.equal(src, reader); -}); -reader.pipe(writer); -``` - -#### Event: 'unpipe' - -* `src` {[Readable][] Stream} The source stream that [unpiped][] this writable - -This is emitted whenever the [`unpipe()`][] method is called on a -readable stream, removing this writable from its set of destinations. - -```javascript -var writer = getWritableStreamSomehow(); -var reader = getReadableStreamSomehow(); -writer.on('unpipe', function(src) { - console.error('something has stopped piping into the writer'); - assert.equal(src, reader); -}); -reader.pipe(writer); -reader.unpipe(writer); -``` - -#### writable.cork() - -Forces buffering of all writes. - -Buffered data will be flushed either at `.uncork()` or at `.end()` call. - -#### writable.end([chunk][, encoding][, callback]) - -* `chunk` {String | Buffer} Optional data to write -* `encoding` {String} The encoding, if `chunk` is a String -* `callback` {Function} Optional callback for when the stream is finished - -Call this method when no more data will be written to the stream. If -supplied, the callback is attached as a listener on the `finish` event. - -Calling [`write()`][] after calling [`end()`][] will raise an error. - -```javascript -// write 'hello, ' and then end with 'world!' -var file = fs.createWriteStream('example.txt'); -file.write('hello, '); -file.end('world!'); -// writing more now is not allowed! -``` - -#### writable.setDefaultEncoding(encoding) - -* `encoding` {String} The new default encoding - -Sets the default encoding for a writable stream. - -#### writable.uncork() - -Flush all data, buffered since `.cork()` call. - -#### writable.write(chunk[, encoding][, callback]) - -* `chunk` {String | Buffer} The data to write -* `encoding` {String} The encoding, if `chunk` is a String -* `callback` {Function} Callback for when this chunk of data is flushed -* Returns: {Boolean} True if the data was handled completely. - -This method writes some data to the underlying system, and calls the -supplied callback once the data has been fully handled. - -The return value indicates if you should continue writing right now. -If the data had to be buffered internally, then it will return -`false`. Otherwise, it will return `true`. - -This return value is strictly advisory. You MAY continue to write, -even if it returns `false`. However, writes will be buffered in -memory, so it is best not to do this excessively. Instead, wait for -the `drain` event before writing more data. - - -## API for Stream Implementors - - - -To implement any sort of stream, the pattern is the same: - -1. Extend the appropriate parent class in your own subclass. (The - [`util.inherits`][] method is particularly helpful for this.) -2. Call the appropriate parent class constructor in your constructor, - to be sure that the internal mechanisms are set up properly. -2. Implement one or more specific methods, as detailed below. - -The class to extend and the method(s) to implement depend on the sort -of stream class you are writing: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -

        Use-case

        -
        -

        Class

        -
        -

        Method(s) to implement

        -
        -

        Reading only

        -
        -

        [Readable](#stream_class_stream_readable_1)

        -
        -

        [_read][]

        -
        -

        Writing only

        -
        -

        [Writable](#stream_class_stream_writable_1)

        -
        -

        [_write][], _writev

        -
        -

        Reading and writing

        -
        -

        [Duplex](#stream_class_stream_duplex_1)

        -
        -

        [_read][], [_write][], _writev

        -
        -

        Operate on written data, then read the result

        -
        -

        [Transform](#stream_class_stream_transform_1)

        -
        -

        _transform, _flush

        -
        - -In your implementation code, it is very important to never call the -methods described in [API for Stream Consumers][] above. Otherwise, you -can potentially cause adverse side effects in programs that consume -your streaming interfaces. - -### Class: stream.Duplex - - - -A "duplex" stream is one that is both Readable and Writable, such as a -TCP socket connection. - -Note that `stream.Duplex` is an abstract class designed to be extended -with an underlying implementation of the `_read(size)` and -[`_write(chunk, encoding, callback)`][] methods as you would with a -Readable or Writable stream class. - -Since JavaScript doesn't have multiple prototypal inheritance, this -class prototypally inherits from Readable, and then parasitically from -Writable. It is thus up to the user to implement both the lowlevel -`_read(n)` method as well as the lowlevel -[`_write(chunk, encoding, callback)`][] method on extension duplex classes. - -#### new stream.Duplex(options) - -* `options` {Object} Passed to both Writable and Readable - constructors. Also has the following fields: - * `allowHalfOpen` {Boolean} Default=true. If set to `false`, then - the stream will automatically end the readable side when the - writable side ends and vice versa. - * `readableObjectMode` {Boolean} Default=false. Sets `objectMode` - for readable side of the stream. Has no effect if `objectMode` - is `true`. - * `writableObjectMode` {Boolean} Default=false. Sets `objectMode` - for writable side of the stream. Has no effect if `objectMode` - is `true`. - -In classes that extend the Duplex class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### Class: stream.PassThrough - -This is a trivial implementation of a [Transform][] stream that simply -passes the input bytes across to the output. Its purpose is mainly -for examples and testing, but there are occasionally use cases where -it can come in handy as a building block for novel sorts of streams. - -### Class: stream.Readable - - - -`stream.Readable` is an abstract class designed to be extended with an -underlying implementation of the [`_read(size)`][] method. - -Please see above under [API for Stream Consumers][] for how to consume -streams in your programs. What follows is an explanation of how to -implement Readable streams in your programs. - -#### new stream.Readable([options]) - -* `options` {Object} - * `highWaterMark` {Number} The maximum number of bytes to store in - the internal buffer before ceasing to read from the underlying - resource. Default=16kb, or 16 for `objectMode` streams - * `encoding` {String} If specified, then buffers will be decoded to - strings using the specified encoding. Default=null - * `objectMode` {Boolean} Whether this stream should behave - as a stream of objects. Meaning that stream.read(n) returns - a single value instead of a Buffer of size n. Default=false - -In classes that extend the Readable class, make sure to call the -Readable constructor so that the buffering settings can be properly -initialized. - -#### readable.\_read(size) - -* `size` {Number} Number of bytes to read asynchronously - -Note: **Implement this method, but do NOT call it directly.** - -This method is prefixed with an underscore because it is internal to the -class that defines it and should only be called by the internal Readable -class methods. All Readable stream implementations must provide a _read -method to fetch data from the underlying resource. - -When _read is called, if data is available from the resource, `_read` should -start pushing that data into the read queue by calling `this.push(dataChunk)`. -`_read` should continue reading from the resource and pushing data until push -returns false, at which point it should stop reading from the resource. Only -when _read is called again after it has stopped should it start reading -more data from the resource and pushing that data onto the queue. - -Note: once the `_read()` method is called, it will not be called again until -the `push` method is called. - -The `size` argument is advisory. Implementations where a "read" is a -single call that returns data can use this to know how much data to -fetch. Implementations where that is not relevant, such as TCP or -TLS, may ignore this argument, and simply provide data whenever it -becomes available. There is no need, for example to "wait" until -`size` bytes are available before calling [`stream.push(chunk)`][]. - -#### readable.push(chunk[, encoding]) - -* `chunk` {Buffer | null | String} Chunk of data to push into the read queue -* `encoding` {String} Encoding of String chunks. Must be a valid - Buffer encoding, such as `'utf8'` or `'ascii'` -* return {Boolean} Whether or not more pushes should be performed - -Note: **This method should be called by Readable implementors, NOT -by consumers of Readable streams.** - -If a value other than null is passed, The `push()` method adds a chunk of data -into the queue for subsequent stream processors to consume. If `null` is -passed, it signals the end of the stream (EOF), after which no more data -can be written. - -The data added with `push` can be pulled out by calling the `read()` method -when the `'readable'`event fires. - -This API is designed to be as flexible as possible. For example, -you may be wrapping a lower-level source which has some sort of -pause/resume mechanism, and a data callback. In those cases, you -could wrap the low-level source object by doing something like this: - -```javascript -// source is an object with readStop() and readStart() methods, -// and an `ondata` member that gets called when it has data, and -// an `onend` member that gets called when the data is over. - -util.inherits(SourceWrapper, Readable); - -function SourceWrapper(options) { - Readable.call(this, options); - - this._source = getLowlevelSourceObject(); - var self = this; - - // Every time there's data, we push it into the internal buffer. - this._source.ondata = function(chunk) { - // if push() returns false, then we need to stop reading from source - if (!self.push(chunk)) - self._source.readStop(); - }; - - // When the source ends, we push the EOF-signaling `null` chunk - this._source.onend = function() { - self.push(null); - }; -} - -// _read will be called when the stream wants to pull more data in -// the advisory size argument is ignored in this case. -SourceWrapper.prototype._read = function(size) { - this._source.readStart(); -}; -``` - -#### Example: A Counting Stream - - - -This is a basic example of a Readable stream. It emits the numerals -from 1 to 1,000,000 in ascending order, and then ends. - -```javascript -var Readable = require('stream').Readable; -var util = require('util'); -util.inherits(Counter, Readable); - -function Counter(opt) { - Readable.call(this, opt); - this._max = 1000000; - this._index = 1; -} - -Counter.prototype._read = function() { - var i = this._index++; - if (i > this._max) - this.push(null); - else { - var str = '' + i; - var buf = new Buffer(str, 'ascii'); - this.push(buf); - } -}; -``` - -#### Example: SimpleProtocol v1 (Sub-optimal) - -This is similar to the `parseHeader` function described above, but -implemented as a custom stream. Also, note that this implementation -does not convert the incoming data to a string. - -However, this would be better implemented as a [Transform][] stream. See -below for a better implementation. - -```javascript -// A parser for a simple data protocol. -// The "header" is a JSON object, followed by 2 \n characters, and -// then a message body. -// -// NOTE: This can be done more simply as a Transform stream! -// Using Readable directly for this is sub-optimal. See the -// alternative example below under the Transform section. - -var Readable = require('stream').Readable; -var util = require('util'); - -util.inherits(SimpleProtocol, Readable); - -function SimpleProtocol(source, options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(source, options); - - Readable.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - - // source is a readable stream, such as a socket or file - this._source = source; - - var self = this; - source.on('end', function() { - self.push(null); - }); - - // give it a kick whenever the source is readable - // read(0) will not consume any bytes - source.on('readable', function() { - self.read(0); - }); - - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype._read = function(n) { - if (!this._inBody) { - var chunk = this._source.read(); - - // if the source doesn't have data, we don't have data yet. - if (chunk === null) - return this.push(''); - - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - this.push(''); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // now, because we got some extra data, unshift the rest - // back into the read queue so that our consumer will see it. - var b = chunk.slice(split); - this.unshift(b); - // calling unshift by itself does not reset the reading state - // of the stream; since we're inside _read, doing an additional - // push('') will reset the state appropriately. - this.push(''); - - // and let them know that we are done parsing the header. - this.emit('header', this.header); - } - } else { - // from there on, just provide the data to our consumer. - // careful not to push(null), since that would indicate EOF. - var chunk = this._source.read(); - if (chunk) this.push(chunk); - } -}; - -// Usage: -// var parser = new SimpleProtocol(source); -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### Class: stream.Transform - -A "transform" stream is a duplex stream where the output is causally -connected in some way to the input, such as a [zlib][] stream or a -[crypto][] stream. - -There is no requirement that the output be the same size as the input, -the same number of chunks, or arrive at the same time. For example, a -Hash stream will only ever have a single chunk of output which is -provided when the input is ended. A zlib stream will produce output -that is either much smaller or much larger than its input. - -Rather than implement the [`_read()`][] and [`_write()`][] methods, Transform -classes must implement the `_transform()` method, and may optionally -also implement the `_flush()` method. (See below.) - -#### new stream.Transform([options]) - -* `options` {Object} Passed to both Writable and Readable - constructors. - -In classes that extend the Transform class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -#### Events: 'finish' and 'end' - -The [`finish`][] and [`end`][] events are from the parent Writable -and Readable classes respectively. The `finish` event is fired after -`.end()` is called and all chunks have been processed by `_transform`, -`end` is fired after all data has been output which is after the callback -in `_flush` has been called. - -#### transform.\_flush(callback) - -* `callback` {Function} Call this function (optionally with an error - argument) when you are done flushing any remaining data. - -Note: **This function MUST NOT be called directly.** It MAY be implemented -by child classes, and if so, will be called by the internal Transform -class methods only. - -In some cases, your transform operation may need to emit a bit more -data at the end of the stream. For example, a `Zlib` compression -stream will store up some internal state so that it can optimally -compress the output. At the end, however, it needs to do the best it -can with what is left, so that the data will be complete. - -In those cases, you can implement a `_flush` method, which will be -called at the very end, after all the written data is consumed, but -before emitting `end` to signal the end of the readable side. Just -like with `_transform`, call `transform.push(chunk)` zero or more -times, as appropriate, and call `callback` when the flush operation is -complete. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### transform.\_transform(chunk, encoding, callback) - -* `chunk` {Buffer | String} The chunk to be transformed. Will **always** - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. If chunk is a buffer, then this is the special - value - 'buffer', ignore it in this case. -* `callback` {Function} Call this function (optionally with an error - argument and data) when you are done processing the supplied chunk. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Transform -class methods only. - -All Transform stream implementations must provide a `_transform` -method to accept input and produce output. - -`_transform` should do whatever has to be done in this specific -Transform class, to handle the bytes being written, and pass them off -to the readable portion of the interface. Do asynchronous I/O, -process things, and so on. - -Call `transform.push(outputChunk)` 0 or more times to generate output -from this input chunk, depending on how much data you want to output -as a result of this chunk. - -Call the callback function only when the current chunk is completely -consumed. Note that there may or may not be output as a result of any -particular input chunk. If you supply a second argument to the callback -it will be passed to the push method. In other words the following are -equivalent: - -```javascript -transform.prototype._transform = function (data, encoding, callback) { - this.push(data); - callback(); -}; - -transform.prototype._transform = function (data, encoding, callback) { - callback(null, data); -}; -``` - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### Example: `SimpleProtocol` parser v2 - -The example above of a simple protocol parser can be implemented -simply by using the higher level [Transform][] stream class, similar to -the `parseHeader` and `SimpleProtocol v1` examples above. - -In this example, rather than providing the input as an argument, it -would be piped into the parser, which is a more idiomatic Node.js stream -approach. - -```javascript -var util = require('util'); -var Transform = require('stream').Transform; -util.inherits(SimpleProtocol, Transform); - -function SimpleProtocol(options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(options); - - Transform.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype._transform = function(chunk, encoding, done) { - if (!this._inBody) { - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // and let them know that we are done parsing the header. - this.emit('header', this.header); - - // now, because we got some extra data, emit this first. - this.push(chunk.slice(split)); - } - } else { - // from there on, just provide the data to our consumer as-is. - this.push(chunk); - } - done(); -}; - -// Usage: -// var parser = new SimpleProtocol(); -// source.pipe(parser) -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### Class: stream.Writable - - - -`stream.Writable` is an abstract class designed to be extended with an -underlying implementation of the [`_write(chunk, encoding, callback)`][] method. - -Please see above under [API for Stream Consumers][] for how to consume -writable streams in your programs. What follows is an explanation of -how to implement Writable streams in your programs. - -#### new stream.Writable([options]) - -* `options` {Object} - * `highWaterMark` {Number} Buffer level when [`write()`][] starts - returning false. Default=16kb, or 16 for `objectMode` streams - * `decodeStrings` {Boolean} Whether or not to decode strings into - Buffers before passing them to [`_write()`][]. Default=true - * `objectMode` {Boolean} Whether or not the `write(anyObj)` is - a valid operation. If set you can write arbitrary data instead - of only `Buffer` / `String` data. Default=false - -In classes that extend the Writable class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -#### writable.\_write(chunk, encoding, callback) - -* `chunk` {Buffer | String} The chunk to be written. Will **always** - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. If chunk is a buffer, then this is the special - value - 'buffer', ignore it in this case. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunk. - -All Writable stream implementations must provide a [`_write()`][] -method to send data to the underlying resource. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Writable -class methods only. - -Call the callback using the standard `callback(error)` pattern to -signal that the write completed successfully or with an error. - -If the `decodeStrings` flag is set in the constructor options, then -`chunk` may be a string rather than a Buffer, and `encoding` will -indicate the sort of string that it is. This is to support -implementations that have an optimized handling for certain string -data encodings. If you do not explicitly set the `decodeStrings` -option to `false`, then you can safely ignore the `encoding` argument, -and assume that `chunk` will always be a Buffer. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### writable.\_writev(chunks, callback) - -* `chunks` {Array} The chunks to be written. Each chunk has following - format: `{ chunk: ..., encoding: ... }`. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunks. - -Note: **This function MUST NOT be called directly.** It may be -implemented by child classes, and called by the internal Writable -class methods only. - -This function is completely optional to implement. In most cases it is -unnecessary. If implemented, it will be called with all the chunks -that are buffered in the write queue. - - -## Simplified Constructor API - - - -In simple cases there is now the added benefit of being able to construct a stream without inheritance. - -This can be done by passing the appropriate methods as constructor options: - -Examples: - -### Duplex -```javascript -var duplex = new stream.Duplex({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - }, - write: function(chunk, encoding, next) { - // sets this._write under the hood - - // An optional error can be passed as the first argument - next() - } -}); - -// or - -var duplex = new stream.Duplex({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - }, - writev: function(chunks, next) { - // sets this._writev under the hood - - // An optional error can be passed as the first argument - next() - } -}); -``` - -### Readable -```javascript -var readable = new stream.Readable({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - } -}); -``` - -### Transform -```javascript -var transform = new stream.Transform({ - transform: function(chunk, encoding, next) { - // sets this._transform under the hood - - // generate output as many times as needed - // this.push(chunk); - - // call when the current chunk is consumed - next(); - }, - flush: function(done) { - // sets this._flush under the hood - - // generate output as many times as needed - // this.push(chunk); - - done(); - } -}); -``` - -### Writable -```javascript -var writable = new stream.Writable({ - write: function(chunk, encoding, next) { - // sets this._write under the hood - - // An optional error can be passed as the first argument - next() - } -}); - -// or - -var writable = new stream.Writable({ - writev: function(chunks, next) { - // sets this._writev under the hood - - // An optional error can be passed as the first argument - next() - } -}); -``` - -## Streams: Under the Hood - - - -### Buffering - - - -Both Writable and Readable streams will buffer data on an internal -object which can be retrieved from `_writableState.getBuffer()` or -`_readableState.buffer`, respectively. - -The amount of data that will potentially be buffered depends on the -`highWaterMark` option which is passed into the constructor. - -Buffering in Readable streams happens when the implementation calls -[`stream.push(chunk)`][]. If the consumer of the Stream does not call -`stream.read()`, then the data will sit in the internal queue until it -is consumed. - -Buffering in Writable streams happens when the user calls -[`stream.write(chunk)`][] repeatedly, even when `write()` returns `false`. - -The purpose of streams, especially with the `pipe()` method, is to -limit the buffering of data to acceptable levels, so that sources and -destinations of varying speed will not overwhelm the available memory. - -### Compatibility with Older Node.js Versions - - - -In versions of Node.js prior to v0.10, the Readable stream interface was -simpler, but also less powerful and less useful. - -* Rather than waiting for you to call the `read()` method, `'data'` - events would start emitting immediately. If you needed to do some - I/O to decide how to handle data, then you had to store the chunks - in some kind of buffer so that they would not be lost. -* The [`pause()`][] method was advisory, rather than guaranteed. This - meant that you still had to be prepared to receive `'data'` events - even when the stream was in a paused state. - -In Node.js v0.10, the Readable class described below was added. -For backwards compatibility with older Node.js programs, Readable streams -switch into "flowing mode" when a `'data'` event handler is added, or -when the [`resume()`][] method is called. The effect is that, even if -you are not using the new `read()` method and `'readable'` event, you -no longer have to worry about losing `'data'` chunks. - -Most programs will continue to function normally. However, this -introduces an edge case in the following conditions: - -* No [`'data'` event][] handler is added. -* The [`resume()`][] method is never called. -* The stream is not piped to any writable destination. - -For example, consider the following code: - -```javascript -// WARNING! BROKEN! -net.createServer(function(socket) { - - // we add an 'end' method, but never consume the data - socket.on('end', function() { - // It will never get here. - socket.end('I got your message (but didnt read it)\n'); - }); - -}).listen(1337); -``` - -In versions of Node.js prior to v0.10, the incoming message data would be -simply discarded. However, in Node.js v0.10 and beyond, -the socket will remain paused forever. - -The workaround in this situation is to call the `resume()` method to -start the flow of data: - -```javascript -// Workaround -net.createServer(function(socket) { - - socket.on('end', function() { - socket.end('I got your message (but didnt read it)\n'); - }); - - // start the flow of data, discarding it. - socket.resume(); - -}).listen(1337); -``` - -In addition to new Readable streams switching into flowing mode, -pre-v0.10 style streams can be wrapped in a Readable class using the -`wrap()` method. - - -### Object Mode - - - -Normally, Streams operate on Strings and Buffers exclusively. - -Streams that are in **object mode** can emit generic JavaScript values -other than Buffers and Strings. - -A Readable stream in object mode will always return a single item from -a call to `stream.read(size)`, regardless of what the size argument -is. - -A Writable stream in object mode will always ignore the `encoding` -argument to `stream.write(data, encoding)`. - -The special value `null` still retains its special value for object -mode streams. That is, for object mode readable streams, `null` as a -return value from `stream.read()` indicates that there is no more -data, and [`stream.push(null)`][] will signal the end of stream data -(`EOF`). - -No streams in Node.js core are object mode streams. This pattern is only -used by userland streaming libraries. - -You should set `objectMode` in your stream child class constructor on -the options object. Setting `objectMode` mid-stream is not safe. - -For Duplex streams `objectMode` can be set exclusively for readable or -writable side with `readableObjectMode` and `writableObjectMode` -respectively. These options can be used to implement parsers and -serializers with Transform streams. - -```javascript -var util = require('util'); -var StringDecoder = require('string_decoder').StringDecoder; -var Transform = require('stream').Transform; -util.inherits(JSONParseStream, Transform); - -// Gets \n-delimited JSON string data, and emits the parsed objects -function JSONParseStream() { - if (!(this instanceof JSONParseStream)) - return new JSONParseStream(); - - Transform.call(this, { readableObjectMode : true }); - - this._buffer = ''; - this._decoder = new StringDecoder('utf8'); -} - -JSONParseStream.prototype._transform = function(chunk, encoding, cb) { - this._buffer += this._decoder.write(chunk); - // split on newlines - var lines = this._buffer.split(/\r?\n/); - // keep the last partial line buffered - this._buffer = lines.pop(); - for (var l = 0; l < lines.length; l++) { - var line = lines[l]; - try { - var obj = JSON.parse(line); - } catch (er) { - this.emit('error', er); - return; - } - // push the parsed object out to the readable consumer - this.push(obj); - } - cb(); -}; - -JSONParseStream.prototype._flush = function(cb) { - // Just handle any leftover - var rem = this._buffer.trim(); - if (rem) { - try { - var obj = JSON.parse(rem); - } catch (er) { - this.emit('error', er); - return; - } - // push the parsed object out to the readable consumer - this.push(obj); - } - cb(); -}; -``` - -### `stream.read(0)` - -There are some cases where you want to trigger a refresh of the -underlying readable stream mechanisms, without actually consuming any -data. In that case, you can call `stream.read(0)`, which will always -return null. - -If the internal read buffer is below the `highWaterMark`, and the -stream is not currently reading, then calling `read(0)` will trigger -a low-level `_read` call. - -There is almost never a need to do this. However, you will see some -cases in Node.js's internals where this is done, particularly in the -Readable stream class internals. - -### `stream.push('')` - -Pushing a zero-byte string or Buffer (when not in [Object mode][]) has an -interesting side effect. Because it *is* a call to -[`stream.push()`][], it will end the `reading` process. However, it -does *not* add any data to the readable buffer, so there's nothing for -a user to consume. - -Very rarely, there are cases where you have no data to provide now, -but the consumer of your stream (or, perhaps, another bit of your own -code) will know when to check again, by calling `stream.read(0)`. In -those cases, you *may* call `stream.push('')`. - -So far, the only use case for this functionality is in the -[tls.CryptoStream][] class, which is deprecated in Node.js/io.js v1.0. If you -find that you have to use `stream.push('')`, please consider another -approach, because it almost certainly indicates that something is -horribly wrong. - -[request to an HTTP server]: https://nodejs.org/docs/v5.1.0/api/http.html#http_http_incomingmessage -[EventEmitter]: https://nodejs.org/docs/v5.1.0/api/events.html#events_class_events_eventemitter -[Object mode]: #stream_object_mode -[`stream.push(chunk)`]: #stream_readable_push_chunk_encoding -[`stream.push(null)`]: #stream_readable_push_chunk_encoding -[`stream.push()`]: #stream_readable_push_chunk_encoding -[`unpipe()`]: #stream_readable_unpipe_destination -[unpiped]: #stream_readable_unpipe_destination -[tcp sockets]: https://nodejs.org/docs/v5.1.0/api/net.html#net_class_net_socket -[http responses, on the client]: https://nodejs.org/docs/v5.1.0/api/http.html#http_http_incomingmessage -[http requests, on the server]: https://nodejs.org/docs/v5.1.0/api/http.html#http_http_incomingmessage -[http requests, on the client]: https://nodejs.org/docs/v5.1.0/api/http.html#http_class_http_clientrequest -[http responses, on the server]: https://nodejs.org/docs/v5.1.0/api/http.html#http_class_http_serverresponse -[fs read streams]: https://nodejs.org/docs/v5.1.0/api/fs.html#fs_class_fs_readstream -[fs write streams]: https://nodejs.org/docs/v5.1.0/api/fs.html#fs_class_fs_writestream -[zlib streams]: zlib.html -[zlib]: zlib.html -[crypto streams]: crypto.html -[crypto]: crypto.html -[tls.CryptoStream]: https://nodejs.org/docs/v5.1.0/api/tls.html#tls_class_cryptostream -[process.stdin]: https://nodejs.org/docs/v5.1.0/api/process.html#process_process_stdin -[stdout]: https://nodejs.org/docs/v5.1.0/api/process.html#process_process_stdout -[process.stdout]: https://nodejs.org/docs/v5.1.0/api/process.html#process_process_stdout -[process.stderr]: https://nodejs.org/docs/v5.1.0/api/process.html#process_process_stderr -[child process stdout and stderr]: https://nodejs.org/docs/v5.1.0/api/child_process.html#child_process_child_stdout -[child process stdin]: https://nodejs.org/docs/v5.1.0/api/child_process.html#child_process_child_stdin -[API for Stream Consumers]: #stream_api_for_stream_consumers -[API for Stream Implementors]: #stream_api_for_stream_implementors -[Readable]: #stream_class_stream_readable -[Writable]: #stream_class_stream_writable -[Duplex]: #stream_class_stream_duplex -[Transform]: #stream_class_stream_transform -[`end`]: #stream_event_end -[`finish`]: #stream_event_finish -[`_read(size)`]: #stream_readable_read_size_1 -[`_read()`]: #stream_readable_read_size_1 -[_read]: #stream_readable_read_size_1 -[`writable.write(chunk)`]: #stream_writable_write_chunk_encoding_callback -[`write(chunk, encoding, callback)`]: #stream_writable_write_chunk_encoding_callback -[`write()`]: #stream_writable_write_chunk_encoding_callback -[`stream.write(chunk)`]: #stream_writable_write_chunk_encoding_callback -[`_write(chunk, encoding, callback)`]: #stream_writable_write_chunk_encoding_callback_1 -[`_write()`]: #stream_writable_write_chunk_encoding_callback_1 -[_write]: #stream_writable_write_chunk_encoding_callback_1 -[`util.inherits`]: https://nodejs.org/docs/v5.1.0/api/util.html#util_util_inherits_constructor_superconstructor -[`end()`]: #stream_writable_end_chunk_encoding_callback -[`'data'` event]: #stream_event_data -[`resume()`]: #stream_readable_resume -[`readable.resume()`]: #stream_readable_resume -[`pause()`]: #stream_readable_pause -[`unpipe()`]: #stream_readable_unpipe_destination -[`pipe()`]: #stream_readable_pipe_destination_options diff --git a/tools/eslint/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/tools/eslint/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md deleted file mode 100644 index c141a99c26c638..00000000000000 --- a/tools/eslint/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +++ /dev/null @@ -1,58 +0,0 @@ -# streams WG Meeting 2015-01-30 - -## Links - -* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg -* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106 -* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/ - -## Agenda - -Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting. - -* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105) -* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101) -* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102) -* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99) - -## Minutes - -### adopt a charter - -* group: +1's all around - -### What versioning scheme should be adopted? -* group: +1’s 3.0.0 -* domenic+group: pulling in patches from other sources where appropriate -* mikeal: version independently, suggesting versions for io.js -* mikeal+domenic: work with TC to notify in advance of changes -simpler stream creation - -### streamline creation of streams -* sam: streamline creation of streams -* domenic: nice simple solution posted - but, we lose the opportunity to change the model - may not be backwards incompatible (double check keys) - - **action item:** domenic will check - -### remove implicit flowing of streams on(‘data’) -* add isFlowing / isPaused -* mikeal: worrying that we’re documenting polyfill methods – confuses users -* domenic: more reflective API is probably good, with warning labels for users -* new section for mad scientists (reflective stream access) -* calvin: name the “third state” -* mikeal: maybe borrow the name from whatwg? -* domenic: we’re missing the “third state” -* consensus: kind of difficult to name the third state -* mikeal: figure out differences in states / compat -* mathias: always flow on data – eliminates third state - * explore what it breaks - -**action items:** -* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream) -* ask rod/build for infrastructure -* **chris**: explore the “flow on data” approach -* add isPaused/isFlowing -* add new docs section -* move isPaused to that section diff --git a/tools/eslint/node_modules/readable-stream/lib/_stream_duplex.js b/tools/eslint/node_modules/readable-stream/lib/_stream_duplex.js index 69558af037cd66..736693b8400fed 100644 --- a/tools/eslint/node_modules/readable-stream/lib/_stream_duplex.js +++ b/tools/eslint/node_modules/readable-stream/lib/_stream_duplex.js @@ -6,22 +6,21 @@ 'use strict'; /**/ + var objectKeys = Object.keys || function (obj) { var keys = []; - for (var key in obj) keys.push(key); - return keys; -} + for (var key in obj) { + keys.push(key); + }return keys; +}; /**/ - module.exports = Duplex; /**/ var processNextTick = require('process-nextick-args'); /**/ - - /**/ var util = require('core-util-is'); util.inherits = require('inherits'); @@ -35,26 +34,21 @@ util.inherits(Duplex, Readable); var keys = objectKeys(Writable.prototype); for (var v = 0; v < keys.length; v++) { var method = keys[v]; - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; } function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); + if (!(this instanceof Duplex)) return new Duplex(options); Readable.call(this, options); Writable.call(this, options); - if (options && options.readable === false) - this.readable = false; + if (options && options.readable === false) this.readable = false; - if (options && options.writable === false) - this.writable = false; + if (options && options.writable === false) this.writable = false; this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; this.once('end', onend); } @@ -63,8 +57,7 @@ function Duplex(options) { function onend() { // if we allow half-open state, or if the writable side ended, // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; + if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written. // But allow more writes to happen in this tick. @@ -75,8 +68,8 @@ function onEndNT(self) { self.end(); } -function forEach (xs, f) { +function forEach(xs, f) { for (var i = 0, l = xs.length; i < l; i++) { f(xs[i], i); } -} +} \ No newline at end of file diff --git a/tools/eslint/node_modules/readable-stream/lib/_stream_passthrough.js b/tools/eslint/node_modules/readable-stream/lib/_stream_passthrough.js index bddfdd01537a40..d06f71f1868d77 100644 --- a/tools/eslint/node_modules/readable-stream/lib/_stream_passthrough.js +++ b/tools/eslint/node_modules/readable-stream/lib/_stream_passthrough.js @@ -16,12 +16,11 @@ util.inherits = require('inherits'); util.inherits(PassThrough, Transform); function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); + if (!(this instanceof PassThrough)) return new PassThrough(options); Transform.call(this, options); } -PassThrough.prototype._transform = function(chunk, encoding, cb) { +PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); -}; +}; \ No newline at end of file diff --git a/tools/eslint/node_modules/readable-stream/lib/_stream_readable.js b/tools/eslint/node_modules/readable-stream/lib/_stream_readable.js index 50852aee7e6e02..54a9d5c553d69e 100644 --- a/tools/eslint/node_modules/readable-stream/lib/_stream_readable.js +++ b/tools/eslint/node_modules/readable-stream/lib/_stream_readable.js @@ -6,12 +6,10 @@ module.exports = Readable; var processNextTick = require('process-nextick-args'); /**/ - /**/ var isArray = require('isarray'); /**/ - /**/ var Buffer = require('buffer').Buffer; /**/ @@ -21,21 +19,20 @@ Readable.ReadableState = ReadableState; var EE = require('events'); /**/ -var EElistenerCount = function(emitter, type) { +var EElistenerCount = function (emitter, type) { return emitter.listeners(type).length; }; /**/ - - /**/ var Stream; -(function (){try{ - Stream = require('st' + 'ream'); -}catch(_){}finally{ - if (!Stream) - Stream = require('events').EventEmitter; -}}()) +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); /**/ var Buffer = require('buffer').Buffer; @@ -45,11 +42,9 @@ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ - - /**/ var debugUtil = require('util'); -var debug; +var debug = undefined; if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); } else { @@ -71,17 +66,16 @@ function ReadableState(options, stream) { // make all the buffer merging and length checks go away this.objectMode = !!options.objectMode; - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer // Note: 0 is a valid value, means "don't call _read preemptively ever" var hwm = options.highWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; // cast to ints. - this.highWaterMark = ~~this.highWaterMark; + this.highWaterMark = ~ ~this.highWaterMark; this.buffer = []; this.length = 0; @@ -103,6 +97,7 @@ function ReadableState(options, stream) { this.needReadable = false; this.emittedReadable = false; this.readableListening = false; + this.resumeScheduled = false; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. @@ -122,8 +117,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -133,16 +127,14 @@ var Duplex; function Readable(options) { Duplex = Duplex || require('./_stream_duplex'); - if (!(this instanceof Readable)) - return new Readable(options); + if (!(this instanceof Readable)) return new Readable(options); this._readableState = new ReadableState(options, this); // legacy this.readable = true; - if (options && typeof options.read === 'function') - this._read = options.read; + if (options && typeof options.read === 'function') this._read = options.read; Stream.call(this); } @@ -151,7 +143,7 @@ function Readable(options) { // This returns true if the highWaterMark has not been hit yet, // similar to how Writable.write() returns true if you should // write() some more. -Readable.prototype.push = function(chunk, encoding) { +Readable.prototype.push = function (chunk, encoding) { var state = this._readableState; if (!state.objectMode && typeof chunk === 'string') { @@ -166,12 +158,12 @@ Readable.prototype.push = function(chunk, encoding) { }; // Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function(chunk) { +Readable.prototype.unshift = function (chunk) { var state = this._readableState; return readableAddChunk(this, state, chunk, '', true); }; -Readable.prototype.isPaused = function() { +Readable.prototype.isPaused = function () { return this._readableState.flowing === false; }; @@ -190,26 +182,28 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { var e = new Error('stream.unshift() after end event'); stream.emit('error', e); } else { - if (state.decoder && !addToFront && !encoding) + var skipAdd; + if (state.decoder && !addToFront && !encoding) { chunk = state.decoder.write(chunk); + skipAdd = !state.objectMode && chunk.length === 0; + } - if (!addToFront) - state.reading = false; - - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - - if (state.needReadable) - emitReadable(stream); + if (!addToFront) state.reading = false; + + // Don't add to the buffer if we've decoded to an empty string chunk and + // we're not in object mode + if (!skipAdd) { + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } } maybeReadMore(stream, state); @@ -221,7 +215,6 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { return needMoreData(state); } - // if it's past the high water mark, we can push in some more. // Also, if we have no data yet, we can stand some // more bytes. This is to work around cases where hwm=0, @@ -230,16 +223,12 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { // needReadable was set, then we ought to push more, so that another // 'readable' event will be triggered. function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); } // backwards compatibility. -Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -264,29 +253,22 @@ function computeNewHighWaterMark(n) { } function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; + if (state.length === 0 && state.ended) return 0; - if (state.objectMode) - return n === 0 ? 0 : 1; + if (state.objectMode) return n === 0 ? 0 : 1; if (n === null || isNaN(n)) { // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; + if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length; } - if (n <= 0) - return 0; + if (n <= 0) return 0; // If we're asking for more than the target buffer level, // then raise the water mark. Bump up to the next highest // power of 2, to prevent increasing it excessively in tiny // amounts. - if (n > state.highWaterMark) - state.highWaterMark = computeNewHighWaterMark(n); + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); // don't have that much. return null, unless we've ended. if (n > state.length) { @@ -302,25 +284,19 @@ function howMuchToRead(n, state) { } // you can override either this method, or the async _read(n) below. -Readable.prototype.read = function(n) { +Readable.prototype.read = function (n) { debug('read', n); var state = this._readableState; var nOrig = n; - if (typeof n !== 'number' || n > 0) - state.emittedReadable = false; + if (typeof n !== 'number' || n > 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we // already have a bunch of data in the buffer, then just trigger // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); return null; } @@ -328,8 +304,7 @@ Readable.prototype.read = function(n) { // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); + if (state.length === 0) endReadable(this); return null; } @@ -377,8 +352,7 @@ Readable.prototype.read = function(n) { state.reading = true; state.sync = true; // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; + if (state.length === 0) state.needReadable = true; // call internal read method this._read(state.highWaterMark); state.sync = false; @@ -386,14 +360,10 @@ Readable.prototype.read = function(n) { // If _read pushed data synchronously, then `reading` will be false, // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); + if (doRead && !state.reading) n = howMuchToRead(nOrig, state); var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; + if (n > 0) ret = fromList(n, state);else ret = null; if (ret === null) { state.needReadable = true; @@ -404,32 +374,24 @@ Readable.prototype.read = function(n) { // If we have nothing in the buffer, then we want to know // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; + if (state.length === 0 && !state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) - endReadable(this); + if (nOrig !== n && state.ended && state.length === 0) endReadable(this); - if (ret !== null) - this.emit('data', ret); + if (ret !== null) this.emit('data', ret); return ret; }; function chunkInvalid(state, chunk) { var er = null; - if (!(Buffer.isBuffer(chunk)) && - typeof chunk !== 'string' && - chunk !== null && - chunk !== undefined && - !state.objectMode) { + if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } return er; } - function onEofChunk(stream, state) { if (state.ended) return; if (state.decoder) { @@ -454,10 +416,7 @@ function emitReadable(stream) { if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; - if (state.sync) - processNextTick(emitReadable_, stream); - else - emitReadable_(stream); + if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); } } @@ -467,7 +426,6 @@ function emitReadable_(stream) { flow(stream); } - // at this point, the user has presumably seen the 'readable' event, // and called read() to consume some data. that may have triggered // in turn another _read(n) call, in which case reading = true if @@ -483,15 +441,12 @@ function maybeReadMore(stream, state) { function maybeReadMore_(stream, state) { var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { debug('maybeReadMore read 0'); stream.read(0); if (len === state.length) // didn't get any data, stop spinning. - break; - else - len = state.length; + break;else len = state.length; } state.readingMore = false; } @@ -500,11 +455,11 @@ function maybeReadMore_(stream, state) { // call cb(er, data) where data is <= n in length. // for virtual (non-string, non-buffer) streams, "length" is somewhat // arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function(n) { +Readable.prototype._read = function (n) { this.emit('error', new Error('not implemented')); }; -Readable.prototype.pipe = function(dest, pipeOpts) { +Readable.prototype.pipe = function (dest, pipeOpts) { var src = this; var state = this._readableState; @@ -522,15 +477,10 @@ Readable.prototype.pipe = function(dest, pipeOpts) { state.pipesCount += 1; debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - processNextTick(endFn); - else - src.once('end', endFn); + if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); function onunpipe(readable) { @@ -572,9 +522,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { // flowing again. // So, if this is awaiting a drain, then we just call it now. // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && - (!dest._writableState || dest._writableState.needDrain)) - ondrain(); + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); } src.on('data', ondata); @@ -585,10 +533,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write // also returned false. - if (state.pipesCount === 1 && - state.pipes[0] === dest && - src.listenerCount('data') === 1 && - !cleanedUp) { + if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) { debug('false write response, pause', src._readableState.awaitDrain); src._readableState.awaitDrain++; } @@ -602,18 +547,11 @@ Readable.prototype.pipe = function(dest, pipeOpts) { debug('onerror', er); unpipe(); dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) - dest.emit('error', er); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); } // This is a brutally ugly hack to make sure that our error handler // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - + if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error]; // Both close and finish should trigger unpipe, but only once. function onclose() { @@ -646,11 +584,10 @@ Readable.prototype.pipe = function(dest, pipeOpts) { }; function pipeOnDrain(src) { - return function() { + return function () { var state = src._readableState; debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; + if (state.awaitDrain) state.awaitDrain--; if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { state.flowing = true; flow(src); @@ -658,29 +595,24 @@ function pipeOnDrain(src) { }; } - -Readable.prototype.unpipe = function(dest) { +Readable.prototype.unpipe = function (dest) { var state = this._readableState; // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; + if (state.pipesCount === 0) return this; // just one destination. most common case. if (state.pipesCount === 1) { // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; + if (dest && dest !== state.pipes) return this; - if (!dest) - dest = state.pipes; + if (!dest) dest = state.pipes; // got a match. state.pipes = null; state.pipesCount = 0; state.flowing = false; - if (dest) - dest.emit('unpipe', this); + if (dest) dest.emit('unpipe', this); return this; } @@ -694,20 +626,18 @@ Readable.prototype.unpipe = function(dest) { state.pipesCount = 0; state.flowing = false; - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; + for (var _i = 0; _i < len; _i++) { + dests[_i].emit('unpipe', this); + }return this; } // try to find the right one. var i = indexOf(state.pipes, dest); - if (i === -1) - return this; + if (i === -1) return this; state.pipes.splice(i, 1); state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; dest.emit('unpipe', this); @@ -716,7 +646,7 @@ Readable.prototype.unpipe = function(dest) { // set up data events if they are asked for // Ensure readable listeners eventually get something -Readable.prototype.on = function(ev, fn) { +Readable.prototype.on = function (ev, fn) { var res = Stream.prototype.on.call(this, ev, fn); // If listening to data, and it has not explicitly been paused, @@ -725,7 +655,7 @@ Readable.prototype.on = function(ev, fn) { this.resume(); } - if (ev === 'readable' && this.readable) { + if (ev === 'readable' && !this._readableState.endEmitted) { var state = this._readableState; if (!state.readableListening) { state.readableListening = true; @@ -750,7 +680,7 @@ function nReadingNextTick(self) { // pause() and resume() are remnants of the legacy readable stream API // If the user uses them, then switch into old mode. -Readable.prototype.resume = function() { +Readable.prototype.resume = function () { var state = this._readableState; if (!state.flowing) { debug('resume'); @@ -776,11 +706,10 @@ function resume_(stream, state) { state.resumeScheduled = false; stream.emit('resume'); flow(stream); - if (state.flowing && !state.reading) - stream.read(0); + if (state.flowing && !state.reading) stream.read(0); } -Readable.prototype.pause = function() { +Readable.prototype.pause = function () { debug('call pause flowing=%j', this._readableState.flowing); if (false !== this._readableState.flowing) { debug('pause'); @@ -803,32 +732,27 @@ function flow(stream) { // wrap an old-style stream as the async data source. // This is *not* part of the readable stream interface. // It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function(stream) { +Readable.prototype.wrap = function (stream) { var state = this._readableState; var paused = false; var self = this; - stream.on('end', function() { + stream.on('end', function () { debug('wrapped end'); if (state.decoder && !state.ended) { var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); + if (chunk && chunk.length) self.push(chunk); } self.push(null); }); - stream.on('data', function(chunk) { + stream.on('data', function (chunk) { debug('wrapped data'); - if (state.decoder) - chunk = state.decoder.write(chunk); + if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) - return; + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; var ret = self.push(chunk); if (!ret) { @@ -841,21 +765,23 @@ Readable.prototype.wrap = function(stream) { // important when wrapping filters and duplexes. for (var i in stream) { if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }; }(i); + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); } } // proxy certain important events. var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function(ev) { + forEach(events, function (ev) { stream.on(ev, self.emit.bind(self, ev)); }); // when we try to consume some more bytes, simply unpause the // underlying stream. - self._read = function(n) { + self._read = function (n) { debug('wrapped _read', n); if (paused) { paused = false; @@ -866,7 +792,6 @@ Readable.prototype.wrap = function(stream) { return self; }; - // exposed for testing purposes only. Readable._fromList = fromList; @@ -880,21 +805,11 @@ function fromList(n, state) { var ret; // nothing in the list, definitely empty. - if (list.length === 0) - return null; + if (list.length === 0) return null; - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { + if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) { // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else if (list.length === 1) - ret = list[0]; - else - ret = Buffer.concat(list, length); + if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length); list.length = 0; } else { // read just some of it. @@ -910,25 +825,16 @@ function fromList(n, state) { } else { // complex case. // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); + if (stringMode) ret = '';else ret = new Buffer(n); var c = 0; for (var i = 0, l = list.length; i < l && c < n; i++) { var buf = list[0]; var cpy = Math.min(n - c, buf.length); - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); + if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy); - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); + if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift(); c += cpy; } @@ -943,8 +849,7 @@ function endReadable(stream) { // If we get here before consuming all the bytes, then that is a // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); + if (state.length > 0) throw new Error('endReadable called on non-empty stream'); if (!state.endEmitted) { state.ended = true; @@ -961,15 +866,15 @@ function endReadableNT(state, stream) { } } -function forEach (xs, f) { +function forEach(xs, f) { for (var i = 0, l = xs.length; i < l; i++) { f(xs[i], i); } } -function indexOf (xs, x) { +function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } return -1; -} +} \ No newline at end of file diff --git a/tools/eslint/node_modules/readable-stream/lib/_stream_transform.js b/tools/eslint/node_modules/readable-stream/lib/_stream_transform.js index 3675d18d915610..625cdc17698059 100644 --- a/tools/eslint/node_modules/readable-stream/lib/_stream_transform.js +++ b/tools/eslint/node_modules/readable-stream/lib/_stream_transform.js @@ -53,9 +53,8 @@ util.inherits = require('inherits'); util.inherits(Transform, Duplex); - function TransformState(stream) { - this.afterTransform = function(er, data) { + this.afterTransform = function (er, data) { return afterTransform(stream, er, data); }; @@ -63,6 +62,7 @@ function TransformState(stream) { this.transforming = false; this.writecb = null; this.writechunk = null; + this.writeencoding = null; } function afterTransform(stream, er, data) { @@ -71,17 +71,14 @@ function afterTransform(stream, er, data) { var cb = ts.writecb; - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); + if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); ts.writechunk = null; ts.writecb = null; - if (data !== null && data !== undefined) - stream.push(data); + if (data !== null && data !== undefined) stream.push(data); - if (cb) - cb(er); + cb(er); var rs = stream._readableState; rs.reading = false; @@ -90,10 +87,8 @@ function afterTransform(stream, er, data) { } } - function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); + if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); @@ -111,24 +106,19 @@ function Transform(options) { this._readableState.sync = false; if (options) { - if (typeof options.transform === 'function') - this._transform = options.transform; + if (typeof options.transform === 'function') this._transform = options.transform; - if (typeof options.flush === 'function') - this._flush = options.flush; + if (typeof options.flush === 'function') this._flush = options.flush; } - this.once('prefinish', function() { - if (typeof this._flush === 'function') - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); + this.once('prefinish', function () { + if (typeof this._flush === 'function') this._flush(function (er) { + done(stream, er); + });else done(stream); }); } -Transform.prototype.push = function(chunk, encoding) { +Transform.prototype.push = function (chunk, encoding) { this._transformState.needTransform = false; return Duplex.prototype.push.call(this, chunk, encoding); }; @@ -143,28 +133,25 @@ Transform.prototype.push = function(chunk, encoding) { // Call `cb(err)` when you are done with this chunk. If you pass // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function(chunk, encoding, cb) { +Transform.prototype._transform = function (chunk, encoding, cb) { throw new Error('not implemented'); }; -Transform.prototype._write = function(chunk, encoding, cb) { +Transform.prototype._write = function (chunk, encoding, cb) { var ts = this._transformState; ts.writecb = cb; ts.writechunk = chunk; ts.writeencoding = encoding; if (!ts.transforming) { var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); } }; // Doesn't matter what the args are here. // _transform does all the work. // That we got here means that the readable side wants more data. -Transform.prototype._read = function(n) { +Transform.prototype._read = function (n) { var ts = this._transformState; if (ts.writechunk !== null && ts.writecb && !ts.transforming) { @@ -177,21 +164,17 @@ Transform.prototype._read = function(n) { } }; - function done(stream, er) { - if (er) - return stream.emit('error', er); + if (er) return stream.emit('error', er); // if there's nothing in the write buffer, then that means // that nothing more will ever be provided var ws = stream._writableState; var ts = stream._transformState; - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); + if (ws.length) throw new Error('calling transform done when ws.length != 0'); - if (ts.transforming) - throw new Error('calling transform done when still transforming'); + if (ts.transforming) throw new Error('calling transform done when still transforming'); return stream.push(null); -} +} \ No newline at end of file diff --git a/tools/eslint/node_modules/readable-stream/lib/_stream_writable.js b/tools/eslint/node_modules/readable-stream/lib/_stream_writable.js index 1fa5eb695adde6..95916c992a9507 100644 --- a/tools/eslint/node_modules/readable-stream/lib/_stream_writable.js +++ b/tools/eslint/node_modules/readable-stream/lib/_stream_writable.js @@ -10,6 +10,9 @@ module.exports = Writable; var processNextTick = require('process-nextick-args'); /**/ +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; +/**/ /**/ var Buffer = require('buffer').Buffer; @@ -17,29 +20,26 @@ var Buffer = require('buffer').Buffer; Writable.WritableState = WritableState; - /**/ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ - /**/ var internalUtil = { deprecate: require('util-deprecate') }; /**/ - - /**/ var Stream; -(function (){try{ - Stream = require('st' + 'ream'); -}catch(_){}finally{ - if (!Stream) - Stream = require('events').EventEmitter; -}}()) +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); /**/ var Buffer = require('buffer').Buffer; @@ -65,18 +65,17 @@ function WritableState(options, stream) { // contains buffers or objects. this.objectMode = !!options.objectMode; - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() var hwm = options.highWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; // cast to ints. - this.highWaterMark = ~~this.highWaterMark; + this.highWaterMark = ~ ~this.highWaterMark; this.needDrain = false; // at the start of calling end() @@ -120,7 +119,7 @@ function WritableState(options, stream) { this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { + this.onwrite = function (er) { onwrite(stream, er); }; @@ -143,6 +142,14 @@ function WritableState(options, stream) { // True if the error was already emitted and should not be thrown again this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // create the two objects needed to store the corked requests + // they are not a linked list, as no new elements are inserted in there + this.corkedRequestsFree = new CorkedRequest(this); + this.corkedRequestsFree.next = new CorkedRequest(this); } WritableState.prototype.getBuffer = function writableStateGetBuffer() { @@ -155,15 +162,15 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() { return out; }; -(function (){try { -Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function() { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + - 'instead.') -}); -}catch(_){}}()); - +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') + }); + } catch (_) {} +})(); var Duplex; function Writable(options) { @@ -171,8 +178,7 @@ function Writable(options) { // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) - return new Writable(options); + if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); this._writableState = new WritableState(options, this); @@ -180,22 +186,19 @@ function Writable(options) { this.writable = true; if (options) { - if (typeof options.write === 'function') - this._write = options.write; + if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') - this._writev = options.writev; + if (typeof options.writev === 'function') this._writev = options.writev; } Stream.call(this); } // Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function() { +Writable.prototype.pipe = function () { this.emit('error', new Error('Cannot pipe. Not readable.')); }; - function writeAfterEnd(stream, cb) { var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb @@ -211,11 +214,7 @@ function writeAfterEnd(stream, cb) { function validChunk(stream, state, chunk, cb) { var valid = true; - if (!(Buffer.isBuffer(chunk)) && - typeof chunk !== 'string' && - chunk !== null && - chunk !== undefined && - !state.objectMode) { + if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { var er = new TypeError('Invalid non-string/buffer chunk'); stream.emit('error', er); processNextTick(cb, er); @@ -224,7 +223,7 @@ function validChunk(stream, state, chunk, cb) { return valid; } -Writable.prototype.write = function(chunk, encoding, cb) { +Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState; var ret = false; @@ -233,17 +232,11 @@ Writable.prototype.write = function(chunk, encoding, cb) { encoding = null; } - if (Buffer.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; + if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') - cb = nop; + if (typeof cb !== 'function') cb = nop; - if (state.ended) - writeAfterEnd(this, cb); - else if (validChunk(this, state, chunk, cb)) { + if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { state.pendingcb++; ret = writeOrBuffer(this, state, chunk, encoding, cb); } @@ -251,42 +244,31 @@ Writable.prototype.write = function(chunk, encoding, cb) { return ret; }; -Writable.prototype.cork = function() { +Writable.prototype.cork = function () { var state = this._writableState; state.corked++; }; -Writable.prototype.uncork = function() { +Writable.prototype.uncork = function () { var state = this._writableState; if (state.corked) { state.corked--; - if (!state.writing && - !state.corked && - !state.finished && - !state.bufferProcessing && - state.bufferedRequest) - clearBuffer(this, state); + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); } }; Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') - encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', -'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw'] -.indexOf((encoding + '').toLowerCase()) > -1)) - throw new TypeError('Unknown encoding: ' + encoding); + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); this._writableState.defaultEncoding = encoding; }; function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - typeof chunk === 'string') { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { chunk = new Buffer(chunk, encoding); } return chunk; @@ -298,16 +280,14 @@ function decodeChunk(state, chunk, encoding) { function writeOrBuffer(stream, state, chunk, encoding, cb) { chunk = decodeChunk(state, chunk, encoding); - if (Buffer.isBuffer(chunk)) - encoding = 'buffer'; + if (Buffer.isBuffer(chunk)) encoding = 'buffer'; var len = state.objectMode ? 1 : chunk.length; state.length += len; var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. - if (!ret) - state.needDrain = true; + if (!ret) state.needDrain = true; if (state.writing || state.corked) { var last = state.lastBufferedRequest; @@ -317,6 +297,7 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) { } else { state.bufferedRequest = state.lastBufferedRequest; } + state.bufferedRequestCount += 1; } else { doWrite(stream, state, false, len, chunk, encoding, cb); } @@ -329,19 +310,13 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) { state.writecb = cb; state.writing = true; state.sync = true; - if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); state.sync = false; } function onwriteError(stream, state, sync, er, cb) { --state.pendingcb; - if (sync) - processNextTick(cb, er); - else - cb(er); + if (sync) processNextTick(cb, er);else cb(er); stream._writableState.errorEmitted = true; stream.emit('error', er); @@ -361,30 +336,26 @@ function onwrite(stream, er) { onwriteStateUpdate(state); - if (er) - onwriteError(stream, state, sync, er, cb); - else { + if (er) onwriteError(stream, state, sync, er, cb);else { // Check if we're actually ready to finish, but don't emit yet var finished = needFinish(state); - if (!finished && - !state.corked && - !state.bufferProcessing && - state.bufferedRequest) { + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { clearBuffer(stream, state); } if (sync) { - processNextTick(afterWrite, stream, state, finished, cb); + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ } else { - afterWrite(stream, state, finished, cb); - } + afterWrite(stream, state, finished, cb); + } } } function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); + if (!finished) onwriteDrain(stream, state); state.pendingcb--; cb(); finishMaybe(stream, state); @@ -400,7 +371,6 @@ function onwriteDrain(stream, state) { } } - // if there's something in the buffer waiting, then process it function clearBuffer(stream, state) { state.bufferProcessing = true; @@ -408,26 +378,26 @@ function clearBuffer(stream, state) { if (stream._writev && entry && entry.next) { // Fast case, write everything using _writev() - var buffer = []; - var cbs = []; + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; while (entry) { - cbs.push(entry.callback); - buffer.push(entry); + buffer[count] = entry; entry = entry.next; + count += 1; } - // count the one we are adding, as well. - // TODO(isaacs) clean this up + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is always async, defer these to save a bit of time + // as the hot path ends with doWrite state.pendingcb++; state.lastBufferedRequest = null; - doWrite(stream, state, true, state.length, buffer, '', function(err) { - for (var i = 0; i < cbs.length; i++) { - state.pendingcb--; - cbs[i](err); - } - }); - - // Clear buffer + state.corkedRequestsFree = holder.next; + holder.next = null; } else { // Slow case, write chunks one-by-one while (entry) { @@ -447,20 +417,21 @@ function clearBuffer(stream, state) { } } - if (entry === null) - state.lastBufferedRequest = null; + if (entry === null) state.lastBufferedRequest = null; } + + state.bufferedRequestCount = 0; state.bufferedRequest = entry; state.bufferProcessing = false; } -Writable.prototype._write = function(chunk, encoding, cb) { +Writable.prototype._write = function (chunk, encoding, cb) { cb(new Error('not implemented')); }; Writable.prototype._writev = null; -Writable.prototype.end = function(chunk, encoding, cb) { +Writable.prototype.end = function (chunk, encoding, cb) { var state = this._writableState; if (typeof chunk === 'function') { @@ -472,8 +443,7 @@ Writable.prototype.end = function(chunk, encoding, cb) { encoding = null; } - if (chunk !== null && chunk !== undefined) - this.write(chunk, encoding); + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks if (state.corked) { @@ -482,17 +452,11 @@ Writable.prototype.end = function(chunk, encoding, cb) { } // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); + if (!state.ending && !state.finished) endWritable(this, state, cb); }; - function needFinish(state) { - return (state.ending && - state.length === 0 && - state.bufferedRequest === null && - !state.finished && - !state.writing); + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; } function prefinish(stream, state) { @@ -520,10 +484,33 @@ function endWritable(stream, state, cb) { state.ending = true; finishMaybe(stream, state); if (cb) { - if (state.finished) - processNextTick(cb); - else - stream.once('finish', cb); + if (state.finished) processNextTick(cb);else stream.once('finish', cb); } state.ended = true; + stream.writable = false; } + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + + this.finish = function (err) { + var entry = _this.entry; + _this.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = _this; + } else { + state.corkedRequestsFree = _this; + } + }; +} \ No newline at end of file diff --git a/tools/eslint/node_modules/readable-stream/package.json b/tools/eslint/node_modules/readable-stream/package.json index 3e0a2b06d407d3..12395c98278800 100644 --- a/tools/eslint/node_modules/readable-stream/package.json +++ b/tools/eslint/node_modules/readable-stream/package.json @@ -2,20 +2,24 @@ "_args": [ [ "readable-stream@~2.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/concat-stream" + "/Users/silverwind/git/node/tools/package/package/node_modules/concat-stream" ] ], "_from": "readable-stream@>=2.0.0 <2.1.0", - "_id": "readable-stream@2.0.5", + "_id": "readable-stream@2.0.6", "_inCache": true, "_installable": true, - "_location": "/eslint/readable-stream", - "_nodeVersion": "5.1.1", + "_location": "/readable-stream", + "_nodeVersion": "5.7.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/readable-stream-2.0.6.tgz_1457893507709_0.369257491780445" + }, "_npmUser": { "email": "calvin.metcalf@gmail.com", "name": "cwmma" }, - "_npmVersion": "3.3.12", + "_npmVersion": "3.6.0", "_phantomChildren": {}, "_requested": { "name": "readable-stream", @@ -26,13 +30,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/concat-stream" + "/concat-stream" ], - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.5.tgz", - "_shasum": "a2426f8dcd4551c77a33f96edf2886a23c829669", + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "_shasum": "8f90341e68a53ccc928788dacfcd11b36eb9b78e", "_shrinkwrap": null, "_spec": "readable-stream@~2.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/concat-stream", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/concat-stream", "browser": { "util": false }, @@ -42,47 +46,47 @@ "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", - "isarray": "0.0.1", + "isarray": "~1.0.0", "process-nextick-args": "~1.0.6", "string_decoder": "~0.10.x", "util-deprecate": "~1.0.1" }, - "description": "Streams3, a user-land copy of the stream library from iojs v2.x", + "description": "Streams3, a user-land copy of the stream library from Node.js", "devDependencies": { "tap": "~0.2.6", - "tape": "~4.0.0", - "zuul": "~3.0.0" + "tape": "~4.5.1", + "zuul": "~3.9.0" }, "directories": {}, "dist": { - "shasum": "a2426f8dcd4551c77a33f96edf2886a23c829669", - "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.5.tgz" + "shasum": "8f90341e68a53ccc928788dacfcd11b36eb9b78e", + "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz" }, - "gitHead": "a4f23d8e451267684a8160679ce16e16149fe72b", + "gitHead": "01fb5608a970b42c900b96746cadc13d27dd9d7e", "homepage": "https://github.com/nodejs/readable-stream#readme", "keywords": [ + "pipe", "readable", - "stream", - "pipe" + "stream" ], "license": "MIT", "main": "readable.js", "maintainers": [ { - "email": "isaacs@npmjs.com", - "name": "isaacs" + "name": "isaacs", + "email": "isaacs@npmjs.com" }, { - "email": "nathan@tootallnate.net", - "name": "tootallnate" + "name": "tootallnate", + "email": "nathan@tootallnate.net" }, { - "email": "rod@vagg.org", - "name": "rvagg" + "name": "rvagg", + "email": "rod@vagg.org" }, { - "email": "calvin.metcalf@gmail.com", - "name": "cwmma" + "name": "cwmma", + "email": "calvin.metcalf@gmail.com" } ], "name": "readable-stream", @@ -94,8 +98,8 @@ }, "scripts": { "browser": "npm run write-zuul && zuul -- test/browser.js", - "test": "tap test/parallel/*.js", + "test": "tap test/parallel/*.js test/ours/*.js", "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml" }, - "version": "2.0.5" + "version": "2.0.6" } diff --git a/tools/eslint/node_modules/readline2/package.json b/tools/eslint/node_modules/readline2/package.json index 6c0e6ea166fe1c..2330090a4c2dfc 100644 --- a/tools/eslint/node_modules/readline2/package.json +++ b/tools/eslint/node_modules/readline2/package.json @@ -2,14 +2,14 @@ "_args": [ [ "readline2@^1.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/inquirer" + "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer" ] ], "_from": "readline2@>=1.0.1 <2.0.0", "_id": "readline2@1.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/readline2", + "_location": "/readline2", "_nodeVersion": "0.12.5", "_npmUser": { "email": "admin@simonboudrias.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/inquirer" + "/inquirer" ], "_resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", "_shasum": "41059608ffc154757b715d9989d199ffbf372e35", "_shrinkwrap": null, "_spec": "readline2@^1.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/inquirer", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer", "author": { "email": "admin@simonboudrias.com", "name": "Simon Boudrias" @@ -62,17 +62,17 @@ "gitHead": "32aa9851e2cbb0610364d5009165be6fb2fed4ef", "homepage": "https://github.com/sboudrias/readline2#readme", "keywords": [ + "ansi", "cli", - "terminal", "readline", - "tty", - "ansi" + "terminal", + "tty" ], "license": "MIT", "maintainers": [ { - "email": "admin@simonboudrias.com", - "name": "sboudrias" + "name": "sboudrias", + "email": "admin@simonboudrias.com" } ], "name": "readline2", diff --git a/tools/eslint/node_modules/require-uncached/index.js b/tools/eslint/node_modules/require-uncached/index.js new file mode 100644 index 00000000000000..eaabd49c3fdc03 --- /dev/null +++ b/tools/eslint/node_modules/require-uncached/index.js @@ -0,0 +1,18 @@ +'use strict'; +var path = require('path'); +var resolveFrom = require('resolve-from'); +var callerPath = require('caller-path'); + +module.exports = function (moduleId) { + if (typeof moduleId !== 'string') { + throw new TypeError('Expected a string'); + } + + var filePath = resolveFrom(path.dirname(callerPath()), moduleId); + var tmp = require.cache[filePath]; + delete require.cache[filePath]; + var ret = require(filePath); + require.cache[filePath] = tmp; + + return ret; +}; diff --git a/tools/eslint/node_modules/require-uncached/package.json b/tools/eslint/node_modules/require-uncached/package.json new file mode 100644 index 00000000000000..c08f560d49352f --- /dev/null +++ b/tools/eslint/node_modules/require-uncached/package.json @@ -0,0 +1,90 @@ +{ + "_args": [ + [ + "require-uncached@^1.0.2", + "/Users/silverwind/git/node/tools/package/package" + ] + ], + "_from": "require-uncached@>=1.0.2 <2.0.0", + "_id": "require-uncached@1.0.2", + "_inCache": true, + "_installable": true, + "_location": "/require-uncached", + "_npmUser": { + "email": "sindresorhus@gmail.com", + "name": "sindresorhus" + }, + "_npmVersion": "1.4.9", + "_phantomChildren": {}, + "_requested": { + "name": "require-uncached", + "raw": "require-uncached@^1.0.2", + "rawSpec": "^1.0.2", + "scope": null, + "spec": ">=1.0.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.2.tgz", + "_shasum": "67dad3b733089e77030124678a459589faf6a7ec", + "_shrinkwrap": null, + "_spec": "require-uncached@^1.0.2", + "_where": "/Users/silverwind/git/node/tools/package/package", + "author": { + "email": "sindresorhus@gmail.com", + "name": "Sindre Sorhus", + "url": "http://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/require-uncached/issues" + }, + "dependencies": { + "caller-path": "^0.1.0", + "resolve-from": "^1.0.0" + }, + "description": "Require a module bypassing the cache", + "devDependencies": { + "ava": "0.0.3" + }, + "directories": {}, + "dist": { + "shasum": "67dad3b733089e77030124678a459589faf6a7ec", + "tarball": "http://registry.npmjs.org/require-uncached/-/require-uncached-1.0.2.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/require-uncached", + "keywords": [ + "bypass", + "cache", + "fresh", + "module", + "require", + "uncache", + "uncached" + ], + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "require-uncached", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/sindresorhus/require-uncached.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.2" +} diff --git a/tools/eslint/node_modules/require-uncached/readme.md b/tools/eslint/node_modules/require-uncached/readme.md new file mode 100644 index 00000000000000..13104be14acea5 --- /dev/null +++ b/tools/eslint/node_modules/require-uncached/readme.md @@ -0,0 +1,44 @@ +# require-uncached [![Build Status](https://travis-ci.org/sindresorhus/require-uncached.svg?branch=master)](https://travis-ci.org/sindresorhus/require-uncached) + +> Require a module bypassing the [cache](http://nodejs.org/api/modules.html#modules_caching) + +Useful for testing purposes when you need to freshly require a module. + + +## Install + +```sh +$ npm install --save require-uncached +``` + + +## Usage + +```js +// foo.js +var i = 0; +module.exports = function () { + return ++i; +}; +``` + +```js +var requireUncached = require('require-uncached'); + +require('./foo')(); +//=> 1 + +require('./foo')(); +//=> 2 + +requireUncached('./foo')(); +//=> 1 + +requireUncached('./foo')(); +//=> 1 +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/tools/eslint/node_modules/resolve-from/index.js b/tools/eslint/node_modules/resolve-from/index.js new file mode 100644 index 00000000000000..9162f4acf31bef --- /dev/null +++ b/tools/eslint/node_modules/resolve-from/index.js @@ -0,0 +1,19 @@ +'use strict'; +var path = require('path'); +var Module = require('module'); + +module.exports = function (fromDir, moduleId) { + if (typeof fromDir !== 'string' || typeof moduleId !== 'string') { + throw new TypeError('Expected `fromDir` and `moduleId` to be a string'); + } + + fromDir = path.resolve(fromDir); + + var fromFile = path.join(fromDir, 'noop.js'); + + return Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDir) + }); +}; diff --git a/tools/eslint/node_modules/resolve-from/license b/tools/eslint/node_modules/resolve-from/license new file mode 100644 index 00000000000000..654d0bfe943437 --- /dev/null +++ b/tools/eslint/node_modules/resolve-from/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/resolve-from/package.json b/tools/eslint/node_modules/resolve-from/package.json new file mode 100644 index 00000000000000..4f850d23ea6d2a --- /dev/null +++ b/tools/eslint/node_modules/resolve-from/package.json @@ -0,0 +1,90 @@ +{ + "_args": [ + [ + "resolve-from@^1.0.0", + "/Users/silverwind/git/node/tools/package/package/node_modules/require-uncached" + ] + ], + "_from": "resolve-from@>=1.0.0 <2.0.0", + "_id": "resolve-from@1.0.1", + "_inCache": true, + "_installable": true, + "_location": "/resolve-from", + "_nodeVersion": "4.1.1", + "_npmUser": { + "email": "sindresorhus@gmail.com", + "name": "sindresorhus" + }, + "_npmVersion": "2.14.4", + "_phantomChildren": {}, + "_requested": { + "name": "resolve-from", + "raw": "resolve-from@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/require-uncached" + ], + "_resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "_shasum": "26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226", + "_shrinkwrap": null, + "_spec": "resolve-from@^1.0.0", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/require-uncached", + "author": { + "email": "sindresorhus@gmail.com", + "name": "Sindre Sorhus", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/resolve-from/issues" + }, + "dependencies": {}, + "description": "Resolve the path of a module like require.resolve() but from a given path", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "directories": {}, + "dist": { + "shasum": "26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226", + "tarball": "http://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "bae2cf1d66c616ad2eb27e0fe85a10ff0f2dfc92", + "homepage": "https://github.com/sindresorhus/resolve-from", + "keywords": [ + "from", + "like", + "module", + "path", + "path", + "require", + "resolve" + ], + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "resolve-from", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/resolve-from.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.1" +} diff --git a/tools/eslint/node_modules/resolve-from/readme.md b/tools/eslint/node_modules/resolve-from/readme.md new file mode 100644 index 00000000000000..80a240c48762e3 --- /dev/null +++ b/tools/eslint/node_modules/resolve-from/readme.md @@ -0,0 +1,56 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](http://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + + +## Install + +``` +$ npm install --save resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// there's a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDir, moduleId) + +#### fromDir + +Type: `string` + +The directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to require from the same `fromDir` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/tools/eslint/node_modules/resolve/.travis.yml b/tools/eslint/node_modules/resolve/.travis.yml deleted file mode 100644 index 895dbd36234210..00000000000000 --- a/tools/eslint/node_modules/resolve/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 diff --git a/tools/eslint/node_modules/resolve/LICENSE b/tools/eslint/node_modules/resolve/LICENSE deleted file mode 100644 index ee27ba4b4412b0..00000000000000 --- a/tools/eslint/node_modules/resolve/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/resolve/example/async.js b/tools/eslint/node_modules/resolve/example/async.js deleted file mode 100644 index 6624ff7268f409..00000000000000 --- a/tools/eslint/node_modules/resolve/example/async.js +++ /dev/null @@ -1,5 +0,0 @@ -var resolve = require('../'); -resolve('tap', { basedir: __dirname }, function (err, res) { - if (err) console.error(err) - else console.log(res) -}); diff --git a/tools/eslint/node_modules/resolve/example/sync.js b/tools/eslint/node_modules/resolve/example/sync.js deleted file mode 100644 index 54b2cc1004223d..00000000000000 --- a/tools/eslint/node_modules/resolve/example/sync.js +++ /dev/null @@ -1,3 +0,0 @@ -var resolve = require('../'); -var res = resolve.sync('tap', { basedir: __dirname }); -console.log(res); diff --git a/tools/eslint/node_modules/resolve/index.js b/tools/eslint/node_modules/resolve/index.js deleted file mode 100644 index 51f194b4ca7adb..00000000000000 --- a/tools/eslint/node_modules/resolve/index.js +++ /dev/null @@ -1,5 +0,0 @@ -var core = require('./lib/core'); -exports = module.exports = require('./lib/async'); -exports.core = core; -exports.isCore = function (x) { return core[x] }; -exports.sync = require('./lib/sync'); diff --git a/tools/eslint/node_modules/resolve/lib/async.js b/tools/eslint/node_modules/resolve/lib/async.js deleted file mode 100644 index fd7f4e5e5c2d02..00000000000000 --- a/tools/eslint/node_modules/resolve/lib/async.js +++ /dev/null @@ -1,192 +0,0 @@ -var core = require('./core'); -var fs = require('fs'); -var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\//; - -module.exports = function resolve (x, opts, cb) { - if (typeof opts === 'function') { - cb = opts; - opts = {}; - } - if (!opts) opts = {}; - if (typeof x !== 'string') { - return process.nextTick(function () { - cb(new Error('path must be a string')); - }); - } - - var isFile = opts.isFile || function (file, cb) { - fs.stat(file, function (err, stat) { - if (err && err.code === 'ENOENT') cb(null, false) - else if (err) cb(err) - else cb(null, stat.isFile() || stat.isFIFO()) - }); - }; - var readFile = opts.readFile || fs.readFile; - - var extensions = opts.extensions || [ '.js' ]; - var y = opts.basedir || path.dirname(caller()); - - opts.paths = opts.paths || []; - - if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/.test(x)) { - var res = path.resolve(y, x); - if (x === '..') res += '/'; - if (/\/$/.test(x) && res === y) { - loadAsDirectory(res, opts.package, onfile); - } - else loadAsFile(res, opts.package, onfile); - } - else loadNodeModules(x, y, function (err, n, pkg) { - if (err) cb(err) - else if (n) cb(null, n, pkg) - else if (core[x]) return cb(null, x); - else cb(new Error("Cannot find module '" + x + "' from '" + y + "'")) - }); - - function onfile (err, m, pkg) { - if (err) cb(err) - else if (m) cb(null, m, pkg) - else loadAsDirectory(res, function (err, d, pkg) { - if (err) cb(err) - else if (d) cb(null, d, pkg) - else cb(new Error("Cannot find module '" + x + "' from '" + y + "'")) - }) - } - - function loadAsFile (x, pkg, cb) { - if (typeof pkg === 'function') { - cb = pkg; - pkg = undefined; - } - - var exts = [''].concat(extensions); - load(exts, x, pkg) - - function load (exts, x, pkg) { - if (exts.length === 0) return cb(null, undefined, pkg); - var file = x + exts[0]; - - if (pkg) onpkg(null, pkg) - else loadpkg(path.dirname(file), onpkg); - - function onpkg (err, pkg_, dir) { - pkg = pkg_; - if (err) return cb(err) - if (dir && pkg && opts.pathFilter) { - var rfile = path.relative(dir, file); - var rel = rfile.slice(0, rfile.length - exts[0].length); - var r = opts.pathFilter(pkg, x, rel); - if (r) return load( - [''].concat(extensions.slice()), - path.resolve(dir, r), - pkg - ); - } - isFile(file, onex); - } - function onex (err, ex) { - if (err) cb(err) - else if (!ex) load(exts.slice(1), x, pkg) - else cb(null, file, pkg) - } - } - } - - function loadpkg (dir, cb) { - if (dir === '' || dir === '/') return cb(null); - if (process.platform === 'win32' && /^\w:[\\\/]*$/.test(dir)) { - return cb(null); - } - if (/[\\\/]node_modules[\\\/]*$/.test(dir)) return cb(null); - - var pkgfile = path.join(dir, 'package.json'); - isFile(pkgfile, function (err, ex) { - // on err, ex is false - if (!ex) return loadpkg( - path.dirname(dir), cb - ); - - readFile(pkgfile, function (err, body) { - if (err) cb(err); - try { var pkg = JSON.parse(body) } - catch (err) {} - - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - cb(null, pkg, dir); - }); - }); - } - - function loadAsDirectory (x, fpkg, cb) { - if (typeof fpkg === 'function') { - cb = fpkg; - fpkg = opts.package; - } - - var pkgfile = path.join(x, '/package.json'); - isFile(pkgfile, function (err, ex) { - if (err) return cb(err); - if (!ex) return loadAsFile(path.join(x, '/index'), fpkg, cb); - - readFile(pkgfile, function (err, body) { - if (err) return cb(err); - try { - var pkg = JSON.parse(body); - } - catch (err) {} - - if (opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - - if (pkg.main) { - if (pkg.main === '.' || pkg.main === './'){ - pkg.main = 'index' - } - loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - if (!pkg) return loadAsFile(path.join(x, '/index'), pkg, cb); - - var dir = path.resolve(x, pkg.main); - loadAsDirectory(dir, pkg, function (err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - loadAsFile(path.join(x, '/index'), pkg, cb); - }); - }); - return; - } - - loadAsFile(path.join(x, '/index'), pkg, cb); - }); - }); - } - - function loadNodeModules (x, start, cb) { - (function process (dirs) { - if (dirs.length === 0) return cb(null, undefined); - var dir = dirs[0]; - - var file = path.join(dir, '/', x); - loadAsFile(file, undefined, onfile); - - function onfile (err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - loadAsDirectory(path.join(dir, '/', x), undefined, ondir); - } - - function ondir (err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - process(dirs.slice(1)); - } - })(nodeModulesPaths(start, opts)); - } -}; diff --git a/tools/eslint/node_modules/resolve/lib/caller.js b/tools/eslint/node_modules/resolve/lib/caller.js deleted file mode 100644 index 5536549b046d3c..00000000000000 --- a/tools/eslint/node_modules/resolve/lib/caller.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = function () { - // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - var origPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = function (_, stack) { return stack }; - var stack = (new Error()).stack; - Error.prepareStackTrace = origPrepareStackTrace; - return stack[2].getFileName(); -}; diff --git a/tools/eslint/node_modules/resolve/lib/core.js b/tools/eslint/node_modules/resolve/lib/core.js deleted file mode 100644 index ea4a6c87effc0b..00000000000000 --- a/tools/eslint/node_modules/resolve/lib/core.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = require('./core.json').reduce(function (acc, x) { - acc[x] = true; - return acc; -}, {}); diff --git a/tools/eslint/node_modules/resolve/lib/core.json b/tools/eslint/node_modules/resolve/lib/core.json deleted file mode 100644 index 28560f7ef74126..00000000000000 --- a/tools/eslint/node_modules/resolve/lib/core.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - "assert", - "buffer_ieee754", - "buffer", - "child_process", - "cluster", - "console", - "constants", - "crypto", - "_debugger", - "dgram", - "dns", - "domain", - "events", - "freelist", - "fs", - "http", - "https", - "_linklist", - "module", - "net", - "os", - "path", - "punycode", - "querystring", - "readline", - "repl", - "stream", - "string_decoder", - "sys", - "timers", - "tls", - "tty", - "url", - "util", - "vm", - "zlib" -] diff --git a/tools/eslint/node_modules/resolve/lib/node-modules-paths.js b/tools/eslint/node_modules/resolve/lib/node-modules-paths.js deleted file mode 100644 index ce0a0d9f2fb104..00000000000000 --- a/tools/eslint/node_modules/resolve/lib/node-modules-paths.js +++ /dev/null @@ -1,38 +0,0 @@ -var path = require('path'); - -module.exports = function (start, opts) { - var modules = opts.moduleDirectory - ? [].concat(opts.moduleDirectory) - : ['node_modules'] - ; - - // ensure that `start` is an absolute path at this point, - // resolving against the process' current working directory - start = path.resolve(start); - - var prefix = '/'; - if (/^([A-Za-z]:)/.test(start)) { - prefix = ''; - } else if (/^\\\\/.test(start)) { - prefix = '\\\\'; - } - - var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/; - - var parts = start.split(splitRe); - - var dirs = []; - for (var i = parts.length - 1; i >= 0; i--) { - if (modules.indexOf(parts[i]) !== -1) continue; - dirs = dirs.concat(modules.map(function(module_dir) { - return prefix + path.join( - path.join.apply(path, parts.slice(0, i + 1)), - module_dir - ); - })); - } - if (process.platform === 'win32'){ - dirs[dirs.length-1] = dirs[dirs.length-1].replace(":", ":\\"); - } - return dirs.concat(opts.paths); -} diff --git a/tools/eslint/node_modules/resolve/lib/sync.js b/tools/eslint/node_modules/resolve/lib/sync.js deleted file mode 100644 index bc4a2a8543dfd0..00000000000000 --- a/tools/eslint/node_modules/resolve/lib/sync.js +++ /dev/null @@ -1,81 +0,0 @@ -var core = require('./core'); -var fs = require('fs'); -var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); - -module.exports = function (x, opts) { - if (!opts) opts = {}; - var isFile = opts.isFile || function (file) { - try { var stat = fs.statSync(file) } - catch (err) { if (err && err.code === 'ENOENT') return false } - return stat.isFile() || stat.isFIFO(); - }; - var readFileSync = opts.readFileSync || fs.readFileSync; - - var extensions = opts.extensions || [ '.js' ]; - var y = opts.basedir || path.dirname(caller()); - - opts.paths = opts.paths || []; - - if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/.test(x)) { - var res = path.resolve(y, x); - if (x === '..') res += '/'; - var m = loadAsFileSync(res) || loadAsDirectorySync(res); - if (m) return m; - } else { - var n = loadNodeModulesSync(x, y); - if (n) return n; - } - - if (core[x]) return x; - - throw new Error("Cannot find module '" + x + "' from '" + y + "'"); - - function loadAsFileSync (x) { - if (isFile(x)) { - return x; - } - - for (var i = 0; i < extensions.length; i++) { - var file = x + extensions[i]; - if (isFile(file)) { - return file; - } - } - } - - function loadAsDirectorySync (x) { - var pkgfile = path.join(x, '/package.json'); - if (isFile(pkgfile)) { - var body = readFileSync(pkgfile, 'utf8'); - try { - var pkg = JSON.parse(body); - if (opts.packageFilter) { - pkg = opts.packageFilter(pkg, x); - } - - if (pkg.main) { - var m = loadAsFileSync(path.resolve(x, pkg.main)); - if (m) return m; - var n = loadAsDirectorySync(path.resolve(x, pkg.main)); - if (n) return n; - } - } - catch (err) {} - } - - return loadAsFileSync(path.join( x, '/index')); - } - - function loadNodeModulesSync (x, start) { - var dirs = nodeModulesPaths(start, opts); - for (var i = 0; i < dirs.length; i++) { - var dir = dirs[i]; - var m = loadAsFileSync(path.join( dir, '/', x)); - if (m) return m; - var n = loadAsDirectorySync(path.join( dir, '/', x )); - if (n) return n; - } - } -}; diff --git a/tools/eslint/node_modules/resolve/package.json b/tools/eslint/node_modules/resolve/package.json deleted file mode 100644 index 73fb88ffb755da..00000000000000 --- a/tools/eslint/node_modules/resolve/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "_args": [ - [ - "resolve@^1.1.6", - "/Users/trott/test/node_modules/eslint" - ] - ], - "_from": "resolve@>=1.1.6 <2.0.0", - "_id": "resolve@1.1.7", - "_inCache": true, - "_installable": true, - "_location": "/eslint/resolve", - "_nodeVersion": "4.2.1", - "_npmUser": { - "email": "substack@gmail.com", - "name": "substack" - }, - "_npmVersion": "3.4.1", - "_phantomChildren": {}, - "_requested": { - "name": "resolve", - "raw": "resolve@^1.1.6", - "rawSpec": "^1.1.6", - "scope": null, - "spec": ">=1.1.6 <2.0.0", - "type": "range" - }, - "_requiredBy": [ - "/eslint" - ], - "_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "_shasum": "203114d82ad2c5ed9e8e0411b3932875e889e97b", - "_shrinkwrap": null, - "_spec": "resolve@^1.1.6", - "_where": "/Users/trott/test/node_modules/eslint", - "author": { - "email": "mail@substack.net", - "name": "James Halliday", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/substack/node-resolve/issues" - }, - "dependencies": {}, - "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", - "devDependencies": { - "tap": "0.4.13", - "tape": "^3.5.0" - }, - "directories": {}, - "dist": { - "shasum": "203114d82ad2c5ed9e8e0411b3932875e889e97b", - "tarball": "http://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz" - }, - "gitHead": "bb37f0d4400e4d7835375be4bd3ad1264bac3689", - "homepage": "https://github.com/substack/node-resolve#readme", - "keywords": [ - "resolve", - "require", - "node", - "module" - ], - "license": "MIT", - "main": "index.js", - "maintainers": [ - { - "email": "mail@substack.net", - "name": "substack" - } - ], - "name": "resolve", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/substack/node-resolve.git" - }, - "scripts": { - "test": "tape test/*.js" - }, - "version": "1.1.7" -} diff --git a/tools/eslint/node_modules/resolve/readme.markdown b/tools/eslint/node_modules/resolve/readme.markdown deleted file mode 100644 index 4fab9b04362700..00000000000000 --- a/tools/eslint/node_modules/resolve/readme.markdown +++ /dev/null @@ -1,148 +0,0 @@ -# resolve - -implements the [node `require.resolve()` -algorithm](http://nodejs.org/docs/v0.4.8/api/all.html#all_Together...) -such that you can `require.resolve()` on behalf of a file asynchronously and -synchronously - -[![build status](https://secure.travis-ci.org/substack/node-resolve.png)](http://travis-ci.org/substack/node-resolve) - -# example - -asynchronously resolve: - -``` js -var resolve = require('resolve'); -resolve('tap', { basedir: __dirname }, function (err, res) { - if (err) console.error(err) - else console.log(res) -}); -``` - -``` -$ node example/async.js -/home/substack/projects/node-resolve/node_modules/tap/lib/main.js -``` - -synchronously resolve: - -``` js -var resolve = require('resolve'); -var res = resolve.sync('tap', { basedir: __dirname }); -console.log(res); -``` - -``` -$ node example/sync.js -/home/substack/projects/node-resolve/node_modules/tap/lib/main.js -``` - -# methods - -``` js -var resolve = require('resolve') -``` - -## resolve(id, opts={}, cb) - -Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. - -options are: - -* opts.basedir - directory to begin resolving from - -* opts.package - `package.json` data applicable to the module being loaded - -* opts.extensions - array of file extensions to search in order - -* opts.readFile - how to read files asynchronously - -* opts.isFile - function to asynchronously test whether a file exists - -* opts.packageFilter - transform the parsed package.json contents before looking -at the "main" field - -* opts.pathFilter(pkg, path, relativePath) - transform a path within a package - * pkg - package data - * path - the path being resolved - * relativePath - the path relative from the package.json location - * returns - a relative path that will be joined from the package.json location - -* opts.paths - require.paths array to use if nothing is found on the normal -node_modules recursive walk (probably don't use this) - -* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` - -default `opts` values: - -``` javascript -{ - paths: [], - basedir: __dirname, - extensions: [ '.js' ], - readFile: fs.readFile, - isFile: function (file, cb) { - fs.stat(file, function (err, stat) { - if (err && err.code === 'ENOENT') cb(null, false) - else if (err) cb(err) - else cb(null, stat.isFile()) - }); - }, - moduleDirectory: 'node_modules' -} -``` - -## resolve.sync(id, opts) - -Synchronously resolve the module path string `id`, returning the result and -throwing an error when `id` can't be resolved. - -options are: - -* opts.basedir - directory to begin resolving from - -* opts.extensions - array of file extensions to search in order - -* opts.readFile - how to read files synchronously - -* opts.isFile - function to synchronously test whether a file exists - -* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json -* contents before looking at the "main" field - -* opts.paths - require.paths array to use if nothing is found on the normal -node_modules recursive walk (probably don't use this) - -* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` - -default `opts` values: - -``` javascript -{ - paths: [], - basedir: __dirname, - extensions: [ '.js' ], - readFileSync: fs.readFileSync, - isFile: function (file) { - try { return fs.statSync(file).isFile() } - catch (e) { return false } - }, - moduleDirectory: 'node_modules' -} -```` - -## resolve.isCore(pkg) - -Return whether a package is in core. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install resolve -``` - -# license - -MIT diff --git a/tools/eslint/node_modules/resolve/test/core.js b/tools/eslint/node_modules/resolve/test/core.js deleted file mode 100644 index aede52af69933a..00000000000000 --- a/tools/eslint/node_modules/resolve/test/core.js +++ /dev/null @@ -1,12 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('core modules', function (t) { - t.ok(resolve.isCore('fs')); - t.ok(resolve.isCore('net')); - t.ok(resolve.isCore('http')); - - t.ok(!resolve.isCore('seq')); - t.ok(!resolve.isCore('../')); - t.end(); -}); diff --git a/tools/eslint/node_modules/resolve/test/dotdot.js b/tools/eslint/node_modules/resolve/test/dotdot.js deleted file mode 100644 index dc836d397c9aa6..00000000000000 --- a/tools/eslint/node_modules/resolve/test/dotdot.js +++ /dev/null @@ -1,29 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('dotdot', function (t) { - t.plan(4); - var dir = __dirname + '/dotdot/abc'; - - resolve('..', { basedir : dir }, function (err, res, pkg) { - t.ifError(err); - t.equal(res, __dirname + '/dotdot/index.js'); - }); - - resolve('.', { basedir : dir }, function (err, res, pkg) { - t.ifError(err); - t.equal(res, dir + '/index.js'); - }); -}); - -test('dotdot sync', function (t) { - t.plan(2); - var dir = __dirname + '/dotdot/abc'; - - var a = resolve.sync('..', { basedir : dir }); - t.equal(a, __dirname + '/dotdot/index.js'); - - var b = resolve.sync('.', { basedir : dir }); - t.equal(b, dir + '/index.js'); -}); diff --git a/tools/eslint/node_modules/resolve/test/dotdot/abc/index.js b/tools/eslint/node_modules/resolve/test/dotdot/abc/index.js deleted file mode 100644 index 67f2534ebf90dc..00000000000000 --- a/tools/eslint/node_modules/resolve/test/dotdot/abc/index.js +++ /dev/null @@ -1,2 +0,0 @@ -var x = require('..'); -console.log(x); diff --git a/tools/eslint/node_modules/resolve/test/dotdot/index.js b/tools/eslint/node_modules/resolve/test/dotdot/index.js deleted file mode 100644 index afec73603cc717..00000000000000 --- a/tools/eslint/node_modules/resolve/test/dotdot/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'whatever' diff --git a/tools/eslint/node_modules/resolve/test/faulty_basedir.js b/tools/eslint/node_modules/resolve/test/faulty_basedir.js deleted file mode 100644 index 244081882bd617..00000000000000 --- a/tools/eslint/node_modules/resolve/test/faulty_basedir.js +++ /dev/null @@ -1,17 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -// not sure what's up with this test anymore -if (process.platform !== 'win32') return; - -test('faulty basedir must produce error in windows', function (t) { - t.plan(1); - - var resolverDir = 'C:\\a\\b\\c\\d'; - - resolve('tape/lib/test.js', { basedir : resolverDir }, function (err, res, pkg) { - t.equal(true, !!err); - }); - -}); diff --git a/tools/eslint/node_modules/resolve/test/filter.js b/tools/eslint/node_modules/resolve/test/filter.js deleted file mode 100644 index 07c38f3493924f..00000000000000 --- a/tools/eslint/node_modules/resolve/test/filter.js +++ /dev/null @@ -1,18 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('filter', function (t) { - t.plan(2); - var dir = __dirname + '/resolver'; - resolve('./baz', { - basedir : dir, - packageFilter : function (pkg) { - pkg.main = 'doom'; - return pkg; - } - }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/baz/doom.js'); - t.equal(pkg.main, 'doom'); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/filter_sync.js b/tools/eslint/node_modules/resolve/test/filter_sync.js deleted file mode 100644 index 3f89b794209653..00000000000000 --- a/tools/eslint/node_modules/resolve/test/filter_sync.js +++ /dev/null @@ -1,15 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('filter', function (t) { - var dir = __dirname + '/resolver'; - var res = resolve.sync('./baz', { - basedir : dir, - packageFilter : function (pkg) { - pkg.main = 'doom' - return pkg; - } - }); - t.equal(res, dir + '/baz/doom.js'); - t.end(); -}); diff --git a/tools/eslint/node_modules/resolve/test/mock.js b/tools/eslint/node_modules/resolve/test/mock.js deleted file mode 100644 index 9701478980e278..00000000000000 --- a/tools/eslint/node_modules/resolve/test/mock.js +++ /dev/null @@ -1,142 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('mock', function (t) { - t.plan(6); - - var files = { - '/foo/bar/baz.js' : 'beep' - }; - - function opts (basedir) { - return { - basedir : basedir, - isFile : function (file, cb) { - cb(null, files.hasOwnProperty(file)); - }, - readFile : function (file, cb) { - cb(null, files[file]); - } - } - } - - resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, '/foo/bar/baz.js'); - t.equal(pkg, undefined); - }); - - resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, '/foo/bar/baz.js'); - t.equal(pkg, undefined); - }); - - resolve('baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module 'baz' from '/foo/bar'"); - }); - - resolve('../baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module '../baz' from '/foo/bar'"); - }); -}); - -test('mock from package', function (t) { - t.plan(6); - - var files = { - '/foo/bar/baz.js' : 'beep' - }; - - function opts (basedir) { - return { - basedir : basedir, - package : { main: 'bar' }, - isFile : function (file, cb) { - cb(null, files.hasOwnProperty(file)); - }, - readFile : function (file, cb) { - cb(null, files[file]); - } - } - } - - resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, '/foo/bar/baz.js'); - t.equal(pkg.main, 'bar'); - }); - - resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, '/foo/bar/baz.js'); - t.equal(pkg.main, 'bar'); - }); - - resolve('baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module 'baz' from '/foo/bar'"); - }); - - resolve('../baz', opts('/foo/bar'), function (err, res) { - t.equal(err.message, "Cannot find module '../baz' from '/foo/bar'"); - }); -}); - -test('mock package', function (t) { - t.plan(2); - - var files = { - '/foo/node_modules/bar/baz.js' : 'beep', - '/foo/node_modules/bar/package.json' : JSON.stringify({ - main : './baz.js' - }) - }; - - function opts (basedir) { - return { - basedir : basedir, - isFile : function (file, cb) { - cb(null, files.hasOwnProperty(file)); - }, - readFile : function (file, cb) { - cb(null, files[file]); - } - } - } - - resolve('bar', opts('/foo'), function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, '/foo/node_modules/bar/baz.js'); - t.equal(pkg.main, './baz.js'); - }); -}); - -test('mock package from package', function (t) { - t.plan(2); - - var files = { - '/foo/node_modules/bar/baz.js' : 'beep', - '/foo/node_modules/bar/package.json' : JSON.stringify({ - main : './baz.js' - }) - }; - - function opts (basedir) { - return { - basedir : basedir, - package : { main: 'bar' }, - isFile : function (file, cb) { - cb(null, files.hasOwnProperty(file)); - }, - readFile : function (file, cb) { - cb(null, files[file]); - } - } - } - - resolve('bar', opts('/foo'), function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, '/foo/node_modules/bar/baz.js'); - t.equal(pkg.main, './baz.js'); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/mock_sync.js b/tools/eslint/node_modules/resolve/test/mock_sync.js deleted file mode 100644 index 5a0e68cc7a19f3..00000000000000 --- a/tools/eslint/node_modules/resolve/test/mock_sync.js +++ /dev/null @@ -1,68 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('mock', function (t) { - t.plan(4); - - var files = { - '/foo/bar/baz.js' : 'beep' - }; - - function opts (basedir) { - return { - basedir : basedir, - isFile : function (file) { - return files.hasOwnProperty(file) - }, - readFileSync : function (file) { - return files[file] - } - } - } - - t.equal( - resolve.sync('./baz', opts('/foo/bar')), - '/foo/bar/baz.js' - ); - - t.equal( - resolve.sync('./baz.js', opts('/foo/bar')), - '/foo/bar/baz.js' - ); - - t.throws(function () { - resolve.sync('baz', opts('/foo/bar')); - }); - - t.throws(function () { - resolve.sync('../baz', opts('/foo/bar')); - }); -}); - -test('mock package', function (t) { - t.plan(1); - - var files = { - '/foo/node_modules/bar/baz.js' : 'beep', - '/foo/node_modules/bar/package.json' : JSON.stringify({ - main : './baz.js' - }) - }; - - function opts (basedir) { - return { - basedir : basedir, - isFile : function (file) { - return files.hasOwnProperty(file) - }, - readFileSync : function (file) { - return files[file] - } - } - } - - t.equal( - resolve.sync('bar', opts('/foo')), - '/foo/node_modules/bar/baz.js' - ); -}); diff --git a/tools/eslint/node_modules/resolve/test/module_dir.js b/tools/eslint/node_modules/resolve/test/module_dir.js deleted file mode 100644 index f462610cdc02c6..00000000000000 --- a/tools/eslint/node_modules/resolve/test/module_dir.js +++ /dev/null @@ -1,56 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('moduleDirectory strings', function (t) { - t.plan(4); - var dir = __dirname + '/module_dir'; - var xopts = { - basedir : dir, - moduleDirectory: 'xmodules' - }; - resolve('aaa', xopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, dir + '/xmodules/aaa/index.js'); - }); - - var yopts = { - basedir : dir, - moduleDirectory: 'ymodules' - }; - resolve('aaa', yopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, dir + '/ymodules/aaa/index.js'); - }); -}); - -test('moduleDirectory array', function (t) { - t.plan(6); - var dir = __dirname + '/module_dir'; - var aopts = { - basedir : dir, - moduleDirectory: [ 'xmodules', 'ymodules', 'zmodules' ] - }; - resolve('aaa', aopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, dir + '/xmodules/aaa/index.js'); - }); - - var bopts = { - basedir : dir, - moduleDirectory: [ 'zmodules', 'ymodules', 'xmodules' ] - }; - resolve('aaa', bopts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, dir + '/ymodules/aaa/index.js'); - }); - - var copts = { - basedir : dir, - moduleDirectory: [ 'xmodules', 'ymodules', 'zmodules' ] - }; - resolve('bbb', copts, function (err, res, pkg) { - t.ifError(err); - t.equal(res, dir + '/zmodules/bbb/main.js'); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/tools/eslint/node_modules/resolve/test/module_dir/xmodules/aaa/index.js deleted file mode 100644 index 55cd18ca7e60a9..00000000000000 --- a/tools/eslint/node_modules/resolve/test/module_dir/xmodules/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = function (x) { return x * 100 } diff --git a/tools/eslint/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/tools/eslint/node_modules/resolve/test/module_dir/ymodules/aaa/index.js deleted file mode 100644 index 651aca860d44f0..00000000000000 --- a/tools/eslint/node_modules/resolve/test/module_dir/ymodules/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = function (x) { return x + 100 } diff --git a/tools/eslint/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/tools/eslint/node_modules/resolve/test/module_dir/zmodules/bbb/main.js deleted file mode 100644 index 4325a0bd5c2bd0..00000000000000 --- a/tools/eslint/node_modules/resolve/test/module_dir/zmodules/bbb/main.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = function (n) { return n * 111 } diff --git a/tools/eslint/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/tools/eslint/node_modules/resolve/test/module_dir/zmodules/bbb/package.json deleted file mode 100644 index c13b8cf6acfd33..00000000000000 --- a/tools/eslint/node_modules/resolve/test/module_dir/zmodules/bbb/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "main.js" -} diff --git a/tools/eslint/node_modules/resolve/test/node_path.js b/tools/eslint/node_modules/resolve/test/node_path.js deleted file mode 100644 index 684ac8cb9bd342..00000000000000 --- a/tools/eslint/node_modules/resolve/test/node_path.js +++ /dev/null @@ -1,48 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('$NODE_PATH', function (t) { - t.plan(4); - - resolve('aaa', { - paths: [ - __dirname + '/node_path/x', - __dirname + '/node_path/y' - ], - basedir: __dirname, - }, function (err, res) { - t.equal(res, __dirname + '/node_path/x/aaa/index.js'); - }); - - resolve('bbb', { - paths: [ - __dirname + '/node_path/x', - __dirname + '/node_path/y' - ], - basedir: __dirname, - }, function (err, res) { - t.equal(res, __dirname + '/node_path/y/bbb/index.js'); - }); - - resolve('ccc', { - paths: [ - __dirname + '/node_path/x', - __dirname + '/node_path/y' - ], - basedir: __dirname, - }, function (err, res) { - t.equal(res, __dirname + '/node_path/x/ccc/index.js'); - }); - - // ensure that relative paths still resolve against the - // regular `node_modules` correctly - resolve('tap', { - paths: [ - 'node_path', - ], - basedir: 'node_path/x', - }, function (err, res) { - t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap/lib/main.js')); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/node_path/x/aaa/index.js b/tools/eslint/node_modules/resolve/test/node_path/x/aaa/index.js deleted file mode 100644 index 1ea591380dfb09..00000000000000 --- a/tools/eslint/node_modules/resolve/test/node_path/x/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'A' diff --git a/tools/eslint/node_modules/resolve/test/node_path/x/ccc/index.js b/tools/eslint/node_modules/resolve/test/node_path/x/ccc/index.js deleted file mode 100644 index f186fa7574fe9b..00000000000000 --- a/tools/eslint/node_modules/resolve/test/node_path/x/ccc/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'C' diff --git a/tools/eslint/node_modules/resolve/test/node_path/y/bbb/index.js b/tools/eslint/node_modules/resolve/test/node_path/y/bbb/index.js deleted file mode 100644 index e22dd83c0ca44e..00000000000000 --- a/tools/eslint/node_modules/resolve/test/node_path/y/bbb/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'B' diff --git a/tools/eslint/node_modules/resolve/test/node_path/y/ccc/index.js b/tools/eslint/node_modules/resolve/test/node_path/y/ccc/index.js deleted file mode 100644 index d0043d1ec4a0ea..00000000000000 --- a/tools/eslint/node_modules/resolve/test/node_path/y/ccc/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'CY' diff --git a/tools/eslint/node_modules/resolve/test/nonstring.js b/tools/eslint/node_modules/resolve/test/nonstring.js deleted file mode 100644 index ef63c40f9393dc..00000000000000 --- a/tools/eslint/node_modules/resolve/test/nonstring.js +++ /dev/null @@ -1,9 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('nonstring', function (t) { - t.plan(1); - resolve(555, function (err, res, pkg) { - t.ok(err); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/pathfilter.js b/tools/eslint/node_modules/resolve/test/pathfilter.js deleted file mode 100644 index 3dbc2a8007b65a..00000000000000 --- a/tools/eslint/node_modules/resolve/test/pathfilter.js +++ /dev/null @@ -1,35 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('#62: deep module references and the pathFilter', function(t){ - t.plan(9); - - var resolverDir = __dirname + '/pathfilter/deep_ref'; - var pathFilter = function(pkg, x, remainder){ - t.equal(pkg.version, "1.2.3"); - t.equal(x, resolverDir + '/node_modules/deep/ref'); - t.equal(remainder, "ref"); - return "alt"; - }; - - resolve('deep/ref', { basedir : resolverDir }, function (err, res, pkg) { - if (err) t.fail(err); - - t.equal(pkg.version, "1.2.3"); - t.equal(res, resolverDir + '/node_modules/deep/ref.js'); - }); - - resolve('deep/deeper/ref', { basedir: resolverDir }, - function(err, res, pkg) { - if(err) t.fail(err); - t.notEqual(pkg, undefined); - t.equal(pkg.version, "1.2.3"); - t.equal(res, resolverDir + '/node_modules/deep/deeper/ref.js'); - }); - - resolve('deep/ref', { basedir : resolverDir, pathFilter : pathFilter }, - function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, resolverDir + '/node_modules/deep/alt.js'); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json b/tools/eslint/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json deleted file mode 100644 index fe4b408a06d41a..00000000000000 --- a/tools/eslint/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "deep", - "version": "1.2.3" -} diff --git a/tools/eslint/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/ref.js b/tools/eslint/node_modules/resolve/test/pathfilter/deep_ref/node_modules/deep/ref.js deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/precedence.js b/tools/eslint/node_modules/resolve/test/precedence.js deleted file mode 100644 index 6593de9606f6ab..00000000000000 --- a/tools/eslint/node_modules/resolve/test/precedence.js +++ /dev/null @@ -1,23 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('precedence', function (t) { - t.plan(3); - var dir = path.join(__dirname, 'precedence/aaa'); - - resolve('./', { basedir : dir }, function (err, res, pkg) { - t.ifError(err); - t.equal(res, path.join(dir, 'index.js')); - t.equal(pkg.name, 'resolve'); - }); -}); - -test('./ should not load ${dir}.js', function (t) { - t.plan(1); - var dir = path.join(__dirname, 'precedence/bbb'); - - resolve('./', { basedir : dir }, function (err, res, pkg) { - t.ok(err); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/precedence/aaa.js b/tools/eslint/node_modules/resolve/test/precedence/aaa.js deleted file mode 100644 index a182397c5133e2..00000000000000 --- a/tools/eslint/node_modules/resolve/test/precedence/aaa.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'wtf' diff --git a/tools/eslint/node_modules/resolve/test/precedence/aaa/index.js b/tools/eslint/node_modules/resolve/test/precedence/aaa/index.js deleted file mode 100644 index 993b03c2cea1a1..00000000000000 --- a/tools/eslint/node_modules/resolve/test/precedence/aaa/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'okok' diff --git a/tools/eslint/node_modules/resolve/test/precedence/aaa/main.js b/tools/eslint/node_modules/resolve/test/precedence/aaa/main.js deleted file mode 100644 index db38959d72f2cf..00000000000000 --- a/tools/eslint/node_modules/resolve/test/precedence/aaa/main.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('./')) diff --git a/tools/eslint/node_modules/resolve/test/precedence/bbb.js b/tools/eslint/node_modules/resolve/test/precedence/bbb.js deleted file mode 100644 index c8a9996b39ba5f..00000000000000 --- a/tools/eslint/node_modules/resolve/test/precedence/bbb.js +++ /dev/null @@ -1 +0,0 @@ -module.exports '>_<' diff --git a/tools/eslint/node_modules/resolve/test/precedence/bbb/main.js b/tools/eslint/node_modules/resolve/test/precedence/bbb/main.js deleted file mode 100644 index 716b81d4bd463f..00000000000000 --- a/tools/eslint/node_modules/resolve/test/precedence/bbb/main.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('./')); // should throw diff --git a/tools/eslint/node_modules/resolve/test/resolver.js b/tools/eslint/node_modules/resolve/test/resolver.js deleted file mode 100644 index f0d6ccf1e0402c..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver.js +++ /dev/null @@ -1,281 +0,0 @@ -var path = require('path'); -var test = require('tape'); -var resolve = require('../'); - -test('async foo', function (t) { - t.plan(9); - var dir = __dirname + '/resolver'; - - resolve('./foo', { basedir : dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/foo.js'); - t.equal(pkg.name, 'resolve'); - }); - - resolve('./foo.js', { basedir : dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/foo.js'); - t.equal(pkg.name, 'resolve'); - }); - - resolve('./foo', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/foo.js'); - t.equal(pkg.main, 'resolver'); - }); - - resolve('./foo.js', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/foo.js'); - t.equal(pkg.main, 'resolver'); - }); - - resolve('foo', { basedir : dir }, function (err) { - t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); - }); -}); - -test('bar', function (t) { - t.plan(6); - var dir = __dirname + '/resolver'; - - resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/bar/node_modules/foo/index.js'); - t.equal(pkg, undefined); - }); - - resolve('foo', { basedir : dir + '/bar' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/bar/node_modules/foo/index.js'); - t.equal(pkg, undefined); - }); - - resolve('foo', { basedir : dir + '/bar', package: { main: 'bar' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/bar/node_modules/foo/index.js'); - t.equal(pkg, undefined); - }); -}); - -test('baz', function (t) { - t.plan(4); - var dir = __dirname + '/resolver'; - - resolve('./baz', { basedir : dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/baz/quux.js'); - t.equal(pkg.main, 'quux.js'); - }); - - resolve('./baz', { basedir : dir, package: { main: 'resolver' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/baz/quux.js'); - t.equal(pkg.main, 'quux.js'); - }); -}); - -test('biz', function (t) { - t.plan(24); - var dir = __dirname + '/resolver/biz/node_modules'; - - resolve('./grux', { basedir : dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/grux/index.js'); - t.equal(pkg, undefined); - }); - - resolve('./grux', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/grux/index.js'); - t.equal(pkg.main, 'biz'); - }); - - resolve('./garply', { basedir : dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/garply/lib/index.js'); - t.equal(pkg.main, './lib'); - }); - - resolve('./garply', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/garply/lib/index.js'); - t.equal(pkg.main, './lib'); - }); - - resolve('tiv', { basedir : dir + '/grux' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/tiv/index.js'); - t.equal(pkg, undefined); - }); - - resolve('tiv', { basedir : dir + '/grux', package: { main: 'grux' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/tiv/index.js'); - t.equal(pkg, undefined); - }); - - resolve('tiv', { basedir : dir + '/garply' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/tiv/index.js'); - t.equal(pkg, undefined); - }); - - resolve('tiv', { basedir : dir + '/garply', package: { main: './lib' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/tiv/index.js'); - t.equal(pkg, undefined); - }); - - resolve('grux', { basedir : dir + '/tiv' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/grux/index.js'); - t.equal(pkg, undefined); - }); - - resolve('grux', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/grux/index.js'); - t.equal(pkg, undefined); - }); - - resolve('garply', { basedir : dir + '/tiv' }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/garply/lib/index.js'); - t.equal(pkg.main, './lib'); - }); - - resolve('garply', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/garply/lib/index.js'); - t.equal(pkg.main, './lib'); - }); -}); - -test('quux', function (t) { - t.plan(2); - var dir = __dirname + '/resolver/quux'; - - resolve('./foo', { basedir : dir, package: { main: 'quux' } }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/foo/index.js'); - t.equal(pkg.main, 'quux'); - }); -}); - -test('normalize', function (t) { - t.plan(2); - var dir = __dirname + '/resolver/biz/node_modules/grux'; - - resolve('../grux', { basedir : dir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/index.js'); - t.equal(pkg, undefined); - }); -}); - -test('cup', function (t) { - t.plan(3); - var dir = __dirname + '/resolver'; - - resolve('./cup', { basedir : dir, extensions : [ '.js', '.coffee' ] }, - function (err, res) { - if (err) t.fail(err); - t.equal(res, dir + '/cup.coffee'); - }); - - resolve('./cup.coffee', { basedir : dir }, function (err, res) { - if (err) t.fail(err); - t.equal(res, dir + '/cup.coffee'); - }); - - resolve('./cup', { basedir : dir, extensions : [ '.js' ] }, - function (err, res) { - t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); - }); -}); - -test('mug', function (t) { - t.plan(3); - var dir = __dirname + '/resolver'; - - resolve('./mug', { basedir : dir }, function (err, res) { - if (err) t.fail(err); - t.equal(res, dir + '/mug.js'); - }); - - resolve('./mug', { basedir : dir, extensions : [ '.coffee', '.js' ] }, - function (err, res) { - if (err) t.fail(err); - t.equal(res, dir + '/mug.coffee'); - }); - - resolve('./mug', { basedir : dir, extensions : [ '.js', '.coffee' ] }, - function (err, res) { - t.equal(res, dir + '/mug.js'); - }); -}); - -test('other path', function (t) { - t.plan(4); - var resolverDir = __dirname + '/resolver'; - var dir = resolverDir + '/bar'; - var otherDir = resolverDir + '/other_path'; - - resolve('root', { basedir : dir, paths: [otherDir] }, function (err, res) { - if (err) t.fail(err); - t.equal(res, resolverDir + '/other_path/root.js'); - }); - - resolve('lib/other-lib', { basedir : dir, paths: [otherDir] }, - function (err, res) { - if (err) t.fail(err); - t.equal(res, resolverDir + '/other_path/lib/other-lib.js'); - }); - - resolve('root', { basedir : dir, }, function (err, res) { - t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); - }); - - resolve('zzz', { basedir : dir, paths: [otherDir] }, function (err, res) { - t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); - }); -}); - -test('incorrect main', function (t) { - t.plan(1) - - var resolverDir = __dirname + '/resolver'; - var dir = resolverDir + '/incorrect_main'; - - resolve('./incorrect_main', { basedir : resolverDir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, dir + '/index.js'); - }); -}); - -test('without basedir', function (t) { - t.plan(1); - - var dir = __dirname + '/resolver/without_basedir'; - var tester = require(dir + '/main.js'); - - tester(t, function (err, res, pkg){ - if (err) { - t.fail(err); - } else { - t.equal(res, dir + '/node_modules/mymodule.js'); - } - }); -}); - -test('#25: node modules with the same name as node stdlib modules', function (t) { - t.plan(1); - - var resolverDir = __dirname + '/resolver/punycode'; - - resolve('punycode', { basedir : resolverDir }, function (err, res, pkg) { - if (err) t.fail(err); - t.equal(res, resolverDir + '/node_modules/punycode/index.js'); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js b/tools/eslint/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js deleted file mode 100644 index bd816eaba4ca3b..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/tools/eslint/node_modules/resolve/test/resolver/baz/doom.js b/tools/eslint/node_modules/resolve/test/resolver/baz/doom.js deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/resolver/baz/package.json b/tools/eslint/node_modules/resolve/test/resolver/baz/package.json deleted file mode 100644 index 6b81dcddfc4a22..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/baz/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main" : "quux.js" -} diff --git a/tools/eslint/node_modules/resolve/test/resolver/baz/quux.js b/tools/eslint/node_modules/resolve/test/resolver/baz/quux.js deleted file mode 100644 index bd816eaba4ca3b..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/baz/quux.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js b/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js deleted file mode 100644 index 0379e29f701f92..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/garply/lib/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'hello garply'; diff --git a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json b/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json deleted file mode 100644 index babaac58fddb1b..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main" : "./lib" -} diff --git a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js b/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js deleted file mode 100644 index 49960555ab4cf8..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('tiv') * 100; diff --git a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js b/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js deleted file mode 100644 index 690aad34a46dc9..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 3; diff --git a/tools/eslint/node_modules/resolve/test/resolver/cup.coffee b/tools/eslint/node_modules/resolve/test/resolver/cup.coffee deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/resolver/foo.js b/tools/eslint/node_modules/resolve/test/resolver/foo.js deleted file mode 100644 index bd816eaba4ca3b..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/foo.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/tools/eslint/node_modules/resolve/test/resolver/incorrect_main/index.js b/tools/eslint/node_modules/resolve/test/resolver/incorrect_main/index.js deleted file mode 100644 index bc1fb0a6f4ede1..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/incorrect_main/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate -module.exports = 1; diff --git a/tools/eslint/node_modules/resolve/test/resolver/incorrect_main/package.json b/tools/eslint/node_modules/resolve/test/resolver/incorrect_main/package.json deleted file mode 100644 index 1592ed393718f8..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/incorrect_main/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main" : "wrong.js" -} diff --git a/tools/eslint/node_modules/resolve/test/resolver/mug.coffee b/tools/eslint/node_modules/resolve/test/resolver/mug.coffee deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/resolver/mug.js b/tools/eslint/node_modules/resolve/test/resolver/mug.js deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/tools/eslint/node_modules/resolve/test/resolver/other_path/lib/other-lib.js deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/resolver/other_path/root.js b/tools/eslint/node_modules/resolve/test/resolver/other_path/root.js deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/resolver/punycode/node_modules/punycode/index.js b/tools/eslint/node_modules/resolve/test/resolver/punycode/node_modules/punycode/index.js deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tools/eslint/node_modules/resolve/test/resolver/quux/foo/index.js b/tools/eslint/node_modules/resolve/test/resolver/quux/foo/index.js deleted file mode 100644 index bd816eaba4ca3b..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/quux/foo/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 1; diff --git a/tools/eslint/node_modules/resolve/test/resolver/without_basedir/main.js b/tools/eslint/node_modules/resolve/test/resolver/without_basedir/main.js deleted file mode 100644 index b62aa0e0ae08fa..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/without_basedir/main.js +++ /dev/null @@ -1,5 +0,0 @@ -resolve = require('../../../'); - -module.exports = function(t, cb) { - resolve('mymodule', null, cb); -} diff --git a/tools/eslint/node_modules/resolve/test/resolver/without_basedir/node_modules/mymodule.js b/tools/eslint/node_modules/resolve/test/resolver/without_basedir/node_modules/mymodule.js deleted file mode 100644 index 2b58aa4087d758..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver/without_basedir/node_modules/mymodule.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = "The tools we use have a profound (and devious!) influence on our thinking habits, and, therefore, on our thinking abilities.- E. Dijkstra" diff --git a/tools/eslint/node_modules/resolve/test/resolver_sync.js b/tools/eslint/node_modules/resolve/test/resolver_sync.js deleted file mode 100644 index 04cc855c75c5b0..00000000000000 --- a/tools/eslint/node_modules/resolve/test/resolver_sync.js +++ /dev/null @@ -1,180 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); - -test('foo', function (t) { - var dir = __dirname + '/resolver'; - - t.equal( - resolve.sync('./foo', { basedir : dir }), - dir + '/foo.js' - ); - - t.equal( - resolve.sync('./foo.js', { basedir : dir }), - dir + '/foo.js' - ); - - t.throws(function () { - resolve.sync('foo', { basedir : dir }); - }); - - t.end(); -}); - -test('bar', function (t) { - var dir = __dirname + '/resolver'; - - t.equal( - resolve.sync('foo', { basedir : dir + '/bar' }), - dir + '/bar/node_modules/foo/index.js' - ); - t.end(); -}); - -test('baz', function (t) { - var dir = __dirname + '/resolver'; - - t.equal( - resolve.sync('./baz', { basedir : dir }), - dir + '/baz/quux.js' - ); - t.end(); -}); - -test('biz', function (t) { - var dir = __dirname + '/resolver/biz/node_modules'; - t.equal( - resolve.sync('./grux', { basedir : dir }), - dir + '/grux/index.js' - ); - - t.equal( - resolve.sync('tiv', { basedir : dir + '/grux' }), - dir + '/tiv/index.js' - ); - - t.equal( - resolve.sync('grux', { basedir : dir + '/tiv' }), - dir + '/grux/index.js' - ); - t.end(); -}); - -test('normalize', function (t) { - var dir = __dirname + '/resolver/biz/node_modules/grux'; - t.equal( - resolve.sync('../grux', { basedir : dir }), - dir + '/index.js' - ); - t.end(); -}); - -test('cup', function (t) { - var dir = __dirname + '/resolver'; - t.equal( - resolve.sync('./cup', { - basedir : dir, - extensions : [ '.js', '.coffee' ] - }), - dir + '/cup.coffee' - ); - - t.equal( - resolve.sync('./cup.coffee', { - basedir : dir - }), - dir + '/cup.coffee' - ); - - t.throws(function () { - resolve.sync('./cup', { - basedir : dir, - extensions : [ '.js' ] - }) - }); - - t.end(); -}); - -test('mug', function (t) { - var dir = __dirname + '/resolver'; - t.equal( - resolve.sync('./mug', { basedir : dir }), - dir + '/mug.js' - ); - - t.equal( - resolve.sync('./mug', { - basedir : dir, - extensions : [ '.coffee', '.js' ] - }), - dir + '/mug.coffee' - ); - - t.equal( - resolve.sync('./mug', { - basedir : dir, - extensions : [ '.js', '.coffee' ] - }), - dir + '/mug.js' - ); - - t.end(); -}); - -test('other path', function (t) { - var resolverDir = __dirname + '/resolver'; - var dir = resolverDir + '/bar'; - var otherDir = resolverDir + '/other_path'; - - var path = require('path'); - - t.equal( - resolve.sync('root', { - basedir : dir, - paths: [otherDir] }), - resolverDir + '/other_path/root.js' - ); - - t.equal( - resolve.sync('lib/other-lib', { - basedir : dir, - paths: [otherDir] }), - resolverDir + '/other_path/lib/other-lib.js' - ); - - t.throws(function () { - resolve.sync('root', { basedir : dir, }); - }); - - t.throws(function () { - resolve.sync('zzz', { - basedir : dir, - paths: [otherDir] }); - }); - - t.end(); -}); - -test('incorrect main', function (t) { - var resolverDir = __dirname + '/resolver'; - var dir = resolverDir + '/incorrect_main'; - - t.equal( - resolve.sync('./incorrect_main', { basedir : resolverDir }), - dir + '/index.js' - ) - - t.end() -}); - -test('#25: node modules with the same name as node stdlib modules', function (t) { - var resolverDir = __dirname + '/resolver/punycode'; - - t.equal( - resolve.sync('punycode', { basedir : resolverDir }), - resolverDir + '/node_modules/punycode/index.js' - ) - - t.end() -}); diff --git a/tools/eslint/node_modules/resolve/test/subdirs.js b/tools/eslint/node_modules/resolve/test/subdirs.js deleted file mode 100644 index b7b8450a9ef231..00000000000000 --- a/tools/eslint/node_modules/resolve/test/subdirs.js +++ /dev/null @@ -1,13 +0,0 @@ -var test = require('tape'); -var resolve = require('../'); -var path = require('path'); - -test('subdirs', function (t) { - t.plan(2); - - var dir = path.join(__dirname, '/subdirs'); - resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { - t.ifError(err); - t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); - }); -}); diff --git a/tools/eslint/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json b/tools/eslint/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json deleted file mode 100644 index 3cc0ecbedfe42f..00000000000000 --- a/tools/eslint/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json +++ /dev/null @@ -1 +0,0 @@ -[1,2,3] diff --git a/tools/eslint/node_modules/resolve/test/subdirs/node_modules/a/package.json b/tools/eslint/node_modules/resolve/test/subdirs/node_modules/a/package.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tools/eslint/node_modules/resolve/test/subdirs/node_modules/a/package.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tools/eslint/node_modules/restore-cursor/package.json b/tools/eslint/node_modules/restore-cursor/package.json index e7ff8d75f6334b..3338e669c40261 100644 --- a/tools/eslint/node_modules/restore-cursor/package.json +++ b/tools/eslint/node_modules/restore-cursor/package.json @@ -2,14 +2,14 @@ "_args": [ [ "restore-cursor@^1.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/cli-cursor" + "/Users/silverwind/git/node/tools/package/package/node_modules/cli-cursor" ] ], "_from": "restore-cursor@>=1.0.1 <2.0.0", "_id": "restore-cursor@1.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/restore-cursor", + "_location": "/restore-cursor", "_nodeVersion": "4.1.0", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/cli-cursor" + "/cli-cursor" ], "_resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", "_shasum": "34661f46886327fed2991479152252df92daa541", "_shrinkwrap": null, "_spec": "restore-cursor@^1.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/cli-cursor", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/cli-cursor", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -61,32 +61,32 @@ "gitHead": "91542e5be16d7ccda8e42a63d56cc783d2cfaba2", "homepage": "https://github.com/sindresorhus/restore-cursor#readme", "keywords": [ + "ansi", + "cli", + "command-line", + "console", + "cursor", "exit", - "quit", - "process", "graceful", + "kill", + "process", + "quit", + "shell", + "show", "shutdown", - "sigterm", "sigint", - "terminate", - "kill", + "sigterm", "stop", - "cli", - "cursor", - "ansi", - "show", "term", "terminal", - "console", - "tty", - "shell", - "command-line" + "terminate", + "tty" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "restore-cursor", diff --git a/tools/eslint/node_modules/rimraf/node_modules/glob/package.json b/tools/eslint/node_modules/rimraf/node_modules/glob/package.json deleted file mode 100644 index 6405125e7f396e..00000000000000 --- a/tools/eslint/node_modules/rimraf/node_modules/glob/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "_args": [ - [ - "glob@^7.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/rimraf" - ] - ], - "_from": "glob@>=7.0.0 <8.0.0", - "_id": "glob@7.0.0", - "_inCache": true, - "_installable": true, - "_location": "/eslint/rimraf/glob", - "_nodeVersion": "4.0.0", - "_npmOperationalInternal": { - "host": "packages-5-east.internal.npmjs.com", - "tmp": "tmp/glob-7.0.0.tgz_1455132435010_0.6941273615229875" - }, - "_npmUser": { - "email": "i@izs.me", - "name": "isaacs" - }, - "_npmVersion": "3.7.0", - "_phantomChildren": {}, - "_requested": { - "name": "glob", - "raw": "glob@^7.0.0", - "rawSpec": "^7.0.0", - "scope": null, - "spec": ">=7.0.0 <8.0.0", - "type": "range" - }, - "_requiredBy": [ - "/eslint/rimraf" - ], - "_resolved": "https://registry.npmjs.org/glob/-/glob-7.0.0.tgz", - "_shasum": "3b20a357fffcf46bb384aed6f8ae9a647fdb6ac4", - "_shrinkwrap": null, - "_spec": "glob@^7.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/rimraf", - "author": { - "email": "i@izs.me", - "name": "Isaac Z. Schlueter", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/node-glob/issues" - }, - "dependencies": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "description": "a little globber", - "devDependencies": { - "mkdirp": "0", - "rimraf": "^2.2.8", - "tap": "^5.0.0", - "tick": "0.0.6" - }, - "directories": {}, - "dist": { - "shasum": "3b20a357fffcf46bb384aed6f8ae9a647fdb6ac4", - "tarball": "http://registry.npmjs.org/glob/-/glob-7.0.0.tgz" - }, - "engines": { - "node": "*" - }, - "files": [ - "glob.js", - "sync.js", - "common.js" - ], - "gitHead": "8e8876f84232783fd2db3182af5fa33cc83f1989", - "homepage": "https://github.com/isaacs/node-glob#readme", - "license": "ISC", - "main": "glob.js", - "maintainers": [ - { - "email": "i@izs.me", - "name": "isaacs" - } - ], - "name": "glob", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-glob.git" - }, - "scripts": { - "bench": "bash benchmark.sh", - "benchclean": "node benchclean.js", - "prepublish": "npm run benchclean", - "prof": "bash prof.sh && cat profile.txt", - "profclean": "rm -f v8.log profile.txt", - "test": "tap test/*.js --cov", - "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" - }, - "version": "7.0.0" -} diff --git a/tools/eslint/node_modules/rimraf/node_modules/glob/sync.js b/tools/eslint/node_modules/rimraf/node_modules/glob/sync.js deleted file mode 100644 index aa28c87a3e5daf..00000000000000 --- a/tools/eslint/node_modules/rimraf/node_modules/glob/sync.js +++ /dev/null @@ -1,466 +0,0 @@ -module.exports = globSync -globSync.GlobSync = GlobSync - -var fs = require('fs') -var minimatch = require('minimatch') -var Minimatch = minimatch.Minimatch -var Glob = require('./glob.js').Glob -var util = require('util') -var path = require('path') -var assert = require('assert') -var isAbsolute = require('path-is-absolute') -var common = require('./common.js') -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var childrenIgnored = common.childrenIgnored - -function globSync (pattern, options) { - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - return new GlobSync(pattern, options).found -} - -function GlobSync (pattern, options) { - if (!pattern) - throw new Error('must provide pattern') - - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') - - if (!(this instanceof GlobSync)) - return new GlobSync(pattern, options) - - setopts(this, pattern, options) - - if (this.noprocess) - return this - - var n = this.minimatch.set.length - this.matches = new Array(n) - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false) - } - this._finish() -} - -GlobSync.prototype._finish = function () { - assert(this instanceof GlobSync) - if (this.realpath) { - var self = this - this.matches.forEach(function (matchset, index) { - var set = self.matches[index] = Object.create(null) - for (var p in matchset) { - try { - p = self._makeAbs(p) - var real = fs.realpathSync(p, self.realpathCache) - set[real] = true - } catch (er) { - if (er.syscall === 'stat') - set[self._makeAbs(p)] = true - else - throw er - } - } - }) - } - common.finish(this) -} - - -GlobSync.prototype._process = function (pattern, index, inGlobStar) { - assert(this instanceof GlobSync) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // See if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip processing - if (childrenIgnored(this, read)) - return - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar) -} - - -GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { - var entries = this._readdir(abs, inGlobStar) - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) - } - } - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix.slice(-1) !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this.matches[index][e] = true - } - // This was the last one, and no stats were needed - return - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) - newPattern = [prefix, e] - else - newPattern = [e] - this._process(newPattern.concat(remain), index, inGlobStar) - } -} - - -GlobSync.prototype._emitMatch = function (index, e) { - var abs = this._makeAbs(e) - if (this.mark) - e = this._mark(e) - - if (this.matches[index][e]) - return - - if (this.nodir) { - var c = this.cache[this._makeAbs(e)] - if (c === 'DIR' || Array.isArray(c)) - return - } - - this.matches[index][e] = true - if (this.stat) - this._stat(e) -} - - -GlobSync.prototype._readdirInGlobStar = function (abs) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false) - - var entries - var lstat - var stat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - // lstat failed, doesn't exist - return null - } - - var isSym = lstat.isSymbolicLink() - this.symlinks[abs] = isSym - - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && !lstat.isDirectory()) - this.cache[abs] = 'FILE' - else - entries = this._readdir(abs, false) - - return entries -} - -GlobSync.prototype._readdir = function (abs, inGlobStar) { - var entries - - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return null - - if (Array.isArray(c)) - return c - } - - try { - return this._readdirEntries(abs, fs.readdirSync(abs)) - } catch (er) { - this._readdirError(abs, er) - return null - } -} - -GlobSync.prototype._readdirEntries = function (abs, entries) { - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } - - this.cache[abs] = entries - - // mark and cache dir-ness - return entries -} - -GlobSync.prototype._readdirError = function (f, er) { - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - this.cache[this._makeAbs(f)] = 'FILE' - if (f === this.cwd) { - var error = new Error(er.code + ' invalid cwd ' + f) - error.path = f - error.code = er.code - throw error - } - break - - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) - throw er - if (!this.silent) - console.error('glob error', er) - break - } -} - -GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { - - var entries = this._readdir(abs, inGlobStar) - - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return - - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) - - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false) - - var len = entries.length - var isSym = this.symlinks[abs] - - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return - - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true) - - var below = gspref.concat(entries[i], remain) - this._process(below, index, true) - } -} - -GlobSync.prototype._processSimple = function (prefix, index) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var exists = this._stat(prefix) - - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - // If it doesn't exist, then just mark the lack of results - if (!exists) - return - - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this.matches[index][prefix] = true -} - -// Returns either 'DIR', 'FILE', or false -GlobSync.prototype._stat = function (f) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return false - - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] - - if (Array.isArray(c)) - c = 'DIR' - - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return c - - if (needDir && c === 'FILE') - return false - - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } - - var exists - var stat = this.statCache[abs] - if (!stat) { - var lstat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - return false - } - - if (lstat.isSymbolicLink()) { - try { - stat = fs.statSync(abs) - } catch (er) { - stat = lstat - } - } else { - stat = lstat - } - } - - this.statCache[abs] = stat - - var c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c - - if (needDir && c !== 'DIR') - return false - - return c -} - -GlobSync.prototype._mark = function (p) { - return common.mark(this, p) -} - -GlobSync.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} diff --git a/tools/eslint/node_modules/rimraf/package.json b/tools/eslint/node_modules/rimraf/package.json index 81e560b3210b33..ffab90b9b10a76 100644 --- a/tools/eslint/node_modules/rimraf/package.json +++ b/tools/eslint/node_modules/rimraf/package.json @@ -2,14 +2,14 @@ "_args": [ [ "rimraf@^2.2.8", - "/Users/trott/test/node_modules/eslint/node_modules/del" + "/Users/silverwind/git/node/tools/package/package/node_modules/del" ] ], "_from": "rimraf@>=2.2.8 <3.0.0", "_id": "rimraf@2.5.2", "_inCache": true, "_installable": true, - "_location": "/eslint/rimraf", + "_location": "/rimraf", "_nodeVersion": "5.6.0", "_npmOperationalInternal": { "host": "packages-6-west.internal.npmjs.com", @@ -20,13 +20,7 @@ "name": "isaacs" }, "_npmVersion": "3.7.0", - "_phantomChildren": { - "inflight": "1.0.4", - "inherits": "2.0.1", - "minimatch": "3.0.0", - "once": "1.3.3", - "path-is-absolute": "1.0.0" - }, + "_phantomChildren": {}, "_requested": { "name": "rimraf", "raw": "rimraf@^2.2.8", @@ -36,13 +30,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/del" + "/del" ], "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.5.2.tgz", "_shasum": "62ba947fa4c0b4363839aefecd4f0fbad6059726", "_shrinkwrap": null, "_spec": "rimraf@^2.2.8", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/del", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/del", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -65,7 +59,7 @@ "directories": {}, "dist": { "shasum": "62ba947fa4c0b4363839aefecd4f0fbad6059726", - "tarball": "http://registry.npmjs.org/rimraf/-/rimraf-2.5.2.tgz" + "tarball": "https://registry.npmjs.org/rimraf/-/rimraf-2.5.2.tgz" }, "files": [ "LICENSE", @@ -79,8 +73,8 @@ "main": "rimraf.js", "maintainers": [ { - "email": "i@izs.me", - "name": "isaacs" + "name": "isaacs", + "email": "i@izs.me" } ], "name": "rimraf", diff --git a/tools/eslint/node_modules/run-async/.editorconfig b/tools/eslint/node_modules/run-async/.editorconfig deleted file mode 100644 index 6d740d54dbe4f1..00000000000000 --- a/tools/eslint/node_modules/run-async/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -# editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/tools/eslint/node_modules/run-async/.gitattributes b/tools/eslint/node_modules/run-async/.gitattributes deleted file mode 100644 index 176a458f94e0ea..00000000000000 --- a/tools/eslint/node_modules/run-async/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/tools/eslint/node_modules/run-async/.jshintrc b/tools/eslint/node_modules/run-async/.jshintrc deleted file mode 100644 index 3e4ba5a6357b53..00000000000000 --- a/tools/eslint/node_modules/run-async/.jshintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "node": true, - "esnext": true, - "bitwise": false, - "curly": false, - "eqeqeq": true, - "eqnull": true, - "immed": true, - "latedef": false, - "newcap": true, - "noarg": true, - "undef": true, - "strict": true, - "trailing": true, - "smarttabs": true, - "indent": 2, - "quotmark": "single", - "scripturl": true, - "globals": [ "describe", "it" ] -} diff --git a/tools/eslint/node_modules/run-async/.npmignore b/tools/eslint/node_modules/run-async/.npmignore deleted file mode 100644 index c2658d7d1b3184..00000000000000 --- a/tools/eslint/node_modules/run-async/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/tools/eslint/node_modules/run-async/.travis.yml b/tools/eslint/node_modules/run-async/.travis.yml deleted file mode 100644 index 244b7e88e3273c..00000000000000 --- a/tools/eslint/node_modules/run-async/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - '0.10' diff --git a/tools/eslint/node_modules/run-async/package.json b/tools/eslint/node_modules/run-async/package.json index 337564dce1707e..81fc26e0cfcb93 100644 --- a/tools/eslint/node_modules/run-async/package.json +++ b/tools/eslint/node_modules/run-async/package.json @@ -2,14 +2,14 @@ "_args": [ [ "run-async@^0.1.0", - "/Users/trott/test/node_modules/eslint/node_modules/inquirer" + "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer" ] ], "_from": "run-async@>=0.1.0 <0.2.0", "_id": "run-async@0.1.0", "_inCache": true, "_installable": true, - "_location": "/eslint/run-async", + "_location": "/run-async", "_npmUser": { "email": "admin@simonboudrias.com", "name": "sboudrias" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/inquirer" + "/inquirer" ], "_resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", "_shasum": "c8ad4a5e110661e402a7d21b530e009f25f8e389", "_shrinkwrap": null, "_spec": "run-async@^0.1.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/inquirer", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer", "author": { "email": "admin@simonboudrias.com", "name": "Simon Boudrias" @@ -53,16 +53,16 @@ }, "homepage": "https://github.com/SBoudrias/run-async", "keywords": [ + "async", "flow", - "flow-control", - "async" + "flow-control" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "admin@simonboudrias.com", - "name": "sboudrias" + "name": "sboudrias", + "email": "admin@simonboudrias.com" } ], "name": "run-async", diff --git a/tools/eslint/node_modules/run-async/test.js b/tools/eslint/node_modules/run-async/test.js deleted file mode 100644 index 0a82fedf198661..00000000000000 --- a/tools/eslint/node_modules/run-async/test.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -var assert = require('assert'); -var runAsync = require('./index'); - -describe('runAsync', function () { - it('run synchronous method', function (done) { - var aFunc = function () { - return 'pass1'; - }; - runAsync(aFunc, function (val) { - assert.equal(val, 'pass1'); - done(); - }); - }); - - it('run asynchronous method', function (done) { - var aFunc = function () { - var returns = this.async(); - setTimeout(returns.bind(null, 'pass2'), 0); - }; - - runAsync(aFunc, function (val) { - assert.equal(val, 'pass2'); - done(); - }); - }); - - it('pass arguments', function (done) { - var aFunc = function (a, b) { - assert.equal(a, 1); - assert.equal(b, 'bar'); - return 'pass1'; - }; - runAsync(aFunc, function (val) { - done(); - }, 1, 'bar'); - }); - - it('allow only callback once', function (done) { - var aFunc = function () { - var returns = this.async(); - returns(); - returns(); - }; - - runAsync(aFunc, function (val) { - done(); - }); - }); -}); diff --git a/tools/eslint/node_modules/rx-lite/package.json b/tools/eslint/node_modules/rx-lite/package.json index decda62b654083..7688ac0f2445c5 100644 --- a/tools/eslint/node_modules/rx-lite/package.json +++ b/tools/eslint/node_modules/rx-lite/package.json @@ -2,14 +2,14 @@ "_args": [ [ "rx-lite@^3.1.2", - "/Users/trott/test/node_modules/eslint/node_modules/inquirer" + "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer" ] ], "_from": "rx-lite@>=3.1.2 <4.0.0", "_id": "rx-lite@3.1.2", "_inCache": true, "_installable": true, - "_location": "/eslint/rx-lite", + "_location": "/rx-lite", "_nodeVersion": "0.12.7", "_npmUser": { "email": "matthew.podwysocki@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/inquirer" + "/inquirer" ], "_resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", "_shasum": "19ce502ca572665f3b647b10939f97fd1615f102", "_shrinkwrap": null, "_spec": "rx-lite@^3.1.2", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/inquirer", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer", "author": { "name": "Cloud Programmability Team", "url": "https://github.com/Reactive-Extensions/RxJS/blob/master/authors.txt" @@ -56,9 +56,9 @@ "main": "rx.lite.js" }, "keywords": [ + "Events", "React", "Reactive", - "Events", "Rx", "RxJS" ], @@ -71,8 +71,8 @@ "main": "rx.lite.js", "maintainers": [ { - "email": "matthew.podwysocki@gmail.com", - "name": "mattpodwysocki" + "name": "mattpodwysocki", + "email": "matthew.podwysocki@gmail.com" } ], "name": "rx-lite", diff --git a/tools/eslint/node_modules/shelljs/.documentup.json b/tools/eslint/node_modules/shelljs/.documentup.json deleted file mode 100644 index 57fe30116b7659..00000000000000 --- a/tools/eslint/node_modules/shelljs/.documentup.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "ShellJS", - "twitter": [ - "r2r" - ] -} diff --git a/tools/eslint/node_modules/shelljs/.jshintrc b/tools/eslint/node_modules/shelljs/.jshintrc deleted file mode 100644 index a80c559aa14d6d..00000000000000 --- a/tools/eslint/node_modules/shelljs/.jshintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "loopfunc": true, - "sub": true, - "undef": true, - "unused": true, - "node": true -} \ No newline at end of file diff --git a/tools/eslint/node_modules/shelljs/.npmignore b/tools/eslint/node_modules/shelljs/.npmignore deleted file mode 100644 index 6b20c38ae7d468..00000000000000 --- a/tools/eslint/node_modules/shelljs/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -test/ -tmp/ \ No newline at end of file diff --git a/tools/eslint/node_modules/shelljs/.travis.yml b/tools/eslint/node_modules/shelljs/.travis.yml deleted file mode 100644 index 335f4f45d63834..00000000000000 --- a/tools/eslint/node_modules/shelljs/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.10" - - "0.11" - - "0.12" diff --git a/tools/eslint/node_modules/shelljs/LICENSE b/tools/eslint/node_modules/shelljs/LICENSE index fb35c092f1a8a7..be169d8d61bb6c 100644 --- a/tools/eslint/node_modules/shelljs/LICENSE +++ b/tools/eslint/node_modules/shelljs/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2012, Artur Adib +Copyright (c) 2012, Artur Adib All rights reserved. You may use this project under the terms of the New BSD license as follows: diff --git a/tools/eslint/node_modules/shelljs/MAINTAINERS b/tools/eslint/node_modules/shelljs/MAINTAINERS new file mode 100644 index 00000000000000..3f94761505a94b --- /dev/null +++ b/tools/eslint/node_modules/shelljs/MAINTAINERS @@ -0,0 +1,3 @@ +Ari Porad (@ariporad) +Nate Fischer (@nfischer) +Artur Adib (@arturadib) diff --git a/tools/eslint/node_modules/shelljs/README.md b/tools/eslint/node_modules/shelljs/README.md index d08d13e8b06eb5..d6dcb63408653a 100644 --- a/tools/eslint/node_modules/shelljs/README.md +++ b/tools/eslint/node_modules/shelljs/README.md @@ -1,8 +1,12 @@ -# ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs) +# ShellJS - Unix shell commands for Node.js + +[![Join the chat at https://gitter.im/shelljs/shelljs](https://badges.gitter.im/shelljs/shelljs.svg)](https://gitter.im/shelljs/shelljs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Build Status](https://travis-ci.org/shelljs/shelljs.svg?branch=master)](http://travis-ci.org/shelljs/shelljs) +[![Build status](https://ci.appveyor.com/api/projects/status/42txr0s3ux5wbumv/branch/master?svg=true)](https://ci.appveyor.com/project/shelljs/shelljs) ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts! -The project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like: +The project is [unit-tested](http://travis-ci.org/shelljs/shelljs) and battled-tested in projects like: + [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader + [Firebug](http://getfirebug.com/) - Firefox's infamous debugger @@ -13,7 +17,7 @@ The project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled and [many more](https://npmjs.org/browse/depended/shelljs). -Connect with [@r2r](http://twitter.com/r2r) on Twitter for questions, suggestions, etc. +If you have feedback, suggestions, or need help, feel free to post in our [issue tracker](https://github.com/shelljs/shelljs/issues). ## Installing @@ -30,9 +34,6 @@ run ShellJS scripts much like any shell script from the command line, i.e. witho $ shjs my_script ``` -You can also just copy `shell.js` into your project's directory, and `require()` accordingly. - - ## Examples ### JavaScript @@ -67,6 +68,8 @@ if (exec('git commit -am "Auto-commit"').code !== 0) { ### CoffeeScript +CoffeeScript is also supported automatically: + ```coffeescript require 'shelljs/global' @@ -83,7 +86,7 @@ cd 'lib' for file in ls '*.js' sed '-i', 'BUILD_VERSION', 'v0.1.2', file sed '-i', /.*REMOVE_THIS_LINE.*\n/, '', file - sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat 'macro.js', file + sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file cd '..' # Run external tool synchronously @@ -105,31 +108,38 @@ shell.echo('hello world'); ## Make tool -A convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script. - -Example (CoffeeScript): +A convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. +In this case all shell objects are global, and command line arguments will cause the script to +execute only the corresponding function in the global `target` object. To avoid redundant calls, +target functions are executed only once per script. -```coffeescript -require 'shelljs/make' - -target.all = -> - target.bundle() - target.docs() +Example: -target.bundle = -> - cd __dirname - mkdir 'build' - cd 'lib' - (cat '*.js').to '../build/output.js' +```javascript +require('shelljs/make'); -target.docs = -> - cd __dirname - mkdir 'docs' - cd 'lib' - for file in ls '*.js' - text = grep '//@', file # extract special comments - text.replace '//@', '' # remove comment tags - text.to 'docs/my_docs.md' +target.all = function() { + target.bundle(); + target.docs(); +}; + +target.bundle = function() { + cd(__dirname); + mkdir('-p', 'build'); + cd('src'); + cat('*.js').to('../build/output.js'); +}; + +target.docs = function() { + cd(__dirname); + mkdir('-p', 'docs'); + var files = ls('src/*.js'); + for(var i = 0; i < files.length; i++) { + var text = grep('//@', files[i]); // extract special comments + text = text.replace(/\/\/@/g, ''); // remove comment tags + text.toEnd('docs/my_docs.md'); + } +}; ``` To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`. @@ -155,20 +165,26 @@ target.bundle = function(argsArray) { All commands run synchronously, unless otherwise stated. -### cd('dir') -Changes to directory `dir` for the duration of the script +### cd([dir]) +Changes to directory `dir` for the duration of the script. Changes to home +directory if no argument is supplied. ### pwd() Returns the current directory. -### ls([options ,] path [,path ...]) -### ls([options ,] path_array) +### ls([options,] [path, ...]) +### ls([options,] path_array) Available options: + `-R`: recursive + `-A`: all files (include files beginning with `.`, except for `.` and `..`) ++ `-d`: list directories themselves, not their contents ++ `-l`: list objects representing each file, each with fields containing `ls + -l` output fields. See + [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats) + for more info Examples: @@ -176,12 +192,13 @@ Examples: ls('projs/*.js'); ls('-R', '/users/me', '/tmp'); ls('-R', ['/users/me', '/tmp']); // same as above +ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...} ``` Returns array of files in the given path, or in current directory if no path provided. -### find(path [,path ...]) +### find(path [, path ...]) ### find(path_array) Examples: @@ -197,11 +214,12 @@ The main difference from `ls('-R', path)` is that the resulting file names include the base directories, e.g. `lib/resources/file1` instead of just `file1`. -### cp([options ,] source [,source ...], dest) -### cp([options ,] source_array, dest) +### cp([options,] source [, source ...], dest) +### cp([options,] source_array, dest) Available options: -+ `-f`: force ++ `-f`: force (default behavior) ++ `-n`: no-clobber + `-r, -R`: recursive Examples: @@ -215,8 +233,8 @@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above Copies files. The wildcard `*` is accepted. -### rm([options ,] file [, file ...]) -### rm([options ,] file_array) +### rm([options,] file [, file ...]) +### rm([options,] file_array) Available options: + `-f`: force @@ -233,16 +251,17 @@ rm(['some_file.txt', 'another_file.txt']); // same as above Removes files. The wildcard `*` is accepted. -### mv(source [, source ...], dest') -### mv(source_array, dest') +### mv([options ,] source [, source ...], dest') +### mv([options ,] source_array, dest') Available options: -+ `f`: force ++ `-f`: force (default behavior) ++ `-n`: no-clobber Examples: ```javascript -mv('-f', 'file', 'dir/'); +mv('-n', 'file', 'dir/'); mv('file1', 'file2', 'dir/'); mv(['file1', 'file2'], 'dir/'); // same as above ``` @@ -250,11 +269,11 @@ mv(['file1', 'file2'], 'dir/'); // same as above Moves files. The wildcard `*` is accepted. -### mkdir([options ,] dir [, dir ...]) -### mkdir([options ,] dir_array) +### mkdir([options,] dir [, dir ...]) +### mkdir([options,] dir_array) Available options: -+ `p`: full path (will create intermediate dirs if necessary) ++ `-p`: full path (will create intermediate dirs if necessary) Examples: @@ -328,7 +347,8 @@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaS those returned by `cat`, `grep`, etc). -### sed([options ,] search_regex, replacement, file) +### sed([options,] search_regex, replacement, file [, file ...]) +### sed([options,] search_regex, replacement, file_array) Available options: + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_ @@ -340,12 +360,12 @@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js'); sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js'); ``` -Reads an input string from `file` and performs a JavaScript `replace()` on the input +Reads an input string from `files` and performs a JavaScript `replace()` on the input using the given search regex and replacement string or function. Returns the new string after replacement. -### grep([options ,] regex_filter, file [, file ...]) -### grep([options ,] regex_filter, file_array) +### grep([options,] regex_filter, file [, file ...]) +### grep([options,] regex_filter, file_array) Available options: + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. @@ -369,11 +389,12 @@ Examples: var nodeExec = which('node'); ``` -Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions. +Searches for `command` in the system's PATH. On Windows, this uses the +`PATHEXT` variable to append the extension if it's not already executable. Returns string containing the absolute path to the command. -### echo(string [,string ...]) +### echo(string [, string ...]) Examples: @@ -447,12 +468,11 @@ Display the list of currently remembered directories. Returns an array of paths See also: pushd, popd -### ln(options, source, dest) -### ln(source, dest) +### ln([options,] source, dest) Available options: -+ `s`: symlink -+ `f`: force ++ `-s`: symlink ++ `-f`: force Examples: @@ -473,29 +493,33 @@ Object containing environment variables (both getter and setter). Shortcut to pr ### exec(command [, options] [, callback]) Available options (all `false` by default): -+ `async`: Asynchronous execution. Defaults to true if a callback is provided. ++ `async`: Asynchronous execution. If a callback is provided, it will be set to + `true`, regardless of the passed value. + `silent`: Do not echo program output to console. ++ and any option available to NodeJS's + [child_process.exec()](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) Examples: ```javascript -var version = exec('node --version', {silent:true}).output; +var version = exec('node --version', {silent:true}).stdout; var child = exec('some_long_running_process', {async:true}); child.stdout.on('data', function(data) { /* ... do something with data ... */ }); -exec('some_long_running_process', function(code, output) { +exec('some_long_running_process', function(code, stdout, stderr) { console.log('Exit code:', code); - console.log('Program output:', output); + console.log('Program output:', stdout); + console.log('Program stderr:', stderr); }); ``` -Executes the given `command` _synchronously_, unless otherwise specified. -When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's -`output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and -the `callback` gets the arguments `(code, output)`. +Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous +mode returns the object `{ code:..., stdout:... , stderr:... }`, containing the program's +`stdout`, `stderr`, and its exit `code`. Otherwise returns the child process object, +and the `callback` gets the arguments `(code, stdout, stderr)`. **Note:** For long-lived processes, it's best to run `exec()` asynchronously as the current synchronous implementation uses a lot of CPU. This should be getting @@ -529,6 +553,44 @@ Notable exceptions: + There is no "quiet" option since default behavior is to run silent. +### touch([options,] file) +Available options: + ++ `-a`: Change only the access time ++ `-c`: Do not create any files ++ `-m`: Change only the modification time ++ `-d DATE`: Parse DATE and use it instead of current time ++ `-r FILE`: Use FILE's times instead of current time + +Examples: + +```javascript +touch('source.js'); +touch('-c', '/path/to/some/dir/source.js'); +touch({ '-r': FILE }, '/path/to/some/dir/source.js'); +``` + +Update the access and modification times of each FILE to the current time. +A FILE argument that does not exist is created empty, unless -c is supplied. +This is a partial implementation of *[touch(1)](http://linux.die.net/man/1/touch)*. + + +### set(options) +Available options: + ++ `+/-e`: exit upon error (`config.fatal`) ++ `+/-v`: verbose: show all commands (`config.verbose`) + +Examples: + +```javascript +set('-e'); // exit upon first error +set('+e'); // this undoes a "set('-e')" +``` + +Sets global configuration variables + + ## Non-Unix commands @@ -571,9 +633,26 @@ Example: ```javascript require('shelljs/global'); -config.fatal = true; +config.fatal = true; // or set('-e'); cp('this_file_does_not_exist', '/dev/null'); // dies here /* more commands... */ ``` -If `true` the script will die on errors. Default is `false`. +If `true` the script will die on errors. Default is `false`. This is +analogous to Bash's `set -e` + +### config.verbose +Example: + +```javascript +config.verbose = true; // or set('-v'); +cd('dir/'); +ls('subdir/'); +``` + +Will print each command as follows: + +``` +cd dir/ +ls subdir/ +``` diff --git a/tools/eslint/node_modules/shelljs/RELEASE.md b/tools/eslint/node_modules/shelljs/RELEASE.md deleted file mode 100644 index 69ef3fbb0a7832..00000000000000 --- a/tools/eslint/node_modules/shelljs/RELEASE.md +++ /dev/null @@ -1,9 +0,0 @@ -# Release steps - -* Ensure master passes CI tests -* Bump version in package.json. Any breaking change or new feature should bump minor (or even major). Non-breaking changes or fixes can just bump patch. -* Update README manually if the changes are not documented in-code. If so, run `scripts/generate-docs.js` -* Commit -* `$ git tag ` (see `git tag -l` for latest) -* `$ git push origin master --tags` -* `$ npm publish .` diff --git a/tools/eslint/node_modules/shelljs/bin/shjs b/tools/eslint/node_modules/shelljs/bin/shjs index d239a7ad4b987a..aae3bc64ce2b68 100755 --- a/tools/eslint/node_modules/shelljs/bin/shjs +++ b/tools/eslint/node_modules/shelljs/bin/shjs @@ -37,7 +37,9 @@ if (scriptName.match(/\.coffee$/)) { // CoffeeScript // if (which('coffee')) { - exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true }); + exec('coffee "' + scriptName + '" ' + args.join(' '), function(code) { + process.exit(code); + }); } else { console.log('ShellJS: CoffeeScript interpreter not found'); console.log(); @@ -47,5 +49,7 @@ if (scriptName.match(/\.coffee$/)) { // // JavaScript // - exec('node ' + scriptName + ' ' + args.join(' '), { async: true }); + exec('node "' + scriptName + '" ' + args.join(' '), function(code) { + process.exit(code); + }); } diff --git a/tools/eslint/node_modules/shelljs/build/output.js b/tools/eslint/node_modules/shelljs/build/output.js new file mode 100644 index 00000000000000..1b778b93183ee1 --- /dev/null +++ b/tools/eslint/node_modules/shelljs/build/output.js @@ -0,0 +1,2411 @@ +var common = require('./common'); +var fs = require('fs'); + +//@ +//@ ### cat(file [, file ...]) +//@ ### cat(file_array) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ var str = cat('file*.txt'); +//@ var str = cat('file1', 'file2'); +//@ var str = cat(['file1', 'file2']); // same as above +//@ ``` +//@ +//@ Returns a string containing the given file, or a concatenated string +//@ containing the files if more than one file is given (a new line character is +//@ introduced between each file). Wildcard `*` accepted. +function _cat(options, files) { + var cat = ''; + + if (!files) + common.error('no paths given'); + + if (typeof files === 'string') + files = [].slice.call(arguments, 1); + // if it's array leave it as it is + + files = common.expand(files); + + files.forEach(function(file) { + if (!fs.existsSync(file)) + common.error('no such file or directory: ' + file); + + cat += fs.readFileSync(file, 'utf8'); + }); + + return common.ShellString(cat); +} +module.exports = _cat; + +var fs = require('fs'); +var common = require('./common'); + +//@ +//@ ### cd([dir]) +//@ Changes to directory `dir` for the duration of the script. Changes to home +//@ directory if no argument is supplied. +function _cd(options, dir) { + if (!dir) + dir = common.getUserHome(); + + if (dir === '-') { + if (!common.state.previousDir) + common.error('could not find previous directory'); + else + dir = common.state.previousDir; + } + + if (!fs.existsSync(dir)) + common.error('no such file or directory: ' + dir); + + if (!fs.statSync(dir).isDirectory()) + common.error('not a directory: ' + dir); + + common.state.previousDir = process.cwd(); + process.chdir(dir); +} +module.exports = _cd; + +var common = require('./common'); +var fs = require('fs'); +var path = require('path'); + +var PERMS = (function (base) { + return { + OTHER_EXEC : base.EXEC, + OTHER_WRITE : base.WRITE, + OTHER_READ : base.READ, + + GROUP_EXEC : base.EXEC << 3, + GROUP_WRITE : base.WRITE << 3, + GROUP_READ : base.READ << 3, + + OWNER_EXEC : base.EXEC << 6, + OWNER_WRITE : base.WRITE << 6, + OWNER_READ : base.READ << 6, + + // Literal octal numbers are apparently not allowed in "strict" javascript. Using parseInt is + // the preferred way, else a jshint warning is thrown. + STICKY : parseInt('01000', 8), + SETGID : parseInt('02000', 8), + SETUID : parseInt('04000', 8), + + TYPE_MASK : parseInt('0770000', 8) + }; +})({ + EXEC : 1, + WRITE : 2, + READ : 4 +}); + +//@ +//@ ### chmod(octal_mode || octal_string, file) +//@ ### chmod(symbolic_mode, file) +//@ +//@ Available options: +//@ +//@ + `-v`: output a diagnostic for every file processed//@ +//@ + `-c`: like verbose but report only when a change is made//@ +//@ + `-R`: change files and directories recursively//@ +//@ +//@ Examples: +//@ +//@ ```javascript +//@ chmod(755, '/Users/brandon'); +//@ chmod('755', '/Users/brandon'); // same as above +//@ chmod('u+x', '/Users/brandon'); +//@ ``` +//@ +//@ Alters the permissions of a file or directory by either specifying the +//@ absolute permissions in octal form or expressing the changes in symbols. +//@ This command tries to mimic the POSIX behavior as much as possible. +//@ Notable exceptions: +//@ +//@ + In symbolic modes, 'a-r' and '-r' are identical. No consideration is +//@ given to the umask. +//@ + There is no "quiet" option since default behavior is to run silent. +function _chmod(options, mode, filePattern) { + if (!filePattern) { + if (options.length > 0 && options.charAt(0) === '-') { + // Special case where the specified file permissions started with - to subtract perms, which + // get picked up by the option parser as command flags. + // If we are down by one argument and options starts with -, shift everything over. + filePattern = mode; + mode = options; + options = ''; + } + else { + common.error('You must specify a file.'); + } + } + + options = common.parseOptions(options, { + 'R': 'recursive', + 'c': 'changes', + 'v': 'verbose' + }); + + if (typeof filePattern === 'string') { + filePattern = [ filePattern ]; + } + + var files; + + if (options.recursive) { + files = []; + common.expand(filePattern).forEach(function addFile(expandedFile) { + var stat = fs.lstatSync(expandedFile); + + if (!stat.isSymbolicLink()) { + files.push(expandedFile); + + if (stat.isDirectory()) { // intentionally does not follow symlinks. + fs.readdirSync(expandedFile).forEach(function (child) { + addFile(expandedFile + '/' + child); + }); + } + } + }); + } + else { + files = common.expand(filePattern); + } + + files.forEach(function innerChmod(file) { + file = path.resolve(file); + if (!fs.existsSync(file)) { + common.error('File not found: ' + file); + } + + // When recursing, don't follow symlinks. + if (options.recursive && fs.lstatSync(file).isSymbolicLink()) { + return; + } + + var stat = fs.statSync(file); + var isDir = stat.isDirectory(); + var perms = stat.mode; + var type = perms & PERMS.TYPE_MASK; + + var newPerms = perms; + + if (isNaN(parseInt(mode, 8))) { + // parse options + mode.split(',').forEach(function (symbolicMode) { + /*jshint regexdash:true */ + var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i; + var matches = pattern.exec(symbolicMode); + + if (matches) { + var applyTo = matches[1]; + var operator = matches[2]; + var change = matches[3]; + + var changeOwner = applyTo.indexOf('u') != -1 || applyTo === 'a' || applyTo === ''; + var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === ''; + var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === ''; + + var changeRead = change.indexOf('r') != -1; + var changeWrite = change.indexOf('w') != -1; + var changeExec = change.indexOf('x') != -1; + var changeExecDir = change.indexOf('X') != -1; + var changeSticky = change.indexOf('t') != -1; + var changeSetuid = change.indexOf('s') != -1; + + if (changeExecDir && isDir) + changeExec = true; + + var mask = 0; + if (changeOwner) { + mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0); + } + if (changeGroup) { + mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0); + } + if (changeOther) { + mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0); + } + + // Sticky bit is special - it's not tied to user, group or other. + if (changeSticky) { + mask |= PERMS.STICKY; + } + + switch (operator) { + case '+': + newPerms |= mask; + break; + + case '-': + newPerms &= ~mask; + break; + + case '=': + newPerms = type + mask; + + // According to POSIX, when using = to explicitly set the permissions, setuid and setgid can never be cleared. + if (fs.statSync(file).isDirectory()) { + newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; + } + break; + } + + if (options.verbose) { + console.log(file + ' -> ' + newPerms.toString(8)); + } + + if (perms != newPerms) { + if (!options.verbose && options.changes) { + console.log(file + ' -> ' + newPerms.toString(8)); + } + fs.chmodSync(file, newPerms); + perms = newPerms; // for the next round of changes! + } + } + else { + common.error('Invalid symbolic mode change: ' + symbolicMode); + } + }); + } + else { + // they gave us a full number + newPerms = type + parseInt(mode, 8); + + // POSIX rules are that setuid and setgid can only be added using numeric form, but not cleared. + if (fs.statSync(file).isDirectory()) { + newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; + } + + fs.chmodSync(file, newPerms); + } + }); +} +module.exports = _chmod; + +var os = require('os'); +var fs = require('fs'); +var _ls = require('./ls'); + +// Module globals +var config = { + silent: false, + fatal: false, + verbose: false, +}; +exports.config = config; + +var state = { + error: null, + currentCmd: 'shell.js', + previousDir: null, + tempDir: null +}; +exports.state = state; + +var platform = os.type().match(/^Win/) ? 'win' : 'unix'; +exports.platform = platform; + +function log() { + if (!config.silent) + console.error.apply(console, arguments); +} +exports.log = log; + +// Shows error message. Throws unless _continue or config.fatal are true +function error(msg, _continue) { + if (state.error === null) + state.error = ''; + var log_entry = state.currentCmd + ': ' + msg; + if (state.error === '') + state.error = log_entry; + else + state.error += '\n' + log_entry; + + if (msg.length > 0) + log(log_entry); + + if (config.fatal) + process.exit(1); + + if (!_continue) + throw ''; +} +exports.error = error; + +// In the future, when Proxies are default, we can add methods like `.to()` to primitive strings. +// For now, this is a dummy function to bookmark places we need such strings +function ShellString(str) { + return str; +} +exports.ShellString = ShellString; + +// Return the home directory in a platform-agnostic way, with consideration for +// older versions of node +function getUserHome() { + var result; + if (os.homedir) + result = os.homedir(); // node 3+ + else + result = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME']; + return result; +} +exports.getUserHome = getUserHome; + +// Returns {'alice': true, 'bob': false} when passed a dictionary, e.g.: +// parseOptions('-a', {'a':'alice', 'b':'bob'}); +function parseOptions(str, map) { + if (!map) + error('parseOptions() internal error: no map given'); + + // All options are false by default + var options = {}; + for (var letter in map) { + if (!map[letter].match('^!')) + options[map[letter]] = false; + } + + if (!str) + return options; // defaults + + if (typeof str !== 'string') + error('parseOptions() internal error: wrong str'); + + // e.g. match[1] = 'Rf' for str = '-Rf' + var match = str.match(/^\-(.+)/); + if (!match) + return options; + + // e.g. chars = ['R', 'f'] + var chars = match[1].split(''); + + var opt; + chars.forEach(function(c) { + if (c in map) { + opt = map[c]; + if (opt.match('^!')) + options[opt.slice(1, opt.length-1)] = false; + else + options[opt] = true; + } else { + error('option not recognized: '+c); + } + }); + + return options; +} +exports.parseOptions = parseOptions; + +// Expands wildcards with matching (ie. existing) file names. +// For example: +// expand(['file*.js']) = ['file1.js', 'file2.js', ...] +// (if the files 'file1.js', 'file2.js', etc, exist in the current dir) +function expand(list) { + var expanded = []; + list.forEach(function(listEl) { + // Wildcard present on directory names ? + if(listEl.search(/\*[^\/]*\//) > -1 || listEl.search(/\*\*[^\/]*\//) > -1) { + var match = listEl.match(/^([^*]+\/|)(.*)/); + var root = match[1]; + var rest = match[2]; + var restRegex = rest.replace(/\*\*/g, ".*").replace(/\*/g, "[^\\/]*"); + restRegex = new RegExp(restRegex); + + _ls('-R', root).filter(function (e) { + return restRegex.test(e); + }).forEach(function(file) { + expanded.push(file); + }); + } + // Wildcard present on file names ? + else if (listEl.search(/\*/) > -1) { + _ls('', listEl).forEach(function(file) { + expanded.push(file); + }); + } else { + expanded.push(listEl); + } + }); + return expanded; +} +exports.expand = expand; + +// Normalizes _unlinkSync() across platforms to match Unix behavior, i.e. +// file can be unlinked even if it's read-only, see https://github.com/joyent/node/issues/3006 +function unlinkSync(file) { + try { + fs.unlinkSync(file); + } catch(e) { + // Try to override file permission + if (e.code === 'EPERM') { + fs.chmodSync(file, '0666'); + fs.unlinkSync(file); + } else { + throw e; + } + } +} +exports.unlinkSync = unlinkSync; + +// e.g. 'shelljs_a5f185d0443ca...' +function randomFileName() { + function randomHash(count) { + if (count === 1) + return parseInt(16*Math.random(), 10).toString(16); + else { + var hash = ''; + for (var i=0; i and/or '); + } else if (arguments.length > 3) { + sources = [].slice.call(arguments, 1, arguments.length - 1); + dest = arguments[arguments.length - 1]; + } else if (typeof sources === 'string') { + sources = [sources]; + } else if ('length' in sources) { + sources = sources; // no-op for array + } else { + common.error('invalid arguments'); + } + + var exists = fs.existsSync(dest), + stats = exists && fs.statSync(dest); + + // Dest is not existing dir, but multiple sources given + if ((!exists || !stats.isDirectory()) && sources.length > 1) + common.error('dest is not a directory (too many sources)'); + + // Dest is an existing file, but no -f given + if (exists && stats.isFile() && options.no_force) + common.error('dest file already exists: ' + dest); + + if (options.recursive) { + // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*" + // (see Github issue #15) + sources.forEach(function(src, i) { + if (src[src.length - 1] === '/') { + sources[i] += '*'; + // If src is a directory and dest doesn't exist, 'cp -r src dest' should copy src/* into dest + } else if (fs.statSync(src).isDirectory() && !exists) { + sources[i] += '/*'; + } + }); + + // Create dest + try { + fs.mkdirSync(dest, parseInt('0777', 8)); + } catch (e) { + // like Unix's cp, keep going even if we can't create dest dir + } + } + + sources = common.expand(sources); + + sources.forEach(function(src) { + if (!fs.existsSync(src)) { + common.error('no such file or directory: '+src, true); + return; // skip file + } + + // If here, src exists + if (fs.statSync(src).isDirectory()) { + if (!options.recursive) { + // Non-Recursive + common.log(src + ' is a directory (not copied)'); + } else { + // Recursive + // 'cp /a/source dest' should create 'source' in 'dest' + var newDest = path.join(dest, path.basename(src)), + checkDir = fs.statSync(src); + try { + fs.mkdirSync(newDest, checkDir.mode); + } catch (e) { + //if the directory already exists, that's okay + if (e.code !== 'EEXIST') { + common.error('dest file no such file or directory: ' + newDest, true); + throw e; + } + } + + cpdirSyncRecursive(src, newDest, {no_force: options.no_force}); + } + return; // done with dir + } + + // If here, src is a file + + // When copying to '/path/dir': + // thisDest = '/path/dir/file1' + var thisDest = dest; + if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) + thisDest = path.normalize(dest + '/' + path.basename(src)); + + if (fs.existsSync(thisDest) && options.no_force) { + common.error('dest file already exists: ' + thisDest, true); + return; // skip file + } + + copyFileSync(src, thisDest); + }); // forEach(src) +} +module.exports = _cp; + +var common = require('./common'); +var _cd = require('./cd'); +var path = require('path'); + +// Pushd/popd/dirs internals +var _dirStack = []; + +function _isStackIndex(index) { + return (/^[\-+]\d+$/).test(index); +} + +function _parseStackIndex(index) { + if (_isStackIndex(index)) { + if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd + return (/^-/).test(index) ? Number(index) - 1 : Number(index); + } else { + common.error(index + ': directory stack index out of range'); + } + } else { + common.error(index + ': invalid number'); + } +} + +function _actualDirStack() { + return [process.cwd()].concat(_dirStack); +} + +//@ +//@ ### pushd([options,] [dir | '-N' | '+N']) +//@ +//@ Available options: +//@ +//@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. +//@ +//@ Arguments: +//@ +//@ + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`. +//@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. +//@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. +//@ +//@ Examples: +//@ +//@ ```javascript +//@ // process.cwd() === '/usr' +//@ pushd('/etc'); // Returns /etc /usr +//@ pushd('+1'); // Returns /usr /etc +//@ ``` +//@ +//@ Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack. +function _pushd(options, dir) { + if (_isStackIndex(options)) { + dir = options; + options = ''; + } + + options = common.parseOptions(options, { + 'n' : 'no-cd' + }); + + var dirs = _actualDirStack(); + + if (dir === '+0') { + return dirs; // +0 is a noop + } else if (!dir) { + if (dirs.length > 1) { + dirs = dirs.splice(1, 1).concat(dirs); + } else { + return common.error('no other directory'); + } + } else if (_isStackIndex(dir)) { + var n = _parseStackIndex(dir); + dirs = dirs.slice(n).concat(dirs.slice(0, n)); + } else { + if (options['no-cd']) { + dirs.splice(1, 0, dir); + } else { + dirs.unshift(dir); + } + } + + if (options['no-cd']) { + dirs = dirs.slice(1); + } else { + dir = path.resolve(dirs.shift()); + _cd('', dir); + } + + _dirStack = dirs; + return _dirs(''); +} +exports.pushd = _pushd; + +//@ +//@ ### popd([options,] ['-N' | '+N']) +//@ +//@ Available options: +//@ +//@ + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated. +//@ +//@ Arguments: +//@ +//@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero. +//@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero. +//@ +//@ Examples: +//@ +//@ ```javascript +//@ echo(process.cwd()); // '/usr' +//@ pushd('/etc'); // '/etc /usr' +//@ echo(process.cwd()); // '/etc' +//@ popd(); // '/usr' +//@ echo(process.cwd()); // '/usr' +//@ ``` +//@ +//@ When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack. +function _popd(options, index) { + if (_isStackIndex(options)) { + index = options; + options = ''; + } + + options = common.parseOptions(options, { + 'n' : 'no-cd' + }); + + if (!_dirStack.length) { + return common.error('directory stack empty'); + } + + index = _parseStackIndex(index || '+0'); + + if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) { + index = index > 0 ? index - 1 : index; + _dirStack.splice(index, 1); + } else { + var dir = path.resolve(_dirStack.shift()); + _cd('', dir); + } + + return _dirs(''); +} +exports.popd = _popd; + +//@ +//@ ### dirs([options | '+N' | '-N']) +//@ +//@ Available options: +//@ +//@ + `-c`: Clears the directory stack by deleting all of the elements. +//@ +//@ Arguments: +//@ +//@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero. +//@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero. +//@ +//@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified. +//@ +//@ See also: pushd, popd +function _dirs(options, index) { + if (_isStackIndex(options)) { + index = options; + options = ''; + } + + options = common.parseOptions(options, { + 'c' : 'clear' + }); + + if (options['clear']) { + _dirStack = []; + return _dirStack; + } + + var stack = _actualDirStack(); + + if (index) { + index = _parseStackIndex(index); + + if (index < 0) { + index = stack.length + index; + } + + common.log(stack[index]); + return stack[index]; + } + + common.log(stack.join(' ')); + + return stack; +} +exports.dirs = _dirs; + +var common = require('./common'); + +//@ +//@ ### echo(string [, string ...]) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ echo('hello world'); +//@ var str = echo('hello world'); +//@ ``` +//@ +//@ Prints string to stdout, and returns string with additional utility methods +//@ like `.to()`. +function _echo() { + var messages = [].slice.call(arguments, 0); + console.log.apply(console, messages); + return common.ShellString(messages.join(' ')); +} +module.exports = _echo; + +var common = require('./common'); + +//@ +//@ ### error() +//@ Tests if error occurred in the last command. Returns `null` if no error occurred, +//@ otherwise returns string explaining the error +function error() { + return common.state.error; +} +module.exports = error; + +var common = require('./common'); +var _tempDir = require('./tempdir'); +var _pwd = require('./pwd'); +var path = require('path'); +var fs = require('fs'); +var child = require('child_process'); + +// Hack to run child_process.exec() synchronously (sync avoids callback hell) +// Uses a custom wait loop that checks for a flag file, created when the child process is done. +// (Can't do a wait loop that checks for internal Node variables/messages as +// Node is single-threaded; callbacks and other internal state changes are done in the +// event loop). +function execSync(cmd, opts) { + var tempDir = _tempDir(); + var stdoutFile = path.resolve(tempDir+'/'+common.randomFileName()), + stderrFile = path.resolve(tempDir+'/'+common.randomFileName()), + codeFile = path.resolve(tempDir+'/'+common.randomFileName()), + scriptFile = path.resolve(tempDir+'/'+common.randomFileName()), + sleepFile = path.resolve(tempDir+'/'+common.randomFileName()); + + var options = common.extend({ + silent: common.config.silent + }, opts); + + var previousStdoutContent = '', + previousStderrContent = ''; + // Echoes stdout and stderr changes from running process, if not silent + function updateStream(streamFile) { + if (options.silent || !fs.existsSync(streamFile)) + return; + + var previousStreamContent, + proc_stream; + if (streamFile === stdoutFile) { + previousStreamContent = previousStdoutContent; + proc_stream = process.stdout; + } else { // assume stderr + previousStreamContent = previousStderrContent; + proc_stream = process.stderr; + } + + var streamContent = fs.readFileSync(streamFile, 'utf8'); + // No changes since last time? + if (streamContent.length <= previousStreamContent.length) + return; + + proc_stream.write(streamContent.substr(previousStreamContent.length)); + previousStreamContent = streamContent; + } + + function escape(str) { + return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0"); + } + + if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile); + if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile); + if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile); + if (fs.existsSync(codeFile)) common.unlinkSync(codeFile); + + var execCommand = '"'+process.execPath+'" '+scriptFile; + var execOptions = { + env: process.env, + cwd: _pwd(), + maxBuffer: 20*1024*1024 + }; + + var script; + + if (typeof child.execSync === 'function') { + script = [ + "var child = require('child_process')", + " , fs = require('fs');", + "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {", + " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');", + "});", + "var stdoutStream = fs.createWriteStream('"+escape(stdoutFile)+"');", + "var stderrStream = fs.createWriteStream('"+escape(stderrFile)+"');", + "childProcess.stdout.pipe(stdoutStream, {end: false});", + "childProcess.stderr.pipe(stderrStream, {end: false});", + "childProcess.stdout.pipe(process.stdout);", + "childProcess.stderr.pipe(process.stderr);", + "var stdoutEnded = false, stderrEnded = false;", + "function tryClosingStdout(){ if(stdoutEnded){ stdoutStream.end(); } }", + "function tryClosingStderr(){ if(stderrEnded){ stderrStream.end(); } }", + "childProcess.stdout.on('end', function(){ stdoutEnded = true; tryClosingStdout(); });", + "childProcess.stderr.on('end', function(){ stderrEnded = true; tryClosingStderr(); });" + ].join('\n'); + + fs.writeFileSync(scriptFile, script); + + if (options.silent) { + execOptions.stdio = 'ignore'; + } else { + execOptions.stdio = [0, 1, 2]; + } + + // Welcome to the future + child.execSync(execCommand, execOptions); + } else { + cmd += ' > '+stdoutFile+' 2> '+stderrFile; // works on both win/unix + + script = [ + "var child = require('child_process')", + " , fs = require('fs');", + "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {", + " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');", + "});" + ].join('\n'); + + fs.writeFileSync(scriptFile, script); + + child.exec(execCommand, execOptions); + + // The wait loop + // sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage + // (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing + // CPU usage, though apparently not so much on Windows) + while (!fs.existsSync(codeFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); } + while (!fs.existsSync(stdoutFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); } + while (!fs.existsSync(stderrFile)) { updateStream(stderrFile); fs.writeFileSync(sleepFile, 'a'); } + } + + // At this point codeFile exists, but it's not necessarily flushed yet. + // Keep reading it until it is. + var code = parseInt('', 10); + while (isNaN(code)) { + code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10); + } + + var stdout = fs.readFileSync(stdoutFile, 'utf8'); + var stderr = fs.readFileSync(stderrFile, 'utf8'); + + // No biggie if we can't erase the files now -- they're in a temp dir anyway + try { common.unlinkSync(scriptFile); } catch(e) {} + try { common.unlinkSync(stdoutFile); } catch(e) {} + try { common.unlinkSync(stderrFile); } catch(e) {} + try { common.unlinkSync(codeFile); } catch(e) {} + try { common.unlinkSync(sleepFile); } catch(e) {} + + // some shell return codes are defined as errors, per http://tldp.org/LDP/abs/html/exitcodes.html + if (code === 1 || code === 2 || code >= 126) { + common.error('', true); // unix/shell doesn't really give an error message after non-zero exit codes + } + // True if successful, false if not + var obj = { + code: code, + output: stdout, // deprecated + stdout: stdout, + stderr: stderr + }; + return obj; +} // execSync() + +// Wrapper around exec() to enable echoing output to console in real time +function execAsync(cmd, opts, callback) { + var stdout = ''; + var stderr = ''; + + var options = common.extend({ + silent: common.config.silent + }, opts); + + var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) { + if (callback) + callback(err ? err.code : 0, stdout, stderr); + }); + + c.stdout.on('data', function(data) { + stdout += data; + if (!options.silent) + process.stdout.write(data); + }); + + c.stderr.on('data', function(data) { + stderr += data; + if (!options.silent) + process.stderr.write(data); + }); + + return c; +} + +//@ +//@ ### exec(command [, options] [, callback]) +//@ Available options (all `false` by default): +//@ +//@ + `async`: Asynchronous execution. If a callback is provided, it will be set to +//@ `true`, regardless of the passed value. +//@ + `silent`: Do not echo program output to console. +//@ +//@ Examples: +//@ +//@ ```javascript +//@ var version = exec('node --version', {silent:true}).stdout; +//@ +//@ var child = exec('some_long_running_process', {async:true}); +//@ child.stdout.on('data', function(data) { +//@ /* ... do something with data ... */ +//@ }); +//@ +//@ exec('some_long_running_process', function(code, stdout, stderr) { +//@ console.log('Exit code:', code); +//@ console.log('Program output:', stdout); +//@ console.log('Program stderr:', stderr); +//@ }); +//@ ``` +//@ +//@ Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous +//@ mode returns the object `{ code:..., stdout:... , stderr:... }`, containing the program's +//@ `stdout`, `stderr`, and its exit `code`. Otherwise returns the child process object, +//@ and the `callback` gets the arguments `(code, stdout, stderr)`. +//@ +//@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as +//@ the current synchronous implementation uses a lot of CPU. This should be getting +//@ fixed soon. +function _exec(command, options, callback) { + if (!command) + common.error('must specify command'); + + // Callback is defined instead of options. + if (typeof options === 'function') { + callback = options; + options = { async: true }; + } + + // Callback is defined with options. + if (typeof options === 'object' && typeof callback === 'function') { + options.async = true; + } + + options = common.extend({ + silent: common.config.silent, + async: false + }, options); + + if (options.async) + return execAsync(command, options, callback); + else + return execSync(command, options); +} +module.exports = _exec; + +var fs = require('fs'); +var common = require('./common'); +var _ls = require('./ls'); + +//@ +//@ ### find(path [, path ...]) +//@ ### find(path_array) +//@ Examples: +//@ +//@ ```javascript +//@ find('src', 'lib'); +//@ find(['src', 'lib']); // same as above +//@ find('.').filter(function(file) { return file.match(/\.js$/); }); +//@ ``` +//@ +//@ Returns array of all files (however deep) in the given paths. +//@ +//@ The main difference from `ls('-R', path)` is that the resulting file names +//@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`. +function _find(options, paths) { + if (!paths) + common.error('no path specified'); + else if (typeof paths === 'object') + paths = paths; // assume array + else if (typeof paths === 'string') + paths = [].slice.call(arguments, 1); + + var list = []; + + function pushFile(file) { + if (common.platform === 'win') + file = file.replace(/\\/g, '/'); + list.push(file); + } + + // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs + // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory + + paths.forEach(function(file) { + pushFile(file); + + if (fs.statSync(file).isDirectory()) { + _ls('-RA', file+'/*').forEach(function(subfile) { + pushFile(subfile); + }); + } + }); + + return list; +} +module.exports = _find; + +var common = require('./common'); +var fs = require('fs'); + +//@ +//@ ### grep([options,] regex_filter, file [, file ...]) +//@ ### grep([options,] regex_filter, file_array) +//@ Available options: +//@ +//@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. +//@ +//@ Examples: +//@ +//@ ```javascript +//@ grep('-v', 'GLOBAL_VARIABLE', '*.js'); +//@ grep('GLOBAL_VARIABLE', '*.js'); +//@ ``` +//@ +//@ Reads input string from given files and returns a string containing all lines of the +//@ file that match the given `regex_filter`. Wildcard `*` accepted. +function _grep(options, regex, files) { + options = common.parseOptions(options, { + 'v': 'inverse' + }); + + if (!files) + common.error('no paths given'); + + if (typeof files === 'string') + files = [].slice.call(arguments, 2); + // if it's array leave it as it is + + files = common.expand(files); + + var grep = ''; + files.forEach(function(file) { + if (!fs.existsSync(file)) { + common.error('no such file or directory: ' + file, true); + return; + } + + var contents = fs.readFileSync(file, 'utf8'), + lines = contents.split(/\r*\n/); + lines.forEach(function(line) { + var matched = line.match(regex); + if ((options.inverse && !matched) || (!options.inverse && matched)) + grep += line + '\n'; + }); + }); + + return common.ShellString(grep); +} +module.exports = _grep; + +var fs = require('fs'); +var path = require('path'); +var common = require('./common'); + +//@ +//@ ### ln([options,] source, dest) +//@ Available options: +//@ +//@ + `-s`: symlink +//@ + `-f`: force +//@ +//@ Examples: +//@ +//@ ```javascript +//@ ln('file', 'newlink'); +//@ ln('-sf', 'file', 'existing'); +//@ ``` +//@ +//@ Links source to dest. Use -f to force the link, should dest already exist. +function _ln(options, source, dest) { + options = common.parseOptions(options, { + 's': 'symlink', + 'f': 'force' + }); + + if (!source || !dest) { + common.error('Missing and/or '); + } + + source = String(source); + var sourcePath = path.normalize(source).replace(RegExp(path.sep + '$'), ''); + var isAbsolute = (path.resolve(source) === sourcePath); + dest = path.resolve(process.cwd(), String(dest)); + + if (fs.existsSync(dest)) { + if (!options.force) { + common.error('Destination file exists', true); + } + + fs.unlinkSync(dest); + } + + if (options.symlink) { + var isWindows = common.platform === 'win'; + var linkType = isWindows ? 'file' : null; + var resolvedSourcePath = isAbsolute ? sourcePath : path.resolve(process.cwd(), path.dirname(dest), source); + if (!fs.existsSync(resolvedSourcePath)) { + common.error('Source file does not exist', true); + } else if (isWindows && fs.statSync(resolvedSourcePath).isDirectory()) { + linkType = 'junction'; + } + + try { + fs.symlinkSync(linkType === 'junction' ? resolvedSourcePath: source, dest, linkType); + } catch (err) { + common.error(err.message); + } + } else { + if (!fs.existsSync(source)) { + common.error('Source file does not exist', true); + } + try { + fs.linkSync(source, dest); + } catch (err) { + common.error(err.message); + } + } +} +module.exports = _ln; + +var path = require('path'); +var fs = require('fs'); +var common = require('./common'); +var _cd = require('./cd'); +var _pwd = require('./pwd'); + +//@ +//@ ### ls([options,] [path, ...]) +//@ ### ls([options,] path_array) +//@ Available options: +//@ +//@ + `-R`: recursive +//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`) +//@ + `-d`: list directories themselves, not their contents +//@ + `-l`: list objects representing each file, each with fields containing `ls +//@ -l` output fields. See +//@ [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats) +//@ for more info +//@ +//@ Examples: +//@ +//@ ```javascript +//@ ls('projs/*.js'); +//@ ls('-R', '/users/me', '/tmp'); +//@ ls('-R', ['/users/me', '/tmp']); // same as above +//@ ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...} +//@ ``` +//@ +//@ Returns array of files in the given path, or in current directory if no path provided. +function _ls(options, paths) { + options = common.parseOptions(options, { + 'R': 'recursive', + 'A': 'all', + 'a': 'all_deprecated', + 'd': 'directory', + 'l': 'long' + }); + + if (options.all_deprecated) { + // We won't support the -a option as it's hard to image why it's useful + // (it includes '.' and '..' in addition to '.*' files) + // For backwards compatibility we'll dump a deprecated message and proceed as before + common.log('ls: Option -a is deprecated. Use -A instead'); + options.all = true; + } + + if (!paths) + paths = ['.']; + else if (typeof paths === 'object') + paths = paths; // assume array + else if (typeof paths === 'string') + paths = [].slice.call(arguments, 1); + + var list = []; + + // Conditionally pushes file to list - returns true if pushed, false otherwise + // (e.g. prevents hidden files to be included unless explicitly told so) + function pushFile(file, query) { + var name = file.name || file; + // hidden file? + if (path.basename(name)[0] === '.') { + // not explicitly asking for hidden files? + if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1)) + return false; + } + + if (common.platform === 'win') + name = name.replace(/\\/g, '/'); + + if (file.name) { + file.name = name; + } else { + file = name; + } + list.push(file); + return true; + } + + paths.forEach(function(p) { + if (fs.existsSync(p)) { + var stats = ls_stat(p); + // Simple file? + if (stats.isFile()) { + if (options.long) { + pushFile(stats, p); + } else { + pushFile(p, p); + } + return; // continue + } + + // Simple dir? + if (options.directory) { + pushFile(p, p); + return; + } else if (stats.isDirectory()) { + // Iterate over p contents + fs.readdirSync(p).forEach(function(file) { + var orig_file = file; + if (options.long) + file = ls_stat(path.join(p, file)); + if (!pushFile(file, p)) + return; + + // Recursive? + if (options.recursive) { + var oldDir = _pwd(); + _cd('', p); + if (fs.statSync(orig_file).isDirectory()) + list = list.concat(_ls('-R'+(options.all?'A':''), orig_file+'/*')); + _cd('', oldDir); + } + }); + return; // continue + } + } + + // p does not exist - possible wildcard present + + var basename = path.basename(p); + var dirname = path.dirname(p); + // Wildcard present on an existing dir? (e.g. '/tmp/*.js') + if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) { + // Escape special regular expression chars + var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1'); + // Translates wildcard into regex + regexp = '^' + regexp.replace(/\*/g, '.*') + '$'; + // Iterate over directory contents + fs.readdirSync(dirname).forEach(function(file) { + if (file.match(new RegExp(regexp))) { + var file_path = path.join(dirname, file); + file_path = options.long ? ls_stat(file_path) : file_path; + if (file_path.name) + file_path.name = path.normalize(file_path.name); + else + file_path = path.normalize(file_path); + if (!pushFile(file_path, basename)) + return; + + // Recursive? + if (options.recursive) { + var pp = dirname + '/' + file; + if (fs.lstatSync(pp).isDirectory()) + list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*')); + } // recursive + } // if file matches + }); // forEach + return; + } + + common.error('no such file or directory: ' + p, true); + }); + + return list; +} +module.exports = _ls; + + +function ls_stat(path) { + var stats = fs.statSync(path); + // Note: this object will contain more information than .toString() returns + stats.name = path; + stats.toString = function() { + // Return a string resembling unix's `ls -l` format + return [this.mode, this.nlink, this.uid, this.gid, this.size, this.mtime, this.name].join(' '); + }; + return stats; +} + +var common = require('./common'); +var fs = require('fs'); +var path = require('path'); + +// Recursively creates 'dir' +function mkdirSyncRecursive(dir) { + var baseDir = path.dirname(dir); + + // Base dir exists, no recursion necessary + if (fs.existsSync(baseDir)) { + fs.mkdirSync(dir, parseInt('0777', 8)); + return; + } + + // Base dir does not exist, go recursive + mkdirSyncRecursive(baseDir); + + // Base dir created, can create dir + fs.mkdirSync(dir, parseInt('0777', 8)); +} + +//@ +//@ ### mkdir([options,] dir [, dir ...]) +//@ ### mkdir([options,] dir_array) +//@ Available options: +//@ +//@ + `-p`: full path (will create intermediate dirs if necessary) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g'); +//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above +//@ ``` +//@ +//@ Creates directories. +function _mkdir(options, dirs) { + options = common.parseOptions(options, { + 'p': 'fullpath' + }); + if (!dirs) + common.error('no paths given'); + + if (typeof dirs === 'string') + dirs = [].slice.call(arguments, 1); + // if it's array leave it as it is + + dirs.forEach(function(dir) { + if (fs.existsSync(dir)) { + if (!options.fullpath) + common.error('path already exists: ' + dir, true); + return; // skip dir + } + + // Base dir does not exist, and no -p option given + var baseDir = path.dirname(dir); + if (!fs.existsSync(baseDir) && !options.fullpath) { + common.error('no such file or directory: ' + baseDir, true); + return; // skip dir + } + + if (options.fullpath) + mkdirSyncRecursive(dir); + else + fs.mkdirSync(dir, parseInt('0777', 8)); + }); +} // mkdir +module.exports = _mkdir; + +var fs = require('fs'); +var path = require('path'); +var common = require('./common'); + +//@ +//@ ### mv([options ,] source [, source ...], dest') +//@ ### mv([options ,] source_array, dest') +//@ Available options: +//@ +//@ + `-f`: force (default behavior) +//@ + `-n`: no-clobber +//@ +//@ Examples: +//@ +//@ ```javascript +//@ mv('-n', 'file', 'dir/'); +//@ mv('file1', 'file2', 'dir/'); +//@ mv(['file1', 'file2'], 'dir/'); // same as above +//@ ``` +//@ +//@ Moves files. The wildcard `*` is accepted. +function _mv(options, sources, dest) { + options = common.parseOptions(options, { + 'f': '!no_force', + 'n': 'no_force' + }); + + // Get sources, dest + if (arguments.length < 3) { + common.error('missing and/or '); + } else if (arguments.length > 3) { + sources = [].slice.call(arguments, 1, arguments.length - 1); + dest = arguments[arguments.length - 1]; + } else if (typeof sources === 'string') { + sources = [sources]; + } else if ('length' in sources) { + sources = sources; // no-op for array + } else { + common.error('invalid arguments'); + } + + sources = common.expand(sources); + + var exists = fs.existsSync(dest), + stats = exists && fs.statSync(dest); + + // Dest is not existing dir, but multiple sources given + if ((!exists || !stats.isDirectory()) && sources.length > 1) + common.error('dest is not a directory (too many sources)'); + + // Dest is an existing file, but no -f given + if (exists && stats.isFile() && options.no_force) + common.error('dest file already exists: ' + dest); + + sources.forEach(function(src) { + if (!fs.existsSync(src)) { + common.error('no such file or directory: '+src, true); + return; // skip file + } + + // If here, src exists + + // When copying to '/path/dir': + // thisDest = '/path/dir/file1' + var thisDest = dest; + if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) + thisDest = path.normalize(dest + '/' + path.basename(src)); + + if (fs.existsSync(thisDest) && options.no_force) { + common.error('dest file already exists: ' + thisDest, true); + return; // skip file + } + + if (path.resolve(src) === path.dirname(path.resolve(thisDest))) { + common.error('cannot move to self: '+src, true); + return; // skip file + } + + fs.renameSync(src, thisDest); + }); // forEach(src) +} // mv +module.exports = _mv; + +// see dirs.js +// see dirs.js +var path = require('path'); +var common = require('./common'); + +//@ +//@ ### pwd() +//@ Returns the current directory. +function _pwd() { + var pwd = path.resolve(process.cwd()); + return common.ShellString(pwd); +} +module.exports = _pwd; + +var common = require('./common'); +var fs = require('fs'); + +// Recursively removes 'dir' +// Adapted from https://github.com/ryanmcgrath/wrench-js +// +// Copyright (c) 2010 Ryan McGrath +// Copyright (c) 2012 Artur Adib +// +// Licensed under the MIT License +// http://www.opensource.org/licenses/mit-license.php +function rmdirSyncRecursive(dir, force) { + var files; + + files = fs.readdirSync(dir); + + // Loop through and delete everything in the sub-tree after checking it + for(var i = 0; i < files.length; i++) { + var file = dir + "/" + files[i], + currFile = fs.lstatSync(file); + + if(currFile.isDirectory()) { // Recursive function back to the beginning + rmdirSyncRecursive(file, force); + } + + else if(currFile.isSymbolicLink()) { // Unlink symlinks + if (force || isWriteable(file)) { + try { + common.unlinkSync(file); + } catch (e) { + common.error('could not remove file (code '+e.code+'): ' + file, true); + } + } + } + + else // Assume it's a file - perhaps a try/catch belongs here? + if (force || isWriteable(file)) { + try { + common.unlinkSync(file); + } catch (e) { + common.error('could not remove file (code '+e.code+'): ' + file, true); + } + } + } + + // Now that we know everything in the sub-tree has been deleted, we can delete the main directory. + // Huzzah for the shopkeep. + + var result; + try { + // Retry on windows, sometimes it takes a little time before all the files in the directory are gone + var start = Date.now(); + while (true) { + try { + result = fs.rmdirSync(dir); + if (fs.existsSync(dir)) throw { code: "EAGAIN" }; + break; + } catch(er) { + // In addition to error codes, also check if the directory still exists and loop again if true + if (process.platform === "win32" && (er.code === "ENOTEMPTY" || er.code === "EBUSY" || er.code === "EPERM" || er.code === "EAGAIN")) { + if (Date.now() - start > 1000) throw er; + } else if (er.code === "ENOENT") { + // Directory did not exist, deletion was successful + break; + } else { + throw er; + } + } + } + } catch(e) { + common.error('could not remove directory (code '+e.code+'): ' + dir, true); + } + + return result; +} // rmdirSyncRecursive + +// Hack to determine if file has write permissions for current user +// Avoids having to check user, group, etc, but it's probably slow +function isWriteable(file) { + var writePermission = true; + try { + var __fd = fs.openSync(file, 'a'); + fs.closeSync(__fd); + } catch(e) { + writePermission = false; + } + + return writePermission; +} + +//@ +//@ ### rm([options,] file [, file ...]) +//@ ### rm([options,] file_array) +//@ Available options: +//@ +//@ + `-f`: force +//@ + `-r, -R`: recursive +//@ +//@ Examples: +//@ +//@ ```javascript +//@ rm('-rf', '/tmp/*'); +//@ rm('some_file.txt', 'another_file.txt'); +//@ rm(['some_file.txt', 'another_file.txt']); // same as above +//@ ``` +//@ +//@ Removes files. The wildcard `*` is accepted. +function _rm(options, files) { + options = common.parseOptions(options, { + 'f': 'force', + 'r': 'recursive', + 'R': 'recursive' + }); + if (!files) + common.error('no paths given'); + + if (typeof files === 'string') + files = [].slice.call(arguments, 1); + // if it's array leave it as it is + + files = common.expand(files); + + files.forEach(function(file) { + if (!fs.existsSync(file)) { + // Path does not exist, no force flag given + if (!options.force) + common.error('no such file or directory: '+file, true); + + return; // skip file + } + + // If here, path exists + + var stats = fs.lstatSync(file); + if (stats.isFile() || stats.isSymbolicLink()) { + + // Do not check for file writing permissions + if (options.force) { + common.unlinkSync(file); + return; + } + + if (isWriteable(file)) + common.unlinkSync(file); + else + common.error('permission denied: '+file, true); + + return; + } // simple file + + // Path is an existing directory, but no -r flag given + if (stats.isDirectory() && !options.recursive) { + common.error('path is a directory', true); + return; // skip path + } + + // Recursively remove existing directory + if (stats.isDirectory() && options.recursive) { + rmdirSyncRecursive(file, options.force); + } + }); // forEach(file) +} // rm +module.exports = _rm; + +var common = require('./common'); +var fs = require('fs'); + +//@ +//@ ### sed([options,] search_regex, replacement, file [, file ...]) +//@ ### sed([options,] search_regex, replacement, file_array) +//@ Available options: +//@ +//@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_ +//@ +//@ Examples: +//@ +//@ ```javascript +//@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js'); +//@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js'); +//@ ``` +//@ +//@ Reads an input string from `files` and performs a JavaScript `replace()` on the input +//@ using the given search regex and replacement string or function. Returns the new string after replacement. +function _sed(options, regex, replacement, files) { + options = common.parseOptions(options, { + 'i': 'inplace' + }); + + if (typeof replacement === 'string' || typeof replacement === 'function') + replacement = replacement; // no-op + else if (typeof replacement === 'number') + replacement = replacement.toString(); // fallback + else + common.error('invalid replacement string'); + + // Convert all search strings to RegExp + if (typeof regex === 'string') + regex = RegExp(regex); + + if (!files) + common.error('no files given'); + + if (typeof files === 'string') + files = [].slice.call(arguments, 3); + // if it's array leave it as it is + + files = common.expand(files); + + var sed = []; + files.forEach(function(file) { + if (!fs.existsSync(file)) { + common.error('no such file or directory: ' + file, true); + return; + } + + var result = fs.readFileSync(file, 'utf8').split('\n').map(function (line) { + return line.replace(regex, replacement); + }).join('\n'); + + sed.push(result); + + if (options.inplace) + fs.writeFileSync(file, result, 'utf8'); + }); + + return common.ShellString(sed.join('\n')); +} +module.exports = _sed; + +var common = require('./common'); + +//@ +//@ ### set(options) +//@ Available options: +//@ +//@ + `+/-e`: exit upon error (`config.fatal`) +//@ + `+/-v`: verbose: show all commands (`config.verbose`) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ set('-e'); // exit upon first error +//@ set('+e'); // this undoes a "set('-e')" +//@ ``` +//@ +//@ Sets global configuration variables +function _set(options) { + if (!options) { + var args = [].slice.call(arguments, 0); + if (args.length < 2) + common.error('must provide an argument'); + options = args[1]; + } + var negate = (options[0] === '+'); + if (negate) { + options = '-' + options.slice(1); // parseOptions needs a '-' prefix + } + options = common.parseOptions(options, { + 'e': 'fatal', + 'v': 'verbose' + }); + + var key; + if (negate) { + for (key in options) + options[key] = !options[key]; + } + + for (key in options) { + // Only change the global config if `negate` is false and the option is true + // or if `negate` is true and the option is false (aka negate !== option) + if (negate !== options[key]) { + common.config[key] = options[key]; + } + } + return; +} +module.exports = _set; + +var common = require('./common'); +var os = require('os'); +var fs = require('fs'); + +// Returns false if 'dir' is not a writeable directory, 'dir' otherwise +function writeableDir(dir) { + if (!dir || !fs.existsSync(dir)) + return false; + + if (!fs.statSync(dir).isDirectory()) + return false; + + var testFile = dir+'/'+common.randomFileName(); + try { + fs.writeFileSync(testFile, ' '); + common.unlinkSync(testFile); + return dir; + } catch (e) { + return false; + } +} + + +//@ +//@ ### tempdir() +//@ +//@ Examples: +//@ +//@ ```javascript +//@ var tmp = tempdir(); // "/tmp" for most *nix platforms +//@ ``` +//@ +//@ Searches and returns string containing a writeable, platform-dependent temporary directory. +//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). +function _tempDir() { + var state = common.state; + if (state.tempDir) + return state.tempDir; // from cache + + state.tempDir = writeableDir(os.tmpdir && os.tmpdir()) || // node 0.10+ + writeableDir(os.tmpDir && os.tmpDir()) || // node 0.8+ + writeableDir(process.env['TMPDIR']) || + writeableDir(process.env['TEMP']) || + writeableDir(process.env['TMP']) || + writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS + writeableDir('C:\\TEMP') || // Windows + writeableDir('C:\\TMP') || // Windows + writeableDir('\\TEMP') || // Windows + writeableDir('\\TMP') || // Windows + writeableDir('/tmp') || + writeableDir('/var/tmp') || + writeableDir('/usr/tmp') || + writeableDir('.'); // last resort + + return state.tempDir; +} +module.exports = _tempDir; + +var common = require('./common'); +var fs = require('fs'); + +//@ +//@ ### test(expression) +//@ Available expression primaries: +//@ +//@ + `'-b', 'path'`: true if path is a block device +//@ + `'-c', 'path'`: true if path is a character device +//@ + `'-d', 'path'`: true if path is a directory +//@ + `'-e', 'path'`: true if path exists +//@ + `'-f', 'path'`: true if path is a regular file +//@ + `'-L', 'path'`: true if path is a symbolic link +//@ + `'-p', 'path'`: true if path is a pipe (FIFO) +//@ + `'-S', 'path'`: true if path is a socket +//@ +//@ Examples: +//@ +//@ ```javascript +//@ if (test('-d', path)) { /* do something with dir */ }; +//@ if (!test('-f', path)) continue; // skip if it's a regular file +//@ ``` +//@ +//@ Evaluates expression using the available primaries and returns corresponding value. +function _test(options, path) { + if (!path) + common.error('no path given'); + + // hack - only works with unary primaries + options = common.parseOptions(options, { + 'b': 'block', + 'c': 'character', + 'd': 'directory', + 'e': 'exists', + 'f': 'file', + 'L': 'link', + 'p': 'pipe', + 'S': 'socket' + }); + + var canInterpret = false; + for (var key in options) + if (options[key] === true) { + canInterpret = true; + break; + } + + if (!canInterpret) + common.error('could not interpret expression'); + + if (options.link) { + try { + return fs.lstatSync(path).isSymbolicLink(); + } catch(e) { + return false; + } + } + + if (!fs.existsSync(path)) + return false; + + if (options.exists) + return true; + + var stats = fs.statSync(path); + + if (options.block) + return stats.isBlockDevice(); + + if (options.character) + return stats.isCharacterDevice(); + + if (options.directory) + return stats.isDirectory(); + + if (options.file) + return stats.isFile(); + + if (options.pipe) + return stats.isFIFO(); + + if (options.socket) + return stats.isSocket(); +} // test +module.exports = _test; + +var common = require('./common'); +var fs = require('fs'); +var path = require('path'); + +//@ +//@ ### 'string'.to(file) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ cat('input.txt').to('output.txt'); +//@ ``` +//@ +//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as +//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_ +function _to(options, file) { + if (!file) + common.error('wrong arguments'); + + if (!fs.existsSync( path.dirname(file) )) + common.error('no such file or directory: ' + path.dirname(file)); + + try { + fs.writeFileSync(file, this.toString(), 'utf8'); + return this; + } catch(e) { + common.error('could not write to file (code '+e.code+'): '+file, true); + } +} +module.exports = _to; + +var common = require('./common'); +var fs = require('fs'); +var path = require('path'); + +//@ +//@ ### 'string'.toEnd(file) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ cat('input.txt').toEnd('output.txt'); +//@ ``` +//@ +//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as +//@ those returned by `cat`, `grep`, etc). +function _toEnd(options, file) { + if (!file) + common.error('wrong arguments'); + + if (!fs.existsSync( path.dirname(file) )) + common.error('no such file or directory: ' + path.dirname(file)); + + try { + fs.appendFileSync(file, this.toString(), 'utf8'); + return this; + } catch(e) { + common.error('could not append to file (code '+e.code+'): '+file, true); + } +} +module.exports = _toEnd; + +var common = require('./common'); +var fs = require('fs'); + +//@ +//@ ### touch([options,] file) +//@ Available options: +//@ +//@ + `-a`: Change only the access time +//@ + `-c`: Do not create any files +//@ + `-m`: Change only the modification time +//@ + `-d DATE`: Parse DATE and use it instead of current time +//@ + `-r FILE`: Use FILE's times instead of current time +//@ +//@ Examples: +//@ +//@ ```javascript +//@ touch('source.js'); +//@ touch('-c', '/path/to/some/dir/source.js'); +//@ touch({ '-r': FILE }, '/path/to/some/dir/source.js'); +//@ ``` +//@ +//@ Update the access and modification times of each FILE to the current time. +//@ A FILE argument that does not exist is created empty, unless -c is supplied. +//@ This is a partial implementation of *[touch(1)](http://linux.die.net/man/1/touch)*. +function _touch(opts, files) { + opts = common.parseOptions(opts, { + 'a': 'atime_only', + 'c': 'no_create', + 'd': 'date', + 'm': 'mtime_only', + 'r': 'reference', + }); + + if (!files) { + common.error('no paths given'); + } + + + if (Array.isArray(files)) { + files.forEach(function(f) { + touchFile(opts, f); + }); + } else if (typeof files === 'string') { + touchFile(opts, files); + } else { + common.error('file arg should be a string file path or an Array of string file paths'); + } + +} + +function touchFile(opts, file) { + var stat = tryStatFile(file); + + if (stat && stat.isDirectory()) { + // don't error just exit + return; + } + + // if the file doesn't already exist and the user has specified --no-create then + // this script is finished + if (!stat && opts.no_create) { + return; + } + + // open the file and then close it. this will create it if it doesn't exist but will + // not truncate the file + fs.closeSync(fs.openSync(file, 'a')); + + // + // Set timestamps + // + + // setup some defaults + var now = new Date(); + var mtime = opts.date || now; + var atime = opts.date || now; + + // use reference file + if (opts.reference) { + var refStat = tryStatFile(opts.reference); + if (!refStat) { + common.error('failed to get attributess of ' + opts.reference); + } + mtime = refStat.mtime; + atime = refStat.atime; + } else if (opts.date) { + mtime = opts.date; + atime = opts.date; + } + + if (opts.atime_only && opts.mtime_only) { + // keep the new values of mtime and atime like GNU + } else if (opts.atime_only) { + mtime = stat.mtime; + } else if (opts.mtime_only) { + atime = stat.atime; + } + + fs.utimesSync(file, atime, mtime); +} + +module.exports = _touch; + +function tryStatFile(filePath) { + try { + return fs.statSync(filePath); + } catch (e) { + return null; + } +} + +var common = require('./common'); +var fs = require('fs'); +var path = require('path'); + +// XP's system default value for PATHEXT system variable, just in case it's not +// set on Windows. +var XP_DEFAULT_PATHEXT = '.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh'; + +// Cross-platform method for splitting environment PATH variables +function splitPath(p) { + if (!p) + return []; + + if (common.platform === 'win') + return p.split(';'); + else + return p.split(':'); +} + +function checkPath(path) { + return fs.existsSync(path) && !fs.statSync(path).isDirectory(); +} + +//@ +//@ ### which(command) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ var nodeExec = which('node'); +//@ ``` +//@ +//@ Searches for `command` in the system's PATH. On Windows, this uses the +//@ `PATHEXT` variable to append the extension if it's not already executable. +//@ Returns string containing the absolute path to the command. +function _which(options, cmd) { + if (!cmd) + common.error('must specify command'); + + var pathEnv = process.env.path || process.env.Path || process.env.PATH, + pathArray = splitPath(pathEnv), + where = null; + + // No relative/absolute paths provided? + if (cmd.search(/\//) === -1) { + // Search for command in PATH + pathArray.forEach(function(dir) { + if (where) + return; // already found it + + var attempt = path.resolve(dir, cmd); + + if (common.platform === 'win') { + attempt = attempt.toUpperCase(); + + // In case the PATHEXT variable is somehow not set (e.g. + // child_process.spawn with an empty environment), use the XP default. + var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT; + var pathExtArray = splitPath(pathExtEnv.toUpperCase()); + var i; + + // If the extension is already in PATHEXT, just return that. + for (i = 0; i < pathExtArray.length; i++) { + var ext = pathExtArray[i]; + if (attempt.slice(-ext.length) === ext && checkPath(attempt)) { + where = attempt; + return; + } + } + + // Cycle through the PATHEXT variable + var baseAttempt = attempt; + for (i = 0; i < pathExtArray.length; i++) { + attempt = baseAttempt + pathExtArray[i]; + if (checkPath(attempt)) { + where = attempt; + return; + } + } + } else { + // Assume it's Unix-like + if (checkPath(attempt)) { + where = attempt; + return; + } + } + }); + } + + // Command not found anywhere? + if (!checkPath(cmd) && !where) + return null; + + where = where || path.resolve(cmd); + + return common.ShellString(where); +} +module.exports = _which; diff --git a/tools/eslint/node_modules/shelljs/make.js b/tools/eslint/node_modules/shelljs/make.js index f78b4cfd4237e9..a8438c84e818b6 100644 --- a/tools/eslint/node_modules/shelljs/make.js +++ b/tools/eslint/node_modules/shelljs/make.js @@ -31,10 +31,11 @@ setTimeout(function() { // Wrap it global.target[t] = function() { - if (oldTarget.done) - return; - oldTarget.done = true; - return oldTarget.apply(oldTarget, arguments); + if (!oldTarget.done){ + oldTarget.done = true; + oldTarget.result = oldTarget.apply(oldTarget, arguments); + } + return oldTarget.result; }; })(t, global.target[t]); diff --git a/tools/eslint/node_modules/shelljs/package.json b/tools/eslint/node_modules/shelljs/package.json index 0bcea2ed20dc30..288b839f873e8a 100644 --- a/tools/eslint/node_modules/shelljs/package.json +++ b/tools/eslint/node_modules/shelljs/package.json @@ -1,38 +1,42 @@ { "_args": [ [ - "shelljs@^0.5.3", - "/Users/trott/test/node_modules/eslint" + "shelljs@^0.6.0", + "/Users/silverwind/git/node/tools/package/package" ] ], - "_from": "shelljs@>=0.5.3 <0.6.0", - "_id": "shelljs@0.5.3", + "_from": "shelljs@>=0.6.0 <0.7.0", + "_id": "shelljs@0.6.0", "_inCache": true, "_installable": true, - "_location": "/eslint/shelljs", - "_nodeVersion": "1.2.0", + "_location": "/shelljs", + "_nodeVersion": "5.4.0", + "_npmOperationalInternal": { + "host": "packages-6-west.internal.npmjs.com", + "tmp": "tmp/shelljs-0.6.0.tgz_1454632811074_0.5800695188809186" + }, "_npmUser": { - "email": "arturadib@gmail.com", - "name": "artur" + "email": "ari@ariporad.com", + "name": "ariporad" }, - "_npmVersion": "2.5.1", + "_npmVersion": "3.6.0", "_phantomChildren": {}, "_requested": { "name": "shelljs", - "raw": "shelljs@^0.5.3", - "rawSpec": "^0.5.3", + "raw": "shelljs@^0.6.0", + "rawSpec": "^0.6.0", "scope": null, - "spec": ">=0.5.3 <0.6.0", + "spec": ">=0.6.0 <0.7.0", "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], - "_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", - "_shasum": "c54982b996c76ef0c1e6b59fbdc5825f5b713113", + "_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.6.0.tgz", + "_shasum": "ce1ed837b4b0e55b5ec3dab84251ab9dbdc0c7ec", "_shrinkwrap": null, - "_spec": "shelljs@^0.5.3", - "_where": "/Users/trott/test/node_modules/eslint", + "_spec": "shelljs@^0.6.0", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "arturadib@gmail.com", "name": "Artur Adib" @@ -41,37 +45,57 @@ "shjs": "./bin/shjs" }, "bugs": { - "url": "https://github.com/arturadib/shelljs/issues" + "url": "https://github.com/shelljs/shelljs/issues" }, + "contributors": [ + { + "name": "Ari Porad", + "email": "ari@ariporad.com", + "url": "http://ariporad.com/" + }, + { + "name": "Nate Fischer", + "email": "ntfschr@gmail.com" + } + ], "dependencies": {}, "description": "Portable Unix shell commands for Node.js", "devDependencies": { + "coffee-script": "^1.10.0", "jshint": "~2.1.11" }, "directories": {}, "dist": { - "shasum": "c54982b996c76ef0c1e6b59fbdc5825f5b713113", - "tarball": "http://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz" + "shasum": "ce1ed837b4b0e55b5ec3dab84251ab9dbdc0c7ec", + "tarball": "https://registry.npmjs.org/shelljs/-/shelljs-0.6.0.tgz" }, "engines": { - "node": ">=0.8.0" + "node": ">=0.10.0" }, - "gitHead": "22d0975040b9b8234755dc6e692d6869436e8485", - "homepage": "http://github.com/arturadib/shelljs", + "gitHead": "fe06baf1173ec6f0a70cd58ddb7d373f4c6446f5", + "homepage": "http://github.com/shelljs/shelljs", "keywords": [ - "unix", - "shell", - "makefile", - "make", "jake", - "synchronous" + "make", + "makefile", + "shell", + "synchronous", + "unix" ], - "license": "BSD*", + "license": "BSD-3-Clause", "main": "./shell.js", "maintainers": [ { - "email": "arturadib@gmail.com", - "name": "artur" + "name": "ariporad", + "email": "ari@ariporad.com" + }, + { + "name": "artur", + "email": "arturadib@gmail.com" + }, + { + "name": "nfischer", + "email": "ntfschr@gmail.com" } ], "name": "shelljs", @@ -79,10 +103,10 @@ "readme": "ERROR: No README data found!", "repository": { "type": "git", - "url": "git://github.com/arturadib/shelljs.git" + "url": "git://github.com/shelljs/shelljs.git" }, "scripts": { "test": "node scripts/run-tests" }, - "version": "0.5.3" + "version": "0.6.0" } diff --git a/tools/eslint/node_modules/shelljs/scripts/generate-docs.js b/tools/eslint/node_modules/shelljs/scripts/generate-docs.js index 532fed9f090caa..3a31a91abd2a13 100755 --- a/tools/eslint/node_modules/shelljs/scripts/generate-docs.js +++ b/tools/eslint/node_modules/shelljs/scripts/generate-docs.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +/* globals cat, cd, echo, grep, sed */ require('../global'); echo('Appending docs to README.md'); @@ -15,7 +16,11 @@ docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) { // Remove '//@' docs = docs.replace(/\/\/\@ ?/g, ''); -// Append docs to README -sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md'); + +// Wipe out the old docs +cat('README.md').replace(/## Command reference(.|\n)*/, '## Command reference').to('README.md'); + +// Append new docs to README +sed('-i', /## Command reference/, '## Command reference\n\n' + docs, 'README.md'); echo('All done.'); diff --git a/tools/eslint/node_modules/shelljs/scripts/run-tests.js b/tools/eslint/node_modules/shelljs/scripts/run-tests.js index f9d31e06892bab..e8e7ff2f879a82 100755 --- a/tools/eslint/node_modules/shelljs/scripts/run-tests.js +++ b/tools/eslint/node_modules/shelljs/scripts/run-tests.js @@ -1,14 +1,14 @@ #!/usr/bin/env node +/* globals cd, echo, exec, exit, ls, pwd, test */ require('../global'); - -var path = require('path'); +var common = require('../src/common'); var failed = false; // // Lint // -JSHINT_BIN = './node_modules/jshint/bin/jshint'; +var JSHINT_BIN = 'node_modules/jshint/bin/jshint'; cd(__dirname + '/..'); if (!test('-f', JSHINT_BIN)) { @@ -16,7 +16,12 @@ if (!test('-f', JSHINT_BIN)) { exit(1); } -if (exec(JSHINT_BIN + ' *.js test/*.js').code !== 0) { +var jsfiles = common.expand([pwd() + '/*.js', + pwd() + '/scripts/*.js', + pwd() + '/src/*.js', + pwd() + '/test/*.js' + ]).join(' '); +if (exec('node ' + pwd() + '/' + JSHINT_BIN + ' ' + jsfiles).code !== 0) { failed = true; echo('*** JSHINT FAILED! (return code != 0)'); echo(); diff --git a/tools/eslint/node_modules/shelljs/shell.js b/tools/eslint/node_modules/shelljs/shell.js index bdeb5597249678..93aff709a3931f 100644 --- a/tools/eslint/node_modules/shelljs/shell.js +++ b/tools/eslint/node_modules/shelljs/shell.js @@ -107,6 +107,13 @@ exports.exec = common.wrap('exec', _exec, {notUnix:true}); var _chmod = require('./src/chmod'); exports.chmod = common.wrap('chmod', _chmod); +//@include ./src/touch +var _touch = require('./src/touch'); +exports.touch = common.wrap('touch', _touch); + +//@include ./src/set +var _set = require('./src/set'); +exports.set = common.wrap('set', _set); //@ @@ -151,9 +158,27 @@ exports.config = common.config; //@ //@ ```javascript //@ require('shelljs/global'); -//@ config.fatal = true; +//@ config.fatal = true; // or set('-e'); //@ cp('this_file_does_not_exist', '/dev/null'); // dies here //@ /* more commands... */ //@ ``` //@ -//@ If `true` the script will die on errors. Default is `false`. +//@ If `true` the script will die on errors. Default is `false`. This is +//@ analogous to Bash's `set -e` + +//@ +//@ ### config.verbose +//@ Example: +//@ +//@ ```javascript +//@ config.verbose = true; // or set('-v'); +//@ cd('dir/'); +//@ ls('subdir/'); +//@ ``` +//@ +//@ Will print each command as follows: +//@ +//@ ``` +//@ cd dir/ +//@ ls subdir/ +//@ ``` diff --git a/tools/eslint/node_modules/shelljs/src/cat.js b/tools/eslint/node_modules/shelljs/src/cat.js index f6f4d254ae2cbd..5840b4ea77b590 100644 --- a/tools/eslint/node_modules/shelljs/src/cat.js +++ b/tools/eslint/node_modules/shelljs/src/cat.js @@ -32,12 +32,9 @@ function _cat(options, files) { if (!fs.existsSync(file)) common.error('no such file or directory: ' + file); - cat += fs.readFileSync(file, 'utf8') + '\n'; + cat += fs.readFileSync(file, 'utf8'); }); - if (cat[cat.length-1] === '\n') - cat = cat.substring(0, cat.length-1); - return common.ShellString(cat); } module.exports = _cat; diff --git a/tools/eslint/node_modules/shelljs/src/cd.js b/tools/eslint/node_modules/shelljs/src/cd.js index 230f432651e84b..b7b9931b8f41df 100644 --- a/tools/eslint/node_modules/shelljs/src/cd.js +++ b/tools/eslint/node_modules/shelljs/src/cd.js @@ -2,11 +2,19 @@ var fs = require('fs'); var common = require('./common'); //@ -//@ ### cd('dir') -//@ Changes to directory `dir` for the duration of the script +//@ ### cd([dir]) +//@ Changes to directory `dir` for the duration of the script. Changes to home +//@ directory if no argument is supplied. function _cd(options, dir) { if (!dir) - common.error('directory not specified'); + dir = common.getUserHome(); + + if (dir === '-') { + if (!common.state.previousDir) + common.error('could not find previous directory'); + else + dir = common.state.previousDir; + } if (!fs.existsSync(dir)) common.error('no such file or directory: ' + dir); @@ -14,6 +22,7 @@ function _cd(options, dir) { if (!fs.statSync(dir).isDirectory()) common.error('not a directory: ' + dir); + common.state.previousDir = process.cwd(); process.chdir(dir); } module.exports = _cd; diff --git a/tools/eslint/node_modules/shelljs/src/chmod.js b/tools/eslint/node_modules/shelljs/src/chmod.js index f2888930b35079..6c6de10ce12e49 100644 --- a/tools/eslint/node_modules/shelljs/src/chmod.js +++ b/tools/eslint/node_modules/shelljs/src/chmod.js @@ -114,7 +114,9 @@ function _chmod(options, mode, filePattern) { return; } - var perms = fs.statSync(file).mode; + var stat = fs.statSync(file); + var isDir = stat.isDirectory(); + var perms = stat.mode; var type = perms & PERMS.TYPE_MASK; var newPerms = perms; @@ -135,11 +137,15 @@ function _chmod(options, mode, filePattern) { var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === ''; var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === ''; - var changeRead = change.indexOf('r') != -1; - var changeWrite = change.indexOf('w') != -1; - var changeExec = change.indexOf('x') != -1; - var changeSticky = change.indexOf('t') != -1; - var changeSetuid = change.indexOf('s') != -1; + var changeRead = change.indexOf('r') != -1; + var changeWrite = change.indexOf('w') != -1; + var changeExec = change.indexOf('x') != -1; + var changeExecDir = change.indexOf('X') != -1; + var changeSticky = change.indexOf('t') != -1; + var changeSetuid = change.indexOf('s') != -1; + + if (changeExecDir && isDir) + changeExec = true; var mask = 0; if (changeOwner) { @@ -177,14 +183,15 @@ function _chmod(options, mode, filePattern) { } if (options.verbose) { - log(file + ' -> ' + newPerms.toString(8)); + console.log(file + ' -> ' + newPerms.toString(8)); } if (perms != newPerms) { if (!options.verbose && options.changes) { - log(file + ' -> ' + newPerms.toString(8)); + console.log(file + ' -> ' + newPerms.toString(8)); } fs.chmodSync(file, newPerms); + perms = newPerms; // for the next round of changes! } } else { diff --git a/tools/eslint/node_modules/shelljs/src/common.js b/tools/eslint/node_modules/shelljs/src/common.js index 8d10f3dde7281a..33198bd8a0a265 100644 --- a/tools/eslint/node_modules/shelljs/src/common.js +++ b/tools/eslint/node_modules/shelljs/src/common.js @@ -5,13 +5,15 @@ var _ls = require('./ls'); // Module globals var config = { silent: false, - fatal: false + fatal: false, + verbose: false, }; exports.config = config; var state = { error: null, currentCmd: 'shell.js', + previousDir: null, tempDir: null }; exports.state = state; @@ -21,7 +23,7 @@ exports.platform = platform; function log() { if (!config.silent) - console.log.apply(this, arguments); + console.error.apply(console, arguments); } exports.log = log; @@ -29,10 +31,14 @@ exports.log = log; function error(msg, _continue) { if (state.error === null) state.error = ''; - state.error += state.currentCmd + ': ' + msg + '\n'; + var log_entry = state.currentCmd + ': ' + msg; + if (state.error === '') + state.error = log_entry; + else + state.error += '\n' + log_entry; if (msg.length > 0) - log(state.error); + log(log_entry); if (config.fatal) process.exit(1); @@ -49,38 +55,69 @@ function ShellString(str) { } exports.ShellString = ShellString; -// Returns {'alice': true, 'bob': false} when passed a dictionary, e.g.: +// Return the home directory in a platform-agnostic way, with consideration for +// older versions of node +function getUserHome() { + var result; + if (os.homedir) + result = os.homedir(); // node 3+ + else + result = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME']; + return result; +} +exports.getUserHome = getUserHome; + +// Returns {'alice': true, 'bob': false} when passed a string and dictionary as follows: // parseOptions('-a', {'a':'alice', 'b':'bob'}); -function parseOptions(str, map) { +// Returns {'reference': 'string-value', 'bob': false} when passed two dictionaries of the form: +// parseOptions({'-r': 'string-value'}, {'r':'reference', 'b':'bob'}); +function parseOptions(opt, map) { if (!map) error('parseOptions() internal error: no map given'); // All options are false by default var options = {}; - for (var letter in map) - options[map[letter]] = false; + for (var letter in map) { + if (map[letter][0] !== '!') + options[map[letter]] = false; + } - if (!str) + if (!opt) return options; // defaults - if (typeof str !== 'string') - error('parseOptions() internal error: wrong str'); - - // e.g. match[1] = 'Rf' for str = '-Rf' - var match = str.match(/^\-(.+)/); - if (!match) - return options; + var optionName; + if (typeof opt === 'string') { + if (opt[0] !== '-') + return options; - // e.g. chars = ['R', 'f'] - var chars = match[1].split(''); - - chars.forEach(function(c) { - if (c in map) - options[map[c]] = true; - else - error('option not recognized: '+c); - }); + // e.g. chars = ['R', 'f'] + var chars = opt.slice(1).split(''); + chars.forEach(function(c) { + if (c in map) { + optionName = map[c]; + if (optionName[0] === '!') + options[optionName.slice(1, optionName.length-1)] = false; + else + options[optionName] = true; + } else { + error('option not recognized: '+c); + } + }); + } else if (typeof opt === 'object') { + for (var key in opt) { + // key is a string of the form '-r', '-d', etc. + var c = key[1]; + if (c in map) { + optionName = map[c]; + options[optionName] = opt[key]; // assign the given value + } else { + error('option not recognized: '+c); + } + } + } else { + error('options must be strings or key-value pairs'); + } return options; } exports.parseOptions = parseOptions; @@ -178,11 +215,28 @@ function wrap(cmd, fn, options) { try { var args = [].slice.call(arguments, 0); + if (config.verbose) { + args.unshift(cmd); + console.log.apply(console, args); + args.shift(); + } + if (options && options.notUnix) { retValue = fn.apply(this, args); } else { - if (args.length === 0 || typeof args[0] !== 'string' || args[0][0] !== '-') + if (typeof args[0] === 'object' && args[0].constructor.name === 'Object') { + args = args; // object count as options + } else if (args.length === 0 || typeof args[0] !== 'string' || args[0].length <= 1 || args[0][0] !== '-') { args.unshift(''); // only add dummy option if '-option' not already present + } + // Expand the '~' if appropriate + var homeDir = getUserHome(); + args = args.map(function(arg) { + if (typeof arg === 'string' && arg.slice(0, 2) === '~/' || arg === '~') + return arg.replace(/^~/, homeDir); + else + return arg; + }); retValue = fn.apply(this, args); } } catch (e) { diff --git a/tools/eslint/node_modules/shelljs/src/cp.js b/tools/eslint/node_modules/shelljs/src/cp.js index ef19f96ecfc5bc..54404efb161ff1 100644 --- a/tools/eslint/node_modules/shelljs/src/cp.js +++ b/tools/eslint/node_modules/shelljs/src/cp.js @@ -76,7 +76,7 @@ function cpdirSyncRecursive(sourceDir, destDir, opts) { fs.symlinkSync(symlinkFull, destFile, os.platform() === "win32" ? "junction" : null); } else { /* At this point, we've hit a file actually worth copying... so copy it on over. */ - if (fs.existsSync(destFile) && !opts.force) { + if (fs.existsSync(destFile) && opts.no_force) { common.log('skipping existing file: ' + files[i]); } else { copyFileSync(srcFile, destFile); @@ -88,11 +88,12 @@ function cpdirSyncRecursive(sourceDir, destDir, opts) { //@ -//@ ### cp([options ,] source [,source ...], dest) -//@ ### cp([options ,] source_array, dest) +//@ ### cp([options,] source [, source ...], dest) +//@ ### cp([options,] source_array, dest) //@ Available options: //@ -//@ + `-f`: force +//@ + `-f`: force (default behavior) +//@ + `-n`: no-clobber //@ + `-r, -R`: recursive //@ //@ Examples: @@ -106,7 +107,8 @@ function cpdirSyncRecursive(sourceDir, destDir, opts) { //@ Copies files. The wildcard `*` is accepted. function _cp(options, sources, dest) { options = common.parseOptions(options, { - 'f': 'force', + 'f': '!no_force', + 'n': 'no_force', 'R': 'recursive', 'r': 'recursive' }); @@ -133,15 +135,19 @@ function _cp(options, sources, dest) { common.error('dest is not a directory (too many sources)'); // Dest is an existing file, but no -f given - if (exists && stats.isFile() && !options.force) + if (exists && stats.isFile() && options.no_force) common.error('dest file already exists: ' + dest); if (options.recursive) { // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*" // (see Github issue #15) sources.forEach(function(src, i) { - if (src[src.length - 1] === '/') + if (src[src.length - 1] === '/') { sources[i] += '*'; + // If src is a directory and dest doesn't exist, 'cp -r src dest' should copy src/* into dest + } else if (fs.statSync(src).isDirectory() && !exists) { + sources[i] += '/*'; + } }); // Create dest @@ -180,7 +186,7 @@ function _cp(options, sources, dest) { } } - cpdirSyncRecursive(src, newDest, {force: options.force}); + cpdirSyncRecursive(src, newDest, {no_force: options.no_force}); } return; // done with dir } @@ -193,7 +199,7 @@ function _cp(options, sources, dest) { if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) thisDest = path.normalize(dest + '/' + path.basename(src)); - if (fs.existsSync(thisDest) && !options.force) { + if (fs.existsSync(thisDest) && options.no_force) { common.error('dest file already exists: ' + thisDest, true); return; // skip file } diff --git a/tools/eslint/node_modules/shelljs/src/echo.js b/tools/eslint/node_modules/shelljs/src/echo.js index 760ea840f07218..b574adc5c38465 100644 --- a/tools/eslint/node_modules/shelljs/src/echo.js +++ b/tools/eslint/node_modules/shelljs/src/echo.js @@ -1,7 +1,7 @@ var common = require('./common'); //@ -//@ ### echo(string [,string ...]) +//@ ### echo(string [, string ...]) //@ //@ Examples: //@ @@ -14,7 +14,7 @@ var common = require('./common'); //@ like `.to()`. function _echo() { var messages = [].slice.call(arguments, 0); - console.log.apply(this, messages); + console.log.apply(console, messages); return common.ShellString(messages.join(' ')); } module.exports = _echo; diff --git a/tools/eslint/node_modules/shelljs/src/error.js b/tools/eslint/node_modules/shelljs/src/error.js index cca3efb608d0dc..112563db80311e 100644 --- a/tools/eslint/node_modules/shelljs/src/error.js +++ b/tools/eslint/node_modules/shelljs/src/error.js @@ -6,5 +6,5 @@ var common = require('./common'); //@ otherwise returns string explaining the error function error() { return common.state.error; -}; +} module.exports = error; diff --git a/tools/eslint/node_modules/shelljs/src/exec.js b/tools/eslint/node_modules/shelljs/src/exec.js index d259a9f26c8341..4174adbd32d317 100644 --- a/tools/eslint/node_modules/shelljs/src/exec.js +++ b/tools/eslint/node_modules/shelljs/src/exec.js @@ -5,6 +5,8 @@ var path = require('path'); var fs = require('fs'); var child = require('child_process'); +var DEFAULT_MAXBUFFER_SIZE = 20*1024*1024; + // Hack to run child_process.exec() synchronously (sync avoids callback hell) // Uses a custom wait loop that checks for a flag file, created when the child process is done. // (Can't do a wait loop that checks for internal Node variables/messages as @@ -13,27 +15,42 @@ var child = require('child_process'); function execSync(cmd, opts) { var tempDir = _tempDir(); var stdoutFile = path.resolve(tempDir+'/'+common.randomFileName()), + stderrFile = path.resolve(tempDir+'/'+common.randomFileName()), codeFile = path.resolve(tempDir+'/'+common.randomFileName()), scriptFile = path.resolve(tempDir+'/'+common.randomFileName()), sleepFile = path.resolve(tempDir+'/'+common.randomFileName()); - var options = common.extend({ - silent: common.config.silent + opts = common.extend({ + silent: common.config.silent, + cwd: _pwd(), + env: process.env, + maxBuffer: DEFAULT_MAXBUFFER_SIZE }, opts); - var previousStdoutContent = ''; - // Echoes stdout changes from running process, if not silent - function updateStdout() { - if (options.silent || !fs.existsSync(stdoutFile)) + var previousStdoutContent = '', + previousStderrContent = ''; + // Echoes stdout and stderr changes from running process, if not silent + function updateStream(streamFile) { + if (opts.silent || !fs.existsSync(streamFile)) return; - var stdoutContent = fs.readFileSync(stdoutFile, 'utf8'); + var previousStreamContent, + proc_stream; + if (streamFile === stdoutFile) { + previousStreamContent = previousStdoutContent; + proc_stream = process.stdout; + } else { // assume stderr + previousStreamContent = previousStderrContent; + proc_stream = process.stderr; + } + + var streamContent = fs.readFileSync(streamFile, 'utf8'); // No changes since last time? - if (stdoutContent.length <= previousStdoutContent.length) + if (streamContent.length <= previousStreamContent.length) return; - process.stdout.write(stdoutContent.substr(previousStdoutContent.length)); - previousStdoutContent = stdoutContent; + proc_stream.write(streamContent.substr(previousStreamContent.length)); + previousStreamContent = streamContent; } function escape(str) { @@ -42,64 +59,64 @@ function execSync(cmd, opts) { if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile); if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile); + if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile); if (fs.existsSync(codeFile)) common.unlinkSync(codeFile); var execCommand = '"'+process.execPath+'" '+scriptFile; - var execOptions = { - env: process.env, - cwd: _pwd(), - maxBuffer: 20*1024*1024 - }; + var script; if (typeof child.execSync === 'function') { - var script = [ + script = [ "var child = require('child_process')", " , fs = require('fs');", - "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {", + "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: "+opts.maxBuffer+"}, function(err) {", " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');", "});", "var stdoutStream = fs.createWriteStream('"+escape(stdoutFile)+"');", + "var stderrStream = fs.createWriteStream('"+escape(stderrFile)+"');", "childProcess.stdout.pipe(stdoutStream, {end: false});", - "childProcess.stderr.pipe(stdoutStream, {end: false});", + "childProcess.stderr.pipe(stderrStream, {end: false});", "childProcess.stdout.pipe(process.stdout);", "childProcess.stderr.pipe(process.stderr);", "var stdoutEnded = false, stderrEnded = false;", - "function tryClosing(){ if(stdoutEnded && stderrEnded){ stdoutStream.end(); } }", - "childProcess.stdout.on('end', function(){ stdoutEnded = true; tryClosing(); });", - "childProcess.stderr.on('end', function(){ stderrEnded = true; tryClosing(); });" + "function tryClosingStdout(){ if(stdoutEnded){ stdoutStream.end(); } }", + "function tryClosingStderr(){ if(stderrEnded){ stderrStream.end(); } }", + "childProcess.stdout.on('end', function(){ stdoutEnded = true; tryClosingStdout(); });", + "childProcess.stderr.on('end', function(){ stderrEnded = true; tryClosingStderr(); });" ].join('\n'); fs.writeFileSync(scriptFile, script); - if (options.silent) { - execOptions.stdio = 'ignore'; + if (opts.silent) { + opts.stdio = 'ignore'; } else { - execOptions.stdio = [0, 1, 2]; + opts.stdio = [0, 1, 2]; } // Welcome to the future - child.execSync(execCommand, execOptions); + child.execSync(execCommand, opts); } else { - cmd += ' > '+stdoutFile+' 2>&1'; // works on both win/unix + cmd += ' > '+stdoutFile+' 2> '+stderrFile; // works on both win/unix - var script = [ + script = [ "var child = require('child_process')", " , fs = require('fs');", - "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {", + "var childProcess = child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: "+opts.maxBuffer+"}, function(err) {", " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');", "});" ].join('\n'); fs.writeFileSync(scriptFile, script); - child.exec(execCommand, execOptions); + child.exec(execCommand, opts); // The wait loop // sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage // (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing // CPU usage, though apparently not so much on Windows) - while (!fs.existsSync(codeFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); } - while (!fs.existsSync(stdoutFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); } + while (!fs.existsSync(codeFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); } + while (!fs.existsSync(stdoutFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); } + while (!fs.existsSync(stderrFile)) { updateStream(stderrFile); fs.writeFileSync(sleepFile, 'a'); } } // At this point codeFile exists, but it's not necessarily flushed yet. @@ -110,10 +127,12 @@ function execSync(cmd, opts) { } var stdout = fs.readFileSync(stdoutFile, 'utf8'); + var stderr = fs.readFileSync(stderrFile, 'utf8'); // No biggie if we can't erase the files now -- they're in a temp dir anyway try { common.unlinkSync(scriptFile); } catch(e) {} try { common.unlinkSync(stdoutFile); } catch(e) {} + try { common.unlinkSync(stderrFile); } catch(e) {} try { common.unlinkSync(codeFile); } catch(e) {} try { common.unlinkSync(sleepFile); } catch(e) {} @@ -124,34 +143,40 @@ function execSync(cmd, opts) { // True if successful, false if not var obj = { code: code, - output: stdout + output: stdout, // deprecated + stdout: stdout, + stderr: stderr }; return obj; } // execSync() // Wrapper around exec() to enable echoing output to console in real time function execAsync(cmd, opts, callback) { - var output = ''; + var stdout = ''; + var stderr = ''; - var options = common.extend({ - silent: common.config.silent + opts = common.extend({ + silent: common.config.silent, + cwd: _pwd(), + env: process.env, + maxBuffer: DEFAULT_MAXBUFFER_SIZE }, opts); - var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) { + var c = child.exec(cmd, opts, function(err) { if (callback) - callback(err ? err.code : 0, output); + callback(err ? err.code : 0, stdout, stderr); }); c.stdout.on('data', function(data) { - output += data; - if (!options.silent) + stdout += data; + if (!opts.silent) process.stdout.write(data); }); c.stderr.on('data', function(data) { - output += data; - if (!options.silent) - process.stdout.write(data); + stderr += data; + if (!opts.silent) + process.stderr.write(data); }); return c; @@ -161,29 +186,33 @@ function execAsync(cmd, opts, callback) { //@ ### exec(command [, options] [, callback]) //@ Available options (all `false` by default): //@ -//@ + `async`: Asynchronous execution. Defaults to true if a callback is provided. +//@ + `async`: Asynchronous execution. If a callback is provided, it will be set to +//@ `true`, regardless of the passed value. //@ + `silent`: Do not echo program output to console. +//@ + and any option available to NodeJS's +//@ [child_process.exec()](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) //@ //@ Examples: //@ //@ ```javascript -//@ var version = exec('node --version', {silent:true}).output; +//@ var version = exec('node --version', {silent:true}).stdout; //@ //@ var child = exec('some_long_running_process', {async:true}); //@ child.stdout.on('data', function(data) { //@ /* ... do something with data ... */ //@ }); //@ -//@ exec('some_long_running_process', function(code, output) { +//@ exec('some_long_running_process', function(code, stdout, stderr) { //@ console.log('Exit code:', code); -//@ console.log('Program output:', output); +//@ console.log('Program output:', stdout); +//@ console.log('Program stderr:', stderr); //@ }); //@ ``` //@ -//@ Executes the given `command` _synchronously_, unless otherwise specified. -//@ When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's -//@ `output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and -//@ the `callback` gets the arguments `(code, output)`. +//@ Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous +//@ mode returns the object `{ code:..., stdout:... , stderr:... }`, containing the program's +//@ `stdout`, `stderr`, and its exit `code`. Otherwise returns the child process object, +//@ and the `callback` gets the arguments `(code, stdout, stderr)`. //@ //@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as //@ the current synchronous implementation uses a lot of CPU. This should be getting @@ -208,9 +237,13 @@ function _exec(command, options, callback) { async: false }, options); - if (options.async) - return execAsync(command, options, callback); - else - return execSync(command, options); + try { + if (options.async) + return execAsync(command, options, callback); + else + return execSync(command, options); + } catch (e) { + common.error('internal error'); + } } module.exports = _exec; diff --git a/tools/eslint/node_modules/shelljs/src/find.js b/tools/eslint/node_modules/shelljs/src/find.js index d9eeec26a93b67..c96fb2f7ad51e7 100644 --- a/tools/eslint/node_modules/shelljs/src/find.js +++ b/tools/eslint/node_modules/shelljs/src/find.js @@ -3,7 +3,7 @@ var common = require('./common'); var _ls = require('./ls'); //@ -//@ ### find(path [,path ...]) +//@ ### find(path [, path ...]) //@ ### find(path_array) //@ Examples: //@ diff --git a/tools/eslint/node_modules/shelljs/src/grep.js b/tools/eslint/node_modules/shelljs/src/grep.js index 00c7d6a4068435..78008ce19e6d2f 100644 --- a/tools/eslint/node_modules/shelljs/src/grep.js +++ b/tools/eslint/node_modules/shelljs/src/grep.js @@ -2,8 +2,8 @@ var common = require('./common'); var fs = require('fs'); //@ -//@ ### grep([options ,] regex_filter, file [, file ...]) -//@ ### grep([options ,] regex_filter, file_array) +//@ ### grep([options,] regex_filter, file [, file ...]) +//@ ### grep([options,] regex_filter, file_array) //@ Available options: //@ //@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. diff --git a/tools/eslint/node_modules/shelljs/src/ln.js b/tools/eslint/node_modules/shelljs/src/ln.js index a7b9701b3723cb..878fda13e23d45 100644 --- a/tools/eslint/node_modules/shelljs/src/ln.js +++ b/tools/eslint/node_modules/shelljs/src/ln.js @@ -1,15 +1,13 @@ var fs = require('fs'); var path = require('path'); var common = require('./common'); -var os = require('os'); //@ -//@ ### ln(options, source, dest) -//@ ### ln(source, dest) +//@ ### ln([options,] source, dest) //@ Available options: //@ -//@ + `s`: symlink -//@ + `f`: force +//@ + `-s`: symlink +//@ + `-f`: force //@ //@ Examples: //@ @@ -29,13 +27,11 @@ function _ln(options, source, dest) { common.error('Missing and/or '); } - source = path.resolve(process.cwd(), String(source)); + source = String(source); + var sourcePath = path.normalize(source).replace(RegExp(path.sep + '$'), ''); + var isAbsolute = (path.resolve(source) === sourcePath); dest = path.resolve(process.cwd(), String(dest)); - if (!fs.existsSync(source)) { - common.error('Source file does not exist', true); - } - if (fs.existsSync(dest)) { if (!options.force) { common.error('Destination file exists', true); @@ -45,9 +41,29 @@ function _ln(options, source, dest) { } if (options.symlink) { - fs.symlinkSync(source, dest, os.platform() === "win32" ? "junction" : null); + var isWindows = common.platform === 'win'; + var linkType = isWindows ? 'file' : null; + var resolvedSourcePath = isAbsolute ? sourcePath : path.resolve(process.cwd(), path.dirname(dest), source); + if (!fs.existsSync(resolvedSourcePath)) { + common.error('Source file does not exist', true); + } else if (isWindows && fs.statSync(resolvedSourcePath).isDirectory()) { + linkType = 'junction'; + } + + try { + fs.symlinkSync(linkType === 'junction' ? resolvedSourcePath: source, dest, linkType); + } catch (err) { + common.error(err.message); + } } else { - fs.linkSync(source, dest, os.platform() === "win32" ? "junction" : null); + if (!fs.existsSync(source)) { + common.error('Source file does not exist', true); + } + try { + fs.linkSync(source, dest); + } catch (err) { + common.error(err.message); + } } } module.exports = _ln; diff --git a/tools/eslint/node_modules/shelljs/src/ls.js b/tools/eslint/node_modules/shelljs/src/ls.js index 3345db4466bc52..6a54b3a8d8426a 100644 --- a/tools/eslint/node_modules/shelljs/src/ls.js +++ b/tools/eslint/node_modules/shelljs/src/ls.js @@ -5,12 +5,17 @@ var _cd = require('./cd'); var _pwd = require('./pwd'); //@ -//@ ### ls([options ,] path [,path ...]) -//@ ### ls([options ,] path_array) +//@ ### ls([options,] [path, ...]) +//@ ### ls([options,] path_array) //@ Available options: //@ //@ + `-R`: recursive //@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`) +//@ + `-d`: list directories themselves, not their contents +//@ + `-l`: list objects representing each file, each with fields containing `ls +//@ -l` output fields. See +//@ [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats) +//@ for more info //@ //@ Examples: //@ @@ -18,6 +23,7 @@ var _pwd = require('./pwd'); //@ ls('projs/*.js'); //@ ls('-R', '/users/me', '/tmp'); //@ ls('-R', ['/users/me', '/tmp']); // same as above +//@ ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...} //@ ``` //@ //@ Returns array of files in the given path, or in current directory if no path provided. @@ -25,7 +31,9 @@ function _ls(options, paths) { options = common.parseOptions(options, { 'R': 'recursive', 'A': 'all', - 'a': 'all_deprecated' + 'a': 'all_deprecated', + 'd': 'directory', + 'l': 'long' }); if (options.all_deprecated) { @@ -48,33 +56,49 @@ function _ls(options, paths) { // Conditionally pushes file to list - returns true if pushed, false otherwise // (e.g. prevents hidden files to be included unless explicitly told so) function pushFile(file, query) { + var name = file.name || file; // hidden file? - if (path.basename(file)[0] === '.') { + if (path.basename(name)[0] === '.') { // not explicitly asking for hidden files? if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1)) return false; } if (common.platform === 'win') - file = file.replace(/\\/g, '/'); + name = name.replace(/\\/g, '/'); + if (file.name) { + file.name = name; + } else { + file = name; + } list.push(file); return true; } paths.forEach(function(p) { if (fs.existsSync(p)) { - var stats = fs.statSync(p); + var stats = ls_stat(p); // Simple file? if (stats.isFile()) { - pushFile(p, p); + if (options.long) { + pushFile(stats, p); + } else { + pushFile(p, p); + } return; // continue } // Simple dir? - if (stats.isDirectory()) { + if (options.directory) { + pushFile(p, p); + return; + } else if (stats.isDirectory()) { // Iterate over p contents fs.readdirSync(p).forEach(function(file) { + var orig_file = file; + if (options.long) + file = ls_stat(path.join(p, file)); if (!pushFile(file, p)) return; @@ -82,8 +106,8 @@ function _ls(options, paths) { if (options.recursive) { var oldDir = _pwd(); _cd('', p); - if (fs.statSync(file).isDirectory()) - list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*')); + if (fs.statSync(orig_file).isDirectory()) + list = list.concat(_ls('-R'+(options.all?'A':''), orig_file+'/*')); _cd('', oldDir); } }); @@ -104,7 +128,13 @@ function _ls(options, paths) { // Iterate over directory contents fs.readdirSync(dirname).forEach(function(file) { if (file.match(new RegExp(regexp))) { - if (!pushFile(path.normalize(dirname+'/'+file), basename)) + var file_path = path.join(dirname, file); + file_path = options.long ? ls_stat(file_path) : file_path; + if (file_path.name) + file_path.name = path.normalize(file_path.name); + else + file_path = path.normalize(file_path); + if (!pushFile(file_path, basename)) return; // Recursive? @@ -124,3 +154,15 @@ function _ls(options, paths) { return list; } module.exports = _ls; + + +function ls_stat(path) { + var stats = fs.statSync(path); + // Note: this object will contain more information than .toString() returns + stats.name = path; + stats.toString = function() { + // Return a string resembling unix's `ls -l` format + return [this.mode, this.nlink, this.uid, this.gid, this.size, this.mtime, this.name].join(' '); + }; + return stats; +} diff --git a/tools/eslint/node_modules/shelljs/src/mkdir.js b/tools/eslint/node_modules/shelljs/src/mkdir.js index 5a7088f2609c9f..8b4fd99075053a 100644 --- a/tools/eslint/node_modules/shelljs/src/mkdir.js +++ b/tools/eslint/node_modules/shelljs/src/mkdir.js @@ -20,11 +20,11 @@ function mkdirSyncRecursive(dir) { } //@ -//@ ### mkdir([options ,] dir [, dir ...]) -//@ ### mkdir([options ,] dir_array) +//@ ### mkdir([options,] dir [, dir ...]) +//@ ### mkdir([options,] dir_array) //@ Available options: //@ -//@ + `p`: full path (will create intermediate dirs if necessary) +//@ + `-p`: full path (will create intermediate dirs if necessary) //@ //@ Examples: //@ diff --git a/tools/eslint/node_modules/shelljs/src/mv.js b/tools/eslint/node_modules/shelljs/src/mv.js index 11f96071875a47..69cc03fe1ebe2b 100644 --- a/tools/eslint/node_modules/shelljs/src/mv.js +++ b/tools/eslint/node_modules/shelljs/src/mv.js @@ -3,16 +3,17 @@ var path = require('path'); var common = require('./common'); //@ -//@ ### mv(source [, source ...], dest') -//@ ### mv(source_array, dest') +//@ ### mv([options ,] source [, source ...], dest') +//@ ### mv([options ,] source_array, dest') //@ Available options: //@ -//@ + `f`: force +//@ + `-f`: force (default behavior) +//@ + `-n`: no-clobber //@ //@ Examples: //@ //@ ```javascript -//@ mv('-f', 'file', 'dir/'); +//@ mv('-n', 'file', 'dir/'); //@ mv('file1', 'file2', 'dir/'); //@ mv(['file1', 'file2'], 'dir/'); // same as above //@ ``` @@ -20,7 +21,8 @@ var common = require('./common'); //@ Moves files. The wildcard `*` is accepted. function _mv(options, sources, dest) { options = common.parseOptions(options, { - 'f': 'force' + 'f': '!no_force', + 'n': 'no_force' }); // Get sources, dest @@ -47,7 +49,7 @@ function _mv(options, sources, dest) { common.error('dest is not a directory (too many sources)'); // Dest is an existing file, but no -f given - if (exists && stats.isFile() && !options.force) + if (exists && stats.isFile() && options.no_force) common.error('dest file already exists: ' + dest); sources.forEach(function(src) { @@ -64,7 +66,7 @@ function _mv(options, sources, dest) { if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) thisDest = path.normalize(dest + '/' + path.basename(src)); - if (fs.existsSync(thisDest) && !options.force) { + if (fs.existsSync(thisDest) && options.no_force) { common.error('dest file already exists: ' + thisDest, true); return; // skip file } diff --git a/tools/eslint/node_modules/shelljs/src/pwd.js b/tools/eslint/node_modules/shelljs/src/pwd.js index 41727bb918b78c..26cefe0a0454d0 100644 --- a/tools/eslint/node_modules/shelljs/src/pwd.js +++ b/tools/eslint/node_modules/shelljs/src/pwd.js @@ -4,7 +4,7 @@ var common = require('./common'); //@ //@ ### pwd() //@ Returns the current directory. -function _pwd(options) { +function _pwd() { var pwd = path.resolve(process.cwd()); return common.ShellString(pwd); } diff --git a/tools/eslint/node_modules/shelljs/src/rm.js b/tools/eslint/node_modules/shelljs/src/rm.js index bd608cb09a59e8..cf2e95b6d816bc 100644 --- a/tools/eslint/node_modules/shelljs/src/rm.js +++ b/tools/eslint/node_modules/shelljs/src/rm.js @@ -53,7 +53,7 @@ function rmdirSyncRecursive(dir, force) { while (true) { try { result = fs.rmdirSync(dir); - if (fs.existsSync(dir)) throw { code: "EAGAIN" } + if (fs.existsSync(dir)) throw { code: "EAGAIN" }; break; } catch(er) { // In addition to error codes, also check if the directory still exists and loop again if true @@ -89,8 +89,8 @@ function isWriteable(file) { } //@ -//@ ### rm([options ,] file [, file ...]) -//@ ### rm([options ,] file_array) +//@ ### rm([options,] file [, file ...]) +//@ ### rm([options,] file_array) //@ Available options: //@ //@ + `-f`: force diff --git a/tools/eslint/node_modules/shelljs/src/sed.js b/tools/eslint/node_modules/shelljs/src/sed.js index 65f7cb49d1cae1..baa385ba1167d4 100644 --- a/tools/eslint/node_modules/shelljs/src/sed.js +++ b/tools/eslint/node_modules/shelljs/src/sed.js @@ -2,7 +2,8 @@ var common = require('./common'); var fs = require('fs'); //@ -//@ ### sed([options ,] search_regex, replacement, file) +//@ ### sed([options,] search_regex, replacement, file [, file ...]) +//@ ### sed([options,] search_regex, replacement, file_array) //@ Available options: //@ //@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_ @@ -14,9 +15,9 @@ var fs = require('fs'); //@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js'); //@ ``` //@ -//@ Reads an input string from `file` and performs a JavaScript `replace()` on the input +//@ Reads an input string from `files` and performs a JavaScript `replace()` on the input //@ using the given search regex and replacement string or function. Returns the new string after replacement. -function _sed(options, regex, replacement, file) { +function _sed(options, regex, replacement, files) { options = common.parseOptions(options, { 'i': 'inplace' }); @@ -28,16 +29,36 @@ function _sed(options, regex, replacement, file) { else common.error('invalid replacement string'); - if (!file) - common.error('no file given'); + // Convert all search strings to RegExp + if (typeof regex === 'string') + regex = RegExp(regex); - if (!fs.existsSync(file)) - common.error('no such file or directory: ' + file); + if (!files) + common.error('no files given'); - var result = fs.readFileSync(file, 'utf8').replace(regex, replacement); - if (options.inplace) - fs.writeFileSync(file, result, 'utf8'); + if (typeof files === 'string') + files = [].slice.call(arguments, 3); + // if it's array leave it as it is - return common.ShellString(result); + files = common.expand(files); + + var sed = []; + files.forEach(function(file) { + if (!fs.existsSync(file)) { + common.error('no such file or directory: ' + file, true); + return; + } + + var result = fs.readFileSync(file, 'utf8').split('\n').map(function (line) { + return line.replace(regex, replacement); + }).join('\n'); + + sed.push(result); + + if (options.inplace) + fs.writeFileSync(file, result, 'utf8'); + }); + + return common.ShellString(sed.join('\n')); } module.exports = _sed; diff --git a/tools/eslint/node_modules/shelljs/src/set.js b/tools/eslint/node_modules/shelljs/src/set.js new file mode 100644 index 00000000000000..19e26d979d3f4b --- /dev/null +++ b/tools/eslint/node_modules/shelljs/src/set.js @@ -0,0 +1,49 @@ +var common = require('./common'); + +//@ +//@ ### set(options) +//@ Available options: +//@ +//@ + `+/-e`: exit upon error (`config.fatal`) +//@ + `+/-v`: verbose: show all commands (`config.verbose`) +//@ +//@ Examples: +//@ +//@ ```javascript +//@ set('-e'); // exit upon first error +//@ set('+e'); // this undoes a "set('-e')" +//@ ``` +//@ +//@ Sets global configuration variables +function _set(options) { + if (!options) { + var args = [].slice.call(arguments, 0); + if (args.length < 2) + common.error('must provide an argument'); + options = args[1]; + } + var negate = (options[0] === '+'); + if (negate) { + options = '-' + options.slice(1); // parseOptions needs a '-' prefix + } + options = common.parseOptions(options, { + 'e': 'fatal', + 'v': 'verbose' + }); + + var key; + if (negate) { + for (key in options) + options[key] = !options[key]; + } + + for (key in options) { + // Only change the global config if `negate` is false and the option is true + // or if `negate` is true and the option is false (aka negate !== option) + if (negate !== options[key]) { + common.config[key] = options[key]; + } + } + return; +} +module.exports = _set; diff --git a/tools/eslint/node_modules/shelljs/src/tempdir.js b/tools/eslint/node_modules/shelljs/src/tempdir.js index 45953c24e98134..79b949f0d4f15b 100644 --- a/tools/eslint/node_modules/shelljs/src/tempdir.js +++ b/tools/eslint/node_modules/shelljs/src/tempdir.js @@ -37,7 +37,8 @@ function _tempDir() { if (state.tempDir) return state.tempDir; // from cache - state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+ + state.tempDir = writeableDir(os.tmpdir && os.tmpdir()) || // node 0.10+ + writeableDir(os.tmpDir && os.tmpDir()) || // node 0.8+ writeableDir(process.env['TMPDIR']) || writeableDir(process.env['TEMP']) || writeableDir(process.env['TMP']) || diff --git a/tools/eslint/node_modules/shelljs/src/test.js b/tools/eslint/node_modules/shelljs/src/test.js index 8a4ac7d4d10270..068a1ce06ef4c9 100644 --- a/tools/eslint/node_modules/shelljs/src/test.js +++ b/tools/eslint/node_modules/shelljs/src/test.js @@ -10,7 +10,7 @@ var fs = require('fs'); //@ + `'-d', 'path'`: true if path is a directory //@ + `'-e', 'path'`: true if path exists //@ + `'-f', 'path'`: true if path is a regular file -//@ + `'-L', 'path'`: true if path is a symboilc link +//@ + `'-L', 'path'`: true if path is a symbolic link //@ + `'-p', 'path'`: true if path is a pipe (FIFO) //@ + `'-S', 'path'`: true if path is a socket //@ diff --git a/tools/eslint/node_modules/shelljs/src/to.js b/tools/eslint/node_modules/shelljs/src/to.js index f0299993a7ae25..65d6d54af90837 100644 --- a/tools/eslint/node_modules/shelljs/src/to.js +++ b/tools/eslint/node_modules/shelljs/src/to.js @@ -22,6 +22,7 @@ function _to(options, file) { try { fs.writeFileSync(file, this.toString(), 'utf8'); + return this; } catch(e) { common.error('could not write to file (code '+e.code+'): '+file, true); } diff --git a/tools/eslint/node_modules/shelljs/src/toEnd.js b/tools/eslint/node_modules/shelljs/src/toEnd.js index f6d099d9a3a5ed..bf29a6526d0f97 100644 --- a/tools/eslint/node_modules/shelljs/src/toEnd.js +++ b/tools/eslint/node_modules/shelljs/src/toEnd.js @@ -22,6 +22,7 @@ function _toEnd(options, file) { try { fs.appendFileSync(file, this.toString(), 'utf8'); + return this; } catch(e) { common.error('could not append to file (code '+e.code+'): '+file, true); } diff --git a/tools/eslint/node_modules/shelljs/src/touch.js b/tools/eslint/node_modules/shelljs/src/touch.js new file mode 100644 index 00000000000000..bbc2c1968654ab --- /dev/null +++ b/tools/eslint/node_modules/shelljs/src/touch.js @@ -0,0 +1,109 @@ +var common = require('./common'); +var fs = require('fs'); + +//@ +//@ ### touch([options,] file) +//@ Available options: +//@ +//@ + `-a`: Change only the access time +//@ + `-c`: Do not create any files +//@ + `-m`: Change only the modification time +//@ + `-d DATE`: Parse DATE and use it instead of current time +//@ + `-r FILE`: Use FILE's times instead of current time +//@ +//@ Examples: +//@ +//@ ```javascript +//@ touch('source.js'); +//@ touch('-c', '/path/to/some/dir/source.js'); +//@ touch({ '-r': FILE }, '/path/to/some/dir/source.js'); +//@ ``` +//@ +//@ Update the access and modification times of each FILE to the current time. +//@ A FILE argument that does not exist is created empty, unless -c is supplied. +//@ This is a partial implementation of *[touch(1)](http://linux.die.net/man/1/touch)*. +function _touch(opts, files) { + opts = common.parseOptions(opts, { + 'a': 'atime_only', + 'c': 'no_create', + 'd': 'date', + 'm': 'mtime_only', + 'r': 'reference', + }); + + if (!files) { + common.error('no paths given'); + } + + if (Array.isArray(files)) { + files.forEach(function(f) { + touchFile(opts, f); + }); + } else if (typeof files === 'string') { + touchFile(opts, files); + } else { + common.error('file arg should be a string file path or an Array of string file paths'); + } + +} + +function touchFile(opts, file) { + var stat = tryStatFile(file); + + if (stat && stat.isDirectory()) { + // don't error just exit + return; + } + + // if the file doesn't already exist and the user has specified --no-create then + // this script is finished + if (!stat && opts.no_create) { + return; + } + + // open the file and then close it. this will create it if it doesn't exist but will + // not truncate the file + fs.closeSync(fs.openSync(file, 'a')); + + // + // Set timestamps + // + + // setup some defaults + var now = new Date(); + var mtime = opts.date || now; + var atime = opts.date || now; + + // use reference file + if (opts.reference) { + var refStat = tryStatFile(opts.reference); + if (!refStat) { + common.error('failed to get attributess of ' + opts.reference); + } + mtime = refStat.mtime; + atime = refStat.atime; + } else if (opts.date) { + mtime = opts.date; + atime = opts.date; + } + + if (opts.atime_only && opts.mtime_only) { + // keep the new values of mtime and atime like GNU + } else if (opts.atime_only) { + mtime = stat.mtime; + } else if (opts.mtime_only) { + atime = stat.atime; + } + + fs.utimesSync(file, atime, mtime); +} + +module.exports = _touch; + +function tryStatFile(filePath) { + try { + return fs.statSync(filePath); + } catch (e) { + return null; + } +} diff --git a/tools/eslint/node_modules/shelljs/src/which.js b/tools/eslint/node_modules/shelljs/src/which.js index 2822ecfb14c97e..d17634ee941d96 100644 --- a/tools/eslint/node_modules/shelljs/src/which.js +++ b/tools/eslint/node_modules/shelljs/src/which.js @@ -2,10 +2,12 @@ var common = require('./common'); var fs = require('fs'); var path = require('path'); +// XP's system default value for PATHEXT system variable, just in case it's not +// set on Windows. +var XP_DEFAULT_PATHEXT = '.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh'; + // Cross-platform method for splitting environment PATH variables function splitPath(p) { - for (i=1;i<2;i++) {} - if (!p) return []; @@ -16,7 +18,7 @@ function splitPath(p) { } function checkPath(path) { - return fs.existsSync(path) && fs.statSync(path).isDirectory() == false; + return fs.existsSync(path) && !fs.statSync(path).isDirectory(); } //@ @@ -28,7 +30,8 @@ function checkPath(path) { //@ var nodeExec = which('node'); //@ ``` //@ -//@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions. +//@ Searches for `command` in the system's PATH. On Windows, this uses the +//@ `PATHEXT` variable to append the extension if it's not already executable. //@ Returns string containing the absolute path to the command. function _which(options, cmd) { if (!cmd) @@ -45,30 +48,42 @@ function _which(options, cmd) { if (where) return; // already found it - var attempt = path.resolve(dir + '/' + cmd); - if (checkPath(attempt)) { - where = attempt; - return; - } + var attempt = path.resolve(dir, cmd); if (common.platform === 'win') { - var baseAttempt = attempt; - attempt = baseAttempt + '.exe'; - if (checkPath(attempt)) { - where = attempt; - return; + attempt = attempt.toUpperCase(); + + // In case the PATHEXT variable is somehow not set (e.g. + // child_process.spawn with an empty environment), use the XP default. + var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT; + var pathExtArray = splitPath(pathExtEnv.toUpperCase()); + var i; + + // If the extension is already in PATHEXT, just return that. + for (i = 0; i < pathExtArray.length; i++) { + var ext = pathExtArray[i]; + if (attempt.slice(-ext.length) === ext && checkPath(attempt)) { + where = attempt; + return; + } } - attempt = baseAttempt + '.cmd'; - if (checkPath(attempt)) { - where = attempt; - return; + + // Cycle through the PATHEXT variable + var baseAttempt = attempt; + for (i = 0; i < pathExtArray.length; i++) { + attempt = baseAttempt + pathExtArray[i]; + if (checkPath(attempt)) { + where = attempt; + return; + } } - attempt = baseAttempt + '.bat'; + } else { + // Assume it's Unix-like if (checkPath(attempt)) { where = attempt; return; } - } // if 'win' + } }); } diff --git a/tools/eslint/node_modules/slice-ansi/package.json b/tools/eslint/node_modules/slice-ansi/package.json index 603644f32955a3..410e515a96922e 100644 --- a/tools/eslint/node_modules/slice-ansi/package.json +++ b/tools/eslint/node_modules/slice-ansi/package.json @@ -2,14 +2,14 @@ "_args": [ [ "slice-ansi@0.0.4", - "/Users/trott/test/node_modules/eslint/node_modules/table" + "/Users/silverwind/git/node/tools/package/package/node_modules/table" ] ], "_from": "slice-ansi@0.0.4", "_id": "slice-ansi@0.0.4", "_inCache": true, "_installable": true, - "_location": "/eslint/slice-ansi", + "_location": "/slice-ansi", "_nodeVersion": "3.2.0", "_npmUser": { "email": "threedeecee@gmail.com", @@ -26,13 +26,13 @@ "type": "version" }, "_requiredBy": [ - "/eslint/table" + "/table" ], "_resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", "_shasum": "edbf8903f66f7ce2f8eafd6ceed65e264c831b35", "_shrinkwrap": null, "_spec": "slice-ansi@0.0.4", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/table", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/table", "author": { "email": "threedeecee@gmail.com", "name": "David Caccavella" @@ -51,7 +51,7 @@ "directories": {}, "dist": { "shasum": "edbf8903f66f7ce2f8eafd6ceed65e264c831b35", - "tarball": "http://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz" + "tarball": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz" }, "engines": { "node": ">=0.10.0" @@ -62,33 +62,33 @@ "gitHead": "8670277262281964b13f051d51b2e24bcfda8a66", "homepage": "https://github.com/chalk/slice-ansi#readme", "keywords": [ - "slice", - "string", + "256", "ansi", - "styles", + "cli", "color", - "colour", "colors", - "terminal", + "colour", + "command-line", "console", - "cli", - "tty", "escape", "formatting", - "rgb", - "256", - "shell", - "xterm", "log", "logging", - "command-line", - "text" + "rgb", + "shell", + "slice", + "string", + "styles", + "terminal", + "text", + "tty", + "xterm" ], "license": "MIT", "maintainers": [ { - "email": "threedeecee@gmail.com", - "name": "dthree" + "name": "dthree", + "email": "threedeecee@gmail.com" } ], "name": "slice-ansi", diff --git a/tools/eslint/node_modules/sprintf-js/.npmignore b/tools/eslint/node_modules/sprintf-js/.npmignore deleted file mode 100644 index 096746c1480d8f..00000000000000 --- a/tools/eslint/node_modules/sprintf-js/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules/ \ No newline at end of file diff --git a/tools/eslint/node_modules/sprintf-js/bower.json b/tools/eslint/node_modules/sprintf-js/bower.json deleted file mode 100644 index d90a75989f7b05..00000000000000 --- a/tools/eslint/node_modules/sprintf-js/bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "sprintf", - "description": "JavaScript sprintf implementation", - "version": "1.0.3", - "main": "src/sprintf.js", - "license": "BSD-3-Clause-Clear", - "keywords": ["sprintf", "string", "formatting"], - "authors": ["Alexandru Marasteanu (http://alexei.ro/)"], - "homepage": "https://github.com/alexei/sprintf.js", - "repository": { - "type": "git", - "url": "git://github.com/alexei/sprintf.js.git" - } -} diff --git a/tools/eslint/node_modules/sprintf-js/demo/angular.html b/tools/eslint/node_modules/sprintf-js/demo/angular.html deleted file mode 100644 index 3559efd7635634..00000000000000 --- a/tools/eslint/node_modules/sprintf-js/demo/angular.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - -
        {{ "%+010d"|sprintf:-123 }}
        -
        {{ "%+010d"|vsprintf:[-123] }}
        -
        {{ "%+010d"|fmt:-123 }}
        -
        {{ "%+010d"|vfmt:[-123] }}
        -
        {{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
        -
        {{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
        - - - - diff --git a/tools/eslint/node_modules/sprintf-js/gruntfile.js b/tools/eslint/node_modules/sprintf-js/gruntfile.js deleted file mode 100644 index 246e1c3b9801fc..00000000000000 --- a/tools/eslint/node_modules/sprintf-js/gruntfile.js +++ /dev/null @@ -1,36 +0,0 @@ -module.exports = function(grunt) { - grunt.initConfig({ - pkg: grunt.file.readJSON("package.json"), - - uglify: { - options: { - banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n", - sourceMap: true - }, - build: { - files: [ - { - src: "src/sprintf.js", - dest: "dist/sprintf.min.js" - }, - { - src: "src/angular-sprintf.js", - dest: "dist/angular-sprintf.min.js" - } - ] - } - }, - - watch: { - js: { - files: "src/*.js", - tasks: ["uglify"] - } - } - }) - - grunt.loadNpmTasks("grunt-contrib-uglify") - grunt.loadNpmTasks("grunt-contrib-watch") - - grunt.registerTask("default", ["uglify", "watch"]) -} diff --git a/tools/eslint/node_modules/sprintf-js/package.json b/tools/eslint/node_modules/sprintf-js/package.json index b347d2ebbd0d35..ccfa96e8b11e3a 100644 --- a/tools/eslint/node_modules/sprintf-js/package.json +++ b/tools/eslint/node_modules/sprintf-js/package.json @@ -2,14 +2,14 @@ "_args": [ [ "sprintf-js@~1.0.2", - "/Users/trott/test/node_modules/eslint/node_modules/argparse" + "/Users/silverwind/git/node/tools/package/package/node_modules/argparse" ] ], "_from": "sprintf-js@>=1.0.2 <1.1.0", "_id": "sprintf-js@1.0.3", "_inCache": true, "_installable": true, - "_location": "/eslint/sprintf-js", + "_location": "/sprintf-js", "_nodeVersion": "0.12.4", "_npmUser": { "email": "hello@alexei.ro", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/argparse" + "/argparse" ], "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "_shasum": "04e6926f662895354f3dd015203633b857297e2c", "_shrinkwrap": null, "_spec": "sprintf-js@~1.0.2", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/argparse", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/argparse", "author": { "email": "hello@alexei.ro", "name": "Alexandru Marasteanu", @@ -60,8 +60,8 @@ "main": "src/sprintf.js", "maintainers": [ { - "email": "hello@alexei.ro", - "name": "alexei" + "name": "alexei", + "email": "hello@alexei.ro" } ], "name": "sprintf-js", diff --git a/tools/eslint/node_modules/sprintf-js/test/test.js b/tools/eslint/node_modules/sprintf-js/test/test.js deleted file mode 100644 index 6f57b2538c8522..00000000000000 --- a/tools/eslint/node_modules/sprintf-js/test/test.js +++ /dev/null @@ -1,82 +0,0 @@ -var assert = require("assert"), - sprintfjs = require("../src/sprintf.js"), - sprintf = sprintfjs.sprintf, - vsprintf = sprintfjs.vsprintf - -describe("sprintfjs", function() { - var pi = 3.141592653589793 - - it("should return formated strings for simple placeholders", function() { - assert.equal("%", sprintf("%%")) - assert.equal("10", sprintf("%b", 2)) - assert.equal("A", sprintf("%c", 65)) - assert.equal("2", sprintf("%d", 2)) - assert.equal("2", sprintf("%i", 2)) - assert.equal("2", sprintf("%d", "2")) - assert.equal("2", sprintf("%i", "2")) - assert.equal('{"foo":"bar"}', sprintf("%j", {foo: "bar"})) - assert.equal('["foo","bar"]', sprintf("%j", ["foo", "bar"])) - assert.equal("2e+0", sprintf("%e", 2)) - assert.equal("2", sprintf("%u", 2)) - assert.equal("4294967294", sprintf("%u", -2)) - assert.equal("2.2", sprintf("%f", 2.2)) - assert.equal("3.141592653589793", sprintf("%g", pi)) - assert.equal("10", sprintf("%o", 8)) - assert.equal("%s", sprintf("%s", "%s")) - assert.equal("ff", sprintf("%x", 255)) - assert.equal("FF", sprintf("%X", 255)) - assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")) - assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"})) - }) - - it("should return formated strings for complex placeholders", function() { - // sign - assert.equal("2", sprintf("%d", 2)) - assert.equal("-2", sprintf("%d", -2)) - assert.equal("+2", sprintf("%+d", 2)) - assert.equal("-2", sprintf("%+d", -2)) - assert.equal("2", sprintf("%i", 2)) - assert.equal("-2", sprintf("%i", -2)) - assert.equal("+2", sprintf("%+i", 2)) - assert.equal("-2", sprintf("%+i", -2)) - assert.equal("2.2", sprintf("%f", 2.2)) - assert.equal("-2.2", sprintf("%f", -2.2)) - assert.equal("+2.2", sprintf("%+f", 2.2)) - assert.equal("-2.2", sprintf("%+f", -2.2)) - assert.equal("-2.3", sprintf("%+.1f", -2.34)) - assert.equal("-0.0", sprintf("%+.1f", -0.01)) - assert.equal("3.14159", sprintf("%.6g", pi)) - assert.equal("3.14", sprintf("%.3g", pi)) - assert.equal("3", sprintf("%.1g", pi)) - assert.equal("-000000123", sprintf("%+010d", -123)) - assert.equal("______-123", sprintf("%+'_10d", -123)) - assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2)) - - // padding - assert.equal("-0002", sprintf("%05d", -2)) - assert.equal("-0002", sprintf("%05i", -2)) - assert.equal(" <", sprintf("%5s", "<")) - assert.equal("0000<", sprintf("%05s", "<")) - assert.equal("____<", sprintf("%'_5s", "<")) - assert.equal("> ", sprintf("%-5s", ">")) - assert.equal(">0000", sprintf("%0-5s", ">")) - assert.equal(">____", sprintf("%'_-5s", ">")) - assert.equal("xxxxxx", sprintf("%5s", "xxxxxx")) - assert.equal("1234", sprintf("%02u", 1234)) - assert.equal(" -10.235", sprintf("%8.3f", -10.23456)) - assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx")) - assert.equal('{\n "foo": "bar"\n}', sprintf("%2j", {foo: "bar"})) - assert.equal('[\n "foo",\n "bar"\n]', sprintf("%2j", ["foo", "bar"])) - - // precision - assert.equal("2.3", sprintf("%.1f", 2.345)) - assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx")) - assert.equal(" x", sprintf("%5.1s", "xxxxxx")) - - }) - - it("should return formated strings for callbacks", function() { - assert.equal("foobar", sprintf("%s", function() { return "foobar" })) - assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass... - }) -}) diff --git a/tools/eslint/node_modules/string-width/package.json b/tools/eslint/node_modules/string-width/package.json index 6fe09bdcc74427..87610fc4644544 100644 --- a/tools/eslint/node_modules/string-width/package.json +++ b/tools/eslint/node_modules/string-width/package.json @@ -2,14 +2,14 @@ "_args": [ [ "string-width@^1.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/inquirer" + "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer" ] ], "_from": "string-width@>=1.0.1 <2.0.0", "_id": "string-width@1.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/string-width", + "_location": "/string-width", "_nodeVersion": "0.12.5", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/inquirer", - "/eslint/table" + "/inquirer", + "/table" ], "_resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.1.tgz", "_shasum": "c92129b6f1d7f52acf9af424a26e3864a05ceb0a", "_shrinkwrap": null, "_spec": "string-width@^1.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/inquirer", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -65,36 +65,36 @@ "gitHead": "f279cfd14835f0a3c8df69ba18e9a3960156e135", "homepage": "https://github.com/sindresorhus/string-width", "keywords": [ - "string", - "str", - "character", + "ansi", "char", - "unicode", - "width", - "visual", + "character", + "chinese", + "cjk", + "cli", + "codes", "column", "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", "command-line", - "terminal", "console", - "cjk", - "chinese", + "escape", + "fixed-width", + "full", + "full-width", + "fullwidth", "japanese", "korean", - "fixed-width" + "str", + "string", + "terminal", + "unicode", + "visual", + "width" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "string-width", diff --git a/tools/eslint/node_modules/string_decoder/.npmignore b/tools/eslint/node_modules/string_decoder/.npmignore deleted file mode 100644 index 206320cc1d21b9..00000000000000 --- a/tools/eslint/node_modules/string_decoder/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -build -test diff --git a/tools/eslint/node_modules/string_decoder/package.json b/tools/eslint/node_modules/string_decoder/package.json index 1f448bb2cc2cf8..c0fe7cf3e314f1 100644 --- a/tools/eslint/node_modules/string_decoder/package.json +++ b/tools/eslint/node_modules/string_decoder/package.json @@ -2,14 +2,14 @@ "_args": [ [ "string_decoder@~0.10.x", - "/Users/trott/test/node_modules/eslint/node_modules/readable-stream" + "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream" ] ], "_from": "string_decoder@>=0.10.0 <0.11.0", "_id": "string_decoder@0.10.31", "_inCache": true, "_installable": true, - "_location": "/eslint/string_decoder", + "_location": "/string_decoder", "_npmUser": { "email": "rod@vagg.org", "name": "rvagg" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/readable-stream" + "/readable-stream" ], "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", "_shrinkwrap": null, "_spec": "string_decoder@~0.10.x", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/readable-stream", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream", "bugs": { "url": "https://github.com/rvagg/string_decoder/issues" }, @@ -48,21 +48,21 @@ "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0", "homepage": "https://github.com/rvagg/string_decoder", "keywords": [ - "string", - "decoder", "browser", - "browserify" + "browserify", + "decoder", + "string" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" }, { - "email": "rod@vagg.org", - "name": "rvagg" + "name": "rvagg", + "email": "rod@vagg.org" } ], "name": "string_decoder", diff --git a/tools/eslint/node_modules/strip-ansi/package.json b/tools/eslint/node_modules/strip-ansi/package.json index 189069f4b5c9b2..dc273a87c98f0c 100644 --- a/tools/eslint/node_modules/strip-ansi/package.json +++ b/tools/eslint/node_modules/strip-ansi/package.json @@ -2,20 +2,24 @@ "_args": [ [ "strip-ansi@^3.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/chalk" + "/Users/silverwind/git/node/tools/package/package/node_modules/chalk" ] ], "_from": "strip-ansi@>=3.0.0 <4.0.0", - "_id": "strip-ansi@3.0.0", + "_id": "strip-ansi@3.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/strip-ansi", - "_nodeVersion": "0.12.5", + "_location": "/strip-ansi", + "_nodeVersion": "0.12.7", + "_npmOperationalInternal": { + "host": "packages-9-west.internal.npmjs.com", + "tmp": "tmp/strip-ansi-3.0.1.tgz_1456057278183_0.28958667791448534" + }, "_npmUser": { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "email": "jappelman@xebia.com", + "name": "jbnicolai" }, - "_npmVersion": "2.11.2", + "_npmVersion": "2.11.3", "_phantomChildren": {}, "_requested": { "name": "strip-ansi", @@ -26,35 +30,36 @@ "type": "range" }, "_requiredBy": [ - "/eslint/chalk", - "/eslint/inquirer", - "/eslint/string-width", - "/eslint/table" + "/chalk", + "/inquirer", + "/string-width", + "/table" ], - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz", - "_shasum": "7510b665567ca914ccb5d7e072763ac968be3724", + "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "_shasum": "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf", "_shrinkwrap": null, "_spec": "strip-ansi@^3.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/chalk", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/chalk", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", "url": "sindresorhus.com" }, "bugs": { - "url": "https://github.com/sindresorhus/strip-ansi/issues" + "url": "https://github.com/chalk/strip-ansi/issues" }, "dependencies": { "ansi-regex": "^2.0.0" }, "description": "Strip ANSI escape codes", "devDependencies": { - "ava": "0.0.4" + "ava": "*", + "xo": "*" }, "directories": {}, "dist": { - "shasum": "7510b665567ca914ccb5d7e072763ac968be3724", - "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz" + "shasum": "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf", + "tarball": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" }, "engines": { "node": ">=0.10.0" @@ -62,41 +67,41 @@ "files": [ "index.js" ], - "gitHead": "3f05b9810e1438f946e2eb84ee854cc00b972e9e", - "homepage": "https://github.com/sindresorhus/strip-ansi", + "gitHead": "8270705c704956da865623e564eba4875c3ea17f", + "homepage": "https://github.com/chalk/strip-ansi", "keywords": [ - "strip", - "trim", - "remove", + "256", "ansi", - "styles", "color", - "colour", "colors", - "terminal", + "colour", + "command-line", "console", - "string", - "tty", "escape", "formatting", - "rgb", - "256", - "shell", - "xterm", "log", "logging", - "command-line", - "text" + "remove", + "rgb", + "shell", + "string", + "strip", + "styles", + "terminal", + "text", + "trim", + "tty", + "xterm" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" }, { - "email": "jappelman@xebia.com", - "name": "jbnicolai" + "name": "jbnicolai", + "email": "jappelman@xebia.com" } ], "name": "strip-ansi", @@ -104,10 +109,10 @@ "readme": "ERROR: No README data found!", "repository": { "type": "git", - "url": "git+https://github.com/sindresorhus/strip-ansi.git" + "url": "git+https://github.com/chalk/strip-ansi.git" }, "scripts": { - "test": "node test.js" + "test": "xo && ava" }, - "version": "3.0.0" + "version": "3.0.1" } diff --git a/tools/eslint/node_modules/strip-ansi/readme.md b/tools/eslint/node_modules/strip-ansi/readme.md index 76091512df5e46..cb7d9ff7ee403d 100644 --- a/tools/eslint/node_modules/strip-ansi/readme.md +++ b/tools/eslint/node_modules/strip-ansi/readme.md @@ -1,4 +1,4 @@ -# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi) +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) > Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) @@ -22,10 +22,10 @@ stripAnsi('\u001b[4mcake\u001b[0m'); ## Related -- [strip-ansi-cli](https://github.com/sindresorhus/strip-ansi-cli) - CLI for this module -- [has-ansi](https://github.com/sindresorhus/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/sindresorhus/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/sindresorhus/chalk) - Terminal string styling done right +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right ## License diff --git a/tools/eslint/node_modules/strip-json-comments/package.json b/tools/eslint/node_modules/strip-json-comments/package.json index 3727967f5af0bb..f0574ec2606f2c 100644 --- a/tools/eslint/node_modules/strip-json-comments/package.json +++ b/tools/eslint/node_modules/strip-json-comments/package.json @@ -2,14 +2,14 @@ "_args": [ [ "strip-json-comments@~1.0.1", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "strip-json-comments@>=1.0.1 <1.1.0", "_id": "strip-json-comments@1.0.4", "_inCache": true, "_installable": true, - "_location": "/eslint/strip-json-comments", + "_location": "/strip-json-comments", "_nodeVersion": "0.12.5", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", "_shasum": "1e15fbcac97d3ee99bf2d73b4c656b082bbafb91", "_shrinkwrap": null, "_spec": "strip-json-comments@~1.0.1", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -64,30 +64,30 @@ "gitHead": "f58348696368583cc5bb18525fe31eacc9bd00e1", "homepage": "https://github.com/sindresorhus/strip-json-comments", "keywords": [ - "json", - "strip", - "remove", - "delete", - "trim", + "bin", + "cli", "comments", - "multiline", - "parse", + "conf", "config", "configuration", - "conf", - "settings", - "util", + "delete", "env", "environment", - "cli", - "bin" + "json", + "multiline", + "parse", + "remove", + "settings", + "strip", + "trim", + "util" ], "license": "MIT", "main": "strip-json-comments", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "strip-json-comments", diff --git a/tools/eslint/node_modules/supports-color/package.json b/tools/eslint/node_modules/supports-color/package.json index 6378600d9eed16..6d39985d35282e 100644 --- a/tools/eslint/node_modules/supports-color/package.json +++ b/tools/eslint/node_modules/supports-color/package.json @@ -2,14 +2,14 @@ "_args": [ [ "supports-color@^2.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/chalk" + "/Users/silverwind/git/node/tools/package/package/node_modules/chalk" ] ], "_from": "supports-color@>=2.0.0 <3.0.0", "_id": "supports-color@2.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/supports-color", + "_location": "/supports-color", "_nodeVersion": "0.12.5", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/chalk" + "/chalk" ], "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "_shasum": "535d045ce6b6363fa40117084629995e9df324c7", "_shrinkwrap": null, "_spec": "supports-color@^2.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/chalk", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/chalk", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -50,7 +50,7 @@ "directories": {}, "dist": { "shasum": "535d045ce6b6363fa40117084629995e9df324c7", - "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" + "tarball": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" }, "engines": { "node": ">=0.8.0" @@ -61,34 +61,34 @@ "gitHead": "8400d98ade32b2adffd50902c06d9e725a5c6588", "homepage": "https://github.com/chalk/supports-color", "keywords": [ + "256", + "ansi", + "capability", + "cli", "color", - "colour", "colors", - "terminal", + "colour", + "command-line", "console", - "cli", - "ansi", - "styles", - "tty", + "detect", "rgb", - "256", "shell", - "xterm", - "command-line", + "styles", "support", "supports", - "capability", - "detect" + "terminal", + "tty", + "xterm" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" }, { - "email": "jappelman@xebia.com", - "name": "jbnicolai" + "name": "jbnicolai", + "email": "jappelman@xebia.com" } ], "name": "supports-color", diff --git a/tools/eslint/node_modules/table/package.json b/tools/eslint/node_modules/table/package.json index 2db6c296e24acc..9c7d21e3a12608 100644 --- a/tools/eslint/node_modules/table/package.json +++ b/tools/eslint/node_modules/table/package.json @@ -2,14 +2,14 @@ "_args": [ [ "table@^3.7.8", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "table@>=3.7.8 <4.0.0", "_id": "table@3.7.8", "_inCache": true, "_installable": true, - "_location": "/eslint/table", + "_location": "/table", "_nodeVersion": "5.3.0", "_npmUser": { "email": "gajus@gajus.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/table/-/table-3.7.8.tgz", "_shasum": "b424433ef596851922b2fd77224a69a1951618eb", "_shrinkwrap": null, "_spec": "table@^3.7.8", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "gajus@gajus.com", "name": "Gajus Kuizinas", @@ -67,18 +67,18 @@ "gitHead": "7464b27999c5c6da43c754fb5f94931423d41839", "homepage": "https://github.com/gajus/table#readme", "keywords": [ + "align", + "ansi", "ascii", - "text", "table", - "align", - "ansi" + "text" ], "license": "BSD-3-Clause", "main": "./dist/index.js", "maintainers": [ { - "email": "gk@anuary.com", - "name": "gajus" + "name": "gajus", + "email": "gk@anuary.com" } ], "name": "table", diff --git a/tools/eslint/node_modules/text-table/.travis.yml b/tools/eslint/node_modules/text-table/.travis.yml deleted file mode 100644 index cc4dba29d959a2..00000000000000 --- a/tools/eslint/node_modules/text-table/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/tools/eslint/node_modules/text-table/example/align.js b/tools/eslint/node_modules/text-table/example/align.js deleted file mode 100644 index 9be43098cf87b8..00000000000000 --- a/tools/eslint/node_modules/text-table/example/align.js +++ /dev/null @@ -1,8 +0,0 @@ -var table = require('../'); -var t = table([ - [ 'beep', '1024' ], - [ 'boop', '33450' ], - [ 'foo', '1006' ], - [ 'bar', '45' ] -], { align: [ 'l', 'r' ] }); -console.log(t); diff --git a/tools/eslint/node_modules/text-table/example/center.js b/tools/eslint/node_modules/text-table/example/center.js deleted file mode 100644 index 52b1c69e012cb1..00000000000000 --- a/tools/eslint/node_modules/text-table/example/center.js +++ /dev/null @@ -1,8 +0,0 @@ -var table = require('../'); -var t = table([ - [ 'beep', '1024', 'xyz' ], - [ 'boop', '3388450', 'tuv' ], - [ 'foo', '10106', 'qrstuv' ], - [ 'bar', '45', 'lmno' ] -], { align: [ 'l', 'c', 'l' ] }); -console.log(t); diff --git a/tools/eslint/node_modules/text-table/example/dotalign.js b/tools/eslint/node_modules/text-table/example/dotalign.js deleted file mode 100644 index 2cea6299368475..00000000000000 --- a/tools/eslint/node_modules/text-table/example/dotalign.js +++ /dev/null @@ -1,9 +0,0 @@ -var table = require('../'); -var t = table([ - [ 'beep', '1024' ], - [ 'boop', '334.212' ], - [ 'foo', '1006' ], - [ 'bar', '45.6' ], - [ 'baz', '123.' ] -], { align: [ 'l', '.' ] }); -console.log(t); diff --git a/tools/eslint/node_modules/text-table/example/doubledot.js b/tools/eslint/node_modules/text-table/example/doubledot.js deleted file mode 100644 index bab983b664cd6d..00000000000000 --- a/tools/eslint/node_modules/text-table/example/doubledot.js +++ /dev/null @@ -1,11 +0,0 @@ -var table = require('../'); -var t = table([ - [ '0.1.2' ], - [ '11.22.33' ], - [ '5.6.7' ], - [ '1.22222' ], - [ '12345.' ], - [ '5555.' ], - [ '123' ] -], { align: [ '.' ] }); -console.log(t); diff --git a/tools/eslint/node_modules/text-table/example/table.js b/tools/eslint/node_modules/text-table/example/table.js deleted file mode 100644 index 903ea4c417ccb0..00000000000000 --- a/tools/eslint/node_modules/text-table/example/table.js +++ /dev/null @@ -1,6 +0,0 @@ -var table = require('../'); -var t = table([ - [ 'master', '0123456789abcdef' ], - [ 'staging', 'fedcba9876543210' ] -]); -console.log(t); diff --git a/tools/eslint/node_modules/text-table/package.json b/tools/eslint/node_modules/text-table/package.json index fa69f07ccf6acb..794595d339a3a8 100644 --- a/tools/eslint/node_modules/text-table/package.json +++ b/tools/eslint/node_modules/text-table/package.json @@ -2,14 +2,14 @@ "_args": [ [ "text-table@~0.2.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "text-table@>=0.2.0 <0.3.0", "_id": "text-table@0.2.0", "_inCache": true, "_installable": true, - "_location": "/eslint/text-table", + "_location": "/text-table", "_npmUser": { "email": "mail@substack.net", "name": "substack" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "_shasum": "7f5ee823ae805207c00af2df4a84ec3fcfa570b4", "_shrinkwrap": null, "_spec": "text-table@~0.2.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "mail@substack.net", "name": "James Halliday", @@ -54,19 +54,19 @@ }, "homepage": "https://github.com/substack/text-table", "keywords": [ - "text", - "table", "align", "ascii", "rows", - "tabular" + "table", + "tabular", + "text" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" } ], "name": "text-table", @@ -82,13 +82,13 @@ }, "testling": { "browsers": [ - "ie/6..latest", "chrome/20..latest", "firefox/10..latest", - "safari/latest", - "opera/11.0..latest", + "ie/6..latest", + "ipad/6", "iphone/6", - "ipad/6" + "opera/11.0..latest", + "safari/latest" ], "files": "test/*.js" }, diff --git a/tools/eslint/node_modules/text-table/test/align.js b/tools/eslint/node_modules/text-table/test/align.js deleted file mode 100644 index 245357f26a76b9..00000000000000 --- a/tools/eslint/node_modules/text-table/test/align.js +++ /dev/null @@ -1,18 +0,0 @@ -var test = require('tape'); -var table = require('../'); - -test('align', function (t) { - t.plan(1); - var s = table([ - [ 'beep', '1024' ], - [ 'boop', '33450' ], - [ 'foo', '1006' ], - [ 'bar', '45' ] - ], { align: [ 'l', 'r' ] }); - t.equal(s, [ - 'beep 1024', - 'boop 33450', - 'foo 1006', - 'bar 45' - ].join('\n')); -}); diff --git a/tools/eslint/node_modules/text-table/test/ansi-colors.js b/tools/eslint/node_modules/text-table/test/ansi-colors.js deleted file mode 100644 index fbc5bb10ad732a..00000000000000 --- a/tools/eslint/node_modules/text-table/test/ansi-colors.js +++ /dev/null @@ -1,32 +0,0 @@ -var test = require('tape'); -var table = require('../'); -var color = require('cli-color'); -var ansiTrim = require('cli-color/lib/trim'); - -test('center', function (t) { - t.plan(1); - var opts = { - align: [ 'l', 'c', 'l' ], - stringLength: function(s) { return ansiTrim(s).length } - }; - var s = table([ - [ - color.red('Red'), color.green('Green'), color.blue('Blue') - ], - [ - color.bold('Bold'), color.underline('Underline'), - color.italic('Italic') - ], - [ - color.inverse('Inverse'), color.strike('Strike'), - color.blink('Blink') - ], - [ 'bar', '45', 'lmno' ] - ], opts); - t.equal(ansiTrim(s), [ - 'Red Green Blue', - 'Bold Underline Italic', - 'Inverse Strike Blink', - 'bar 45 lmno' - ].join('\n')); -}); diff --git a/tools/eslint/node_modules/text-table/test/center.js b/tools/eslint/node_modules/text-table/test/center.js deleted file mode 100644 index c2c7a62a8f8cca..00000000000000 --- a/tools/eslint/node_modules/text-table/test/center.js +++ /dev/null @@ -1,18 +0,0 @@ -var test = require('tape'); -var table = require('../'); - -test('center', function (t) { - t.plan(1); - var s = table([ - [ 'beep', '1024', 'xyz' ], - [ 'boop', '3388450', 'tuv' ], - [ 'foo', '10106', 'qrstuv' ], - [ 'bar', '45', 'lmno' ] - ], { align: [ 'l', 'c', 'l' ] }); - t.equal(s, [ - 'beep 1024 xyz', - 'boop 3388450 tuv', - 'foo 10106 qrstuv', - 'bar 45 lmno' - ].join('\n')); -}); diff --git a/tools/eslint/node_modules/text-table/test/dotalign.js b/tools/eslint/node_modules/text-table/test/dotalign.js deleted file mode 100644 index f804f9281ab135..00000000000000 --- a/tools/eslint/node_modules/text-table/test/dotalign.js +++ /dev/null @@ -1,20 +0,0 @@ -var test = require('tape'); -var table = require('../'); - -test('dot align', function (t) { - t.plan(1); - var s = table([ - [ 'beep', '1024' ], - [ 'boop', '334.212' ], - [ 'foo', '1006' ], - [ 'bar', '45.6' ], - [ 'baz', '123.' ] - ], { align: [ 'l', '.' ] }); - t.equal(s, [ - 'beep 1024', - 'boop 334.212', - 'foo 1006', - 'bar 45.6', - 'baz 123.' - ].join('\n')); -}); diff --git a/tools/eslint/node_modules/text-table/test/doubledot.js b/tools/eslint/node_modules/text-table/test/doubledot.js deleted file mode 100644 index 659b57c9314bca..00000000000000 --- a/tools/eslint/node_modules/text-table/test/doubledot.js +++ /dev/null @@ -1,24 +0,0 @@ -var test = require('tape'); -var table = require('../'); - -test('dot align', function (t) { - t.plan(1); - var s = table([ - [ '0.1.2' ], - [ '11.22.33' ], - [ '5.6.7' ], - [ '1.22222' ], - [ '12345.' ], - [ '5555.' ], - [ '123' ] - ], { align: [ '.' ] }); - t.equal(s, [ - ' 0.1.2', - '11.22.33', - ' 5.6.7', - ' 1.22222', - '12345.', - ' 5555.', - ' 123' - ].join('\n')); -}); diff --git a/tools/eslint/node_modules/text-table/test/table.js b/tools/eslint/node_modules/text-table/test/table.js deleted file mode 100644 index 9c6701464cf66a..00000000000000 --- a/tools/eslint/node_modules/text-table/test/table.js +++ /dev/null @@ -1,14 +0,0 @@ -var test = require('tape'); -var table = require('../'); - -test('table', function (t) { - t.plan(1); - var s = table([ - [ 'master', '0123456789abcdef' ], - [ 'staging', 'fedcba9876543210' ] - ]); - t.equal(s, [ - 'master 0123456789abcdef', - 'staging fedcba9876543210' - ].join('\n')); -}); diff --git a/tools/eslint/node_modules/through/.travis.yml b/tools/eslint/node_modules/through/.travis.yml deleted file mode 100644 index c693a939df9809..00000000000000 --- a/tools/eslint/node_modules/through/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - "0.10" diff --git a/tools/eslint/node_modules/through/package.json b/tools/eslint/node_modules/through/package.json index 70aa857120166c..bb29a8eca370a4 100644 --- a/tools/eslint/node_modules/through/package.json +++ b/tools/eslint/node_modules/through/package.json @@ -2,14 +2,14 @@ "_args": [ [ "through@^2.3.6", - "/Users/trott/test/node_modules/eslint/node_modules/inquirer" + "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer" ] ], "_from": "through@>=2.3.6 <3.0.0", "_id": "through@2.3.8", "_inCache": true, "_installable": true, - "_location": "/eslint/through", + "_location": "/through", "_nodeVersion": "2.3.1", "_npmUser": { "email": "dominic.tarr@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/inquirer" + "/inquirer" ], "_resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "_shasum": "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5", "_shrinkwrap": null, "_spec": "through@^2.3.6", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/inquirer", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/inquirer", "author": { "email": "dominic.tarr@gmail.com", "name": "Dominic Tarr", @@ -51,22 +51,22 @@ "directories": {}, "dist": { "shasum": "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5", - "tarball": "http://registry.npmjs.org/through/-/through-2.3.8.tgz" + "tarball": "https://registry.npmjs.org/through/-/through-2.3.8.tgz" }, "gitHead": "2c5a6f9a0cc54da759b6e10964f2081c358e49dc", "homepage": "https://github.com/dominictarr/through", "keywords": [ + "pipe", "stream", "streams", - "user-streams", - "pipe" + "user-streams" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "dominic.tarr@gmail.com", - "name": "dominictarr" + "name": "dominictarr", + "email": "dominic.tarr@gmail.com" } ], "name": "through", @@ -81,9 +81,9 @@ }, "testling": { "browsers": [ - "ie/8..latest", - "ff/15..latest", "chrome/20..latest", + "ff/15..latest", + "ie/8..latest", "safari/5.1..latest" ], "files": "test/*.js" diff --git a/tools/eslint/node_modules/through/test/async.js b/tools/eslint/node_modules/through/test/async.js deleted file mode 100644 index f6fc95f4ffad8f..00000000000000 --- a/tools/eslint/node_modules/through/test/async.js +++ /dev/null @@ -1,28 +0,0 @@ -var from = require('from') -var through = require('../') - -var tape = require('tape') - -tape('simple async example', function (t) { - - var n = 0, expected = [1,2,3,4,5], actual = [] - from(expected) - .pipe(through(function(data) { - this.pause() - n ++ - setTimeout(function(){ - console.log('pushing data', data) - this.push(data) - this.resume() - }.bind(this), 300) - })).pipe(through(function(data) { - console.log('pushing data second time', data); - this.push(data) - })).on('data', function (d) { - actual.push(d) - }).on('end', function() { - t.deepEqual(actual, expected) - t.end() - }) - -}) diff --git a/tools/eslint/node_modules/through/test/auto-destroy.js b/tools/eslint/node_modules/through/test/auto-destroy.js deleted file mode 100644 index 305fff23d35d9b..00000000000000 --- a/tools/eslint/node_modules/through/test/auto-destroy.js +++ /dev/null @@ -1,29 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('end before close', function (assert) { - var ts = through() - ts.autoDestroy = false - var ended = false, closed = false - - ts.on('end', function () { - assert.ok(!closed) - ended = true - }) - ts.on('close', function () { - assert.ok(ended) - closed = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.ok(ended) - assert.notOk(closed) - ts.destroy() - assert.ok(closed) - assert.end() -}) diff --git a/tools/eslint/node_modules/through/test/buffering.js b/tools/eslint/node_modules/through/test/buffering.js deleted file mode 100644 index b0084bfc6ed5ac..00000000000000 --- a/tools/eslint/node_modules/through/test/buffering.js +++ /dev/null @@ -1,71 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('buffering', function(assert) { - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - assert.deepEqual(actual, [1, 2, 3]) - ts.pause() - ts.write(4) - ts.write(5) - ts.write(6) - assert.deepEqual(actual, [1, 2, 3]) - ts.resume() - assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]) - ts.pause() - ts.end() - assert.ok(!ended) - ts.resume() - assert.ok(ended) - assert.end() -}) - -test('buffering has data in queue, when ends', function (assert) { - - /* - * If stream ends while paused with data in the queue, - * stream should still emit end after all data is written - * on resume. - */ - - var ts = through(function (data) { - this.queue(data) - }, function () { - this.queue(null) - }) - - var ended = false, actual = [] - - ts.on('data', actual.push.bind(actual)) - ts.on('end', function () { - ended = true - }) - - ts.pause() - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.deepEqual(actual, [], 'no data written yet, still paused') - assert.ok(!ended, 'end not emitted yet, still paused') - ts.resume() - assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered') - assert.ok(ended, 'end should be emitted once all data was delivered') - assert.end(); -}) diff --git a/tools/eslint/node_modules/through/test/end.js b/tools/eslint/node_modules/through/test/end.js deleted file mode 100644 index fa113f58e0360a..00000000000000 --- a/tools/eslint/node_modules/through/test/end.js +++ /dev/null @@ -1,45 +0,0 @@ -var test = require('tape') -var through = require('../') - -// must emit end before close. - -test('end before close', function (assert) { - var ts = through() - var ended = false, closed = false - - ts.on('end', function () { - assert.ok(!closed) - ended = true - }) - ts.on('close', function () { - assert.ok(ended) - closed = true - }) - - ts.write(1) - ts.write(2) - ts.write(3) - ts.end() - assert.ok(ended) - assert.ok(closed) - assert.end() -}) - -test('end only once', function (t) { - - var ts = through() - var ended = false, closed = false - - ts.on('end', function () { - t.equal(ended, false) - ended = true - }) - - ts.queue(null) - ts.queue(null) - ts.queue(null) - - ts.resume() - - t.end() -}) diff --git a/tools/eslint/node_modules/through/test/index.js b/tools/eslint/node_modules/through/test/index.js deleted file mode 100644 index 1d9523f40e495a..00000000000000 --- a/tools/eslint/node_modules/through/test/index.js +++ /dev/null @@ -1,133 +0,0 @@ - -var test = require('tape') -var spec = require('stream-spec') -var through = require('../') - -/* - I'm using these two functions, and not streams and pipe - so there is less to break. if this test fails it must be - the implementation of _through_ -*/ - -function write(array, stream) { - array = array.slice() - function next() { - while(array.length) - if(stream.write(array.shift()) === false) - return stream.once('drain', next) - - stream.end() - } - - next() -} - -function read(stream, callback) { - var actual = [] - stream.on('data', function (data) { - actual.push(data) - }) - stream.once('end', function () { - callback(null, actual) - }) - stream.once('error', function (err) { - callback(err) - }) -} - -test('simple defaults', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through() - var s = spec(t).through().pausable() - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - assert.end() - }) - - t.on('close', s.validate) - - write(expected, t) -}); - -test('simple functions', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l * Math.random()) - - var t = through(function (data) { - this.emit('data', data*2) - }) - var s = spec(t).through().pausable() - - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected.map(function (data) { - return data*2 - })) - assert.end() - }) - - t.on('close', s.validate) - - write(expected, t) -}) - -test('pauses', function(assert) { - - var l = 1000 - , expected = [] - - while(l--) expected.push(l) //Math.random()) - - var t = through() - - var s = spec(t) - .through() - .pausable() - - t.on('data', function () { - if(Math.random() > 0.1) return - t.pause() - process.nextTick(function () { - t.resume() - }) - }) - - read(t, function (err, actual) { - assert.ifError(err) - assert.deepEqual(actual, expected) - }) - - t.on('close', function () { - s.validate() - assert.end() - }) - - write(expected, t) -}) - -test('does not soft-end on `undefined`', function(assert) { - var stream = through() - , count = 0 - - stream.on('data', function (data) { - count++ - }) - - stream.write(undefined) - stream.write(undefined) - - assert.equal(count, 2) - - assert.end() -}) diff --git a/tools/eslint/node_modules/tryit/.npmignore b/tools/eslint/node_modules/tryit/.npmignore deleted file mode 100644 index 9daa8247da451d..00000000000000 --- a/tools/eslint/node_modules/tryit/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -node_modules diff --git a/tools/eslint/node_modules/tryit/package.json b/tools/eslint/node_modules/tryit/package.json index b138c6ea6a7331..8bb7e14a8a8dca 100644 --- a/tools/eslint/node_modules/tryit/package.json +++ b/tools/eslint/node_modules/tryit/package.json @@ -2,14 +2,14 @@ "_args": [ [ "tryit@^1.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/is-resolvable" + "/Users/silverwind/git/node/tools/package/package/node_modules/is-resolvable" ] ], "_from": "tryit@>=1.0.1 <2.0.0", "_id": "tryit@1.0.2", "_inCache": true, "_installable": true, - "_location": "/eslint/tryit", + "_location": "/tryit", "_nodeVersion": "4.1.0", "_npmUser": { "email": "henrik@joreteg.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/is-resolvable" + "/is-resolvable" ], "_resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.2.tgz", "_shasum": "c196b0073e6b1c595d93c9c830855b7acc32a453", "_shrinkwrap": null, "_spec": "tryit@^1.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/is-resolvable", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/is-resolvable", "author": { "email": "henrik@andyet.net", "name": "Henrik Joreteg" @@ -54,16 +54,16 @@ "gitHead": "b567b4feb491e2ee89addd3d06f66d6ec2217cf5", "homepage": "https://github.com/HenrikJoreteg/tryit#readme", "keywords": [ + "errorhandling", "errors", - "try", - "errorhandling" + "try" ], "license": "MIT", "main": "tryit.js", "maintainers": [ { - "email": "henrik@andyet.net", - "name": "henrikjoreteg" + "name": "henrikjoreteg", + "email": "henrik@andyet.net" } ], "name": "tryit", diff --git a/tools/eslint/node_modules/tryit/test/test.js b/tools/eslint/node_modules/tryit/test/test.js deleted file mode 100644 index 68f6f2b8cf0c6a..00000000000000 --- a/tools/eslint/node_modules/tryit/test/test.js +++ /dev/null @@ -1,37 +0,0 @@ -var test = require('tape'); -var tryit = require('../tryit'); - - -test('basic functionality', function (t) { - var count = 0; - - var noOp = function () {}; - var throwsError = function () { - throw new Error('whammo'); - } - - tryit(noOp, function (e) { - t.ok(e == null, 'should be called without an error'); - }); - - tryit(throwsError, function (e) { - t.ok('should be called'); - t.ok(e instanceof Error); - }); - - t.end(); -}); - -test('handle case where callback throws', function (t) { - var count = 0; - - t.throws(function () { - tryit(function () {}, function(e) { - count++; - t.equal(count, 1, 'should be called once'); - throw new Error('kablowie'); - }); - }, 'should throw once'); - - t.end(); -}); diff --git a/tools/eslint/node_modules/tv4/package.json b/tools/eslint/node_modules/tv4/package.json index 4b20e94f2bce62..74c36f57d3ebb4 100644 --- a/tools/eslint/node_modules/tv4/package.json +++ b/tools/eslint/node_modules/tv4/package.json @@ -2,14 +2,14 @@ "_args": [ [ "tv4@^1.2.7", - "/Users/trott/test/node_modules/eslint/node_modules/table" + "/Users/silverwind/git/node/tools/package/package/node_modules/table" ] ], "_from": "tv4@>=1.2.7 <2.0.0", "_id": "tv4@1.2.7", "_inCache": true, "_installable": true, - "_location": "/eslint/tv4", + "_location": "/tv4", "_nodeVersion": "0.12.4", "_npmUser": { "email": "luffgd@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/table" + "/table" ], "_resolved": "https://registry.npmjs.org/tv4/-/tv4-1.2.7.tgz", "_shasum": "bd29389afc73ade49ae5f48142b5d544bf68d120", "_shrinkwrap": null, "_spec": "tv4@^1.2.7", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/table", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/table", "author": { "name": "Geraint Luff" }, @@ -75,8 +75,8 @@ "keywords": [ "json-schema", "schema", - "validator", - "tv4" + "tv4", + "validator" ], "license:": [ { @@ -91,12 +91,12 @@ "main": "tv4.js", "maintainers": [ { - "email": "luffgd@gmail.com", - "name": "geraintluff" + "name": "geraintluff", + "email": "luffgd@gmail.com" }, { - "email": "bartvanderschoor@gmail.com", - "name": "bartvds" + "name": "bartvds", + "email": "bartvanderschoor@gmail.com" } ], "name": "tv4", diff --git a/tools/eslint/node_modules/type-check/package.json b/tools/eslint/node_modules/type-check/package.json index 0a23aceaa86d62..fd9f152366d434 100644 --- a/tools/eslint/node_modules/type-check/package.json +++ b/tools/eslint/node_modules/type-check/package.json @@ -2,14 +2,14 @@ "_args": [ [ "type-check@~0.3.2", - "/Users/trott/test/node_modules/eslint/node_modules/optionator" + "/Users/silverwind/git/node/tools/package/package/node_modules/optionator" ] ], "_from": "type-check@>=0.3.2 <0.4.0", "_id": "type-check@0.3.2", "_inCache": true, "_installable": true, - "_location": "/eslint/type-check", + "_location": "/type-check", "_nodeVersion": "4.2.4", "_npmUser": { "email": "z@georgezahariev.com", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/levn", - "/eslint/optionator" + "/levn", + "/optionator" ], "_resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "_shasum": "5884cab512cf1d355e3fb784f30804b2b520db72", "_shrinkwrap": null, "_spec": "type-check@~0.3.2", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/optionator", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/optionator", "author": { "email": "z@georgezahariev.com", "name": "George Zahariev" @@ -54,30 +54,30 @@ "directories": {}, "dist": { "shasum": "5884cab512cf1d355e3fb784f30804b2b520db72", - "tarball": "http://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" + "tarball": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" }, "engines": { "node": ">= 0.8.0" }, "files": [ - "lib", + "LICENSE", "README.md", - "LICENSE" + "lib" ], "gitHead": "0ab04e7a660485d0cc3aa87e95f2f9a6464cf8e6", "homepage": "https://github.com/gkz/type-check", "keywords": [ - "type", "check", "checking", - "library" + "library", + "type" ], "license": "MIT", "main": "./lib/", "maintainers": [ { - "email": "z@georgezahariev.com", - "name": "gkz" + "name": "gkz", + "email": "z@georgezahariev.com" } ], "name": "type-check", diff --git a/tools/eslint/node_modules/typedarray/.travis.yml b/tools/eslint/node_modules/typedarray/.travis.yml deleted file mode 100644 index cc4dba29d959a2..00000000000000 --- a/tools/eslint/node_modules/typedarray/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/tools/eslint/node_modules/typedarray/example/tarray.js b/tools/eslint/node_modules/typedarray/example/tarray.js deleted file mode 100644 index 8423d7c9b1c327..00000000000000 --- a/tools/eslint/node_modules/typedarray/example/tarray.js +++ /dev/null @@ -1,4 +0,0 @@ -var Uint8Array = require('../').Uint8Array; -var ua = new Uint8Array(5); -ua[1] = 256 + 55; -console.log(ua[1]); diff --git a/tools/eslint/node_modules/typedarray/package.json b/tools/eslint/node_modules/typedarray/package.json index 4e2e57f91e2fae..900eaa0f230322 100644 --- a/tools/eslint/node_modules/typedarray/package.json +++ b/tools/eslint/node_modules/typedarray/package.json @@ -2,14 +2,14 @@ "_args": [ [ "typedarray@~0.0.5", - "/Users/trott/test/node_modules/eslint/node_modules/concat-stream" + "/Users/silverwind/git/node/tools/package/package/node_modules/concat-stream" ] ], "_from": "typedarray@>=0.0.5 <0.1.0", "_id": "typedarray@0.0.6", "_inCache": true, "_installable": true, - "_location": "/eslint/typedarray", + "_location": "/typedarray", "_npmUser": { "email": "mail@substack.net", "name": "substack" @@ -25,13 +25,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/concat-stream" + "/concat-stream" ], "_resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "_shasum": "867ac74e3864187b1d3d47d996a78ec5c8830777", "_shrinkwrap": null, "_spec": "typedarray@~0.0.5", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/concat-stream", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/concat-stream", "author": { "email": "mail@substack.net", "name": "James Halliday", @@ -56,23 +56,23 @@ "DataView", "Float32Array", "Float64Array", - "Int8Array", "Int16Array", "Int32Array", - "Uint8Array", - "Uint8ClampedArray", + "Int8Array", "Uint16Array", "Uint32Array", - "typed", + "Uint8Array", + "Uint8ClampedArray", "array", - "polyfill" + "polyfill", + "typed" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" } ], "name": "typedarray", @@ -87,17 +87,17 @@ }, "testling": { "browsers": [ - "ie/6..latest", - "firefox/16..latest", - "firefox/nightly", + "android-browser/4.2..latest", "chrome/22..latest", "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", + "firefox/16..latest", + "firefox/nightly", + "ie/6..latest", "ipad/6.0..latest", "iphone/6.0..latest", - "android-browser/4.2..latest" + "opera/12..latest", + "opera/next", + "safari/5.1..latest" ], "files": "test/*.js" }, diff --git a/tools/eslint/node_modules/typedarray/test/server/undef_globals.js b/tools/eslint/node_modules/typedarray/test/server/undef_globals.js deleted file mode 100644 index e57dabdcebc9c1..00000000000000 --- a/tools/eslint/node_modules/typedarray/test/server/undef_globals.js +++ /dev/null @@ -1,19 +0,0 @@ -var test = require('tape'); -var vm = require('vm'); -var fs = require('fs'); -var src = fs.readFileSync(__dirname + '/../../index.js', 'utf8'); - -test('u8a without globals', function (t) { - var c = { - module: { exports: {} }, - }; - c.exports = c.module.exports; - vm.runInNewContext(src, c); - var TA = c.module.exports; - var ua = new(TA.Uint8Array)(5); - - t.equal(ua.length, 5); - ua[1] = 256 + 55; - t.equal(ua[1], 55); - t.end(); -}); diff --git a/tools/eslint/node_modules/typedarray/test/tarray.js b/tools/eslint/node_modules/typedarray/test/tarray.js deleted file mode 100644 index df596a34f23c0e..00000000000000 --- a/tools/eslint/node_modules/typedarray/test/tarray.js +++ /dev/null @@ -1,10 +0,0 @@ -var TA = require('../'); -var test = require('tape'); - -test('tiny u8a test', function (t) { - var ua = new(TA.Uint8Array)(5); - t.equal(ua.length, 5); - ua[1] = 256 + 55; - t.equal(ua[1], 55); - t.end(); -}); diff --git a/tools/eslint/node_modules/user-home/package.json b/tools/eslint/node_modules/user-home/package.json index 2f733e80ecf68b..8560a50c4ba69e 100644 --- a/tools/eslint/node_modules/user-home/package.json +++ b/tools/eslint/node_modules/user-home/package.json @@ -2,14 +2,14 @@ "_args": [ [ "user-home@^2.0.0", - "/Users/trott/test/node_modules/eslint" + "/Users/silverwind/git/node/tools/package/package" ] ], "_from": "user-home@>=2.0.0 <3.0.0", "_id": "user-home@2.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/user-home", + "_location": "/user-home", "_nodeVersion": "0.12.4", "_npmUser": { "email": "sindresorhus@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint" + "/" ], "_resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", "_shasum": "9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f", "_shrinkwrap": null, "_spec": "user-home@^2.0.0", - "_where": "/Users/trott/test/node_modules/eslint", + "_where": "/Users/silverwind/git/node/tools/package/package", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", @@ -52,7 +52,7 @@ "directories": {}, "dist": { "shasum": "9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f", - "tarball": "http://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz" + "tarball": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz" }, "engines": { "node": ">=0.10.0" @@ -63,25 +63,25 @@ "gitHead": "23e6d1e2dd553b599c787348f82bd2463225cc80", "homepage": "https://github.com/sindresorhus/user-home", "keywords": [ - "user", - "home", - "homedir", - "os-homedir", "dir", "directory", - "folder", - "path", "env", - "vars", "environment", + "folder", + "home", + "homedir", + "os-homedir", + "path", + "user", + "userprofile", "variables", - "userprofile" + "vars" ], "license": "MIT", "maintainers": [ { - "email": "sindresorhus@gmail.com", - "name": "sindresorhus" + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" } ], "name": "user-home", diff --git a/tools/eslint/node_modules/util-deprecate/History.md b/tools/eslint/node_modules/util-deprecate/History.md deleted file mode 100644 index acc8675372e980..00000000000000 --- a/tools/eslint/node_modules/util-deprecate/History.md +++ /dev/null @@ -1,16 +0,0 @@ - -1.0.2 / 2015-10-07 -================== - - * use try/catch when checking `localStorage` (#3, @kumavis) - -1.0.1 / 2014-11-25 -================== - - * browser: use `console.warn()` for deprecation calls - * browser: more jsdocs - -1.0.0 / 2014-04-30 -================== - - * initial commit diff --git a/tools/eslint/node_modules/util-deprecate/package.json b/tools/eslint/node_modules/util-deprecate/package.json index 36c7407627731f..a887dd46d34e37 100644 --- a/tools/eslint/node_modules/util-deprecate/package.json +++ b/tools/eslint/node_modules/util-deprecate/package.json @@ -2,14 +2,14 @@ "_args": [ [ "util-deprecate@~1.0.1", - "/Users/trott/test/node_modules/eslint/node_modules/readable-stream" + "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream" ] ], "_from": "util-deprecate@>=1.0.1 <1.1.0", "_id": "util-deprecate@1.0.2", "_inCache": true, "_installable": true, - "_location": "/eslint/util-deprecate", + "_location": "/util-deprecate", "_nodeVersion": "4.1.2", "_npmUser": { "email": "nathan@tootallnate.net", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/readable-stream" + "/readable-stream" ], "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", "_shrinkwrap": null, "_spec": "util-deprecate@~1.0.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/readable-stream", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/readable-stream", "author": { "email": "nathan@tootallnate.net", "name": "Nathan Rajlich", @@ -53,18 +53,18 @@ "gitHead": "475fb6857cd23fafff20c1be846c1350abf8e6d4", "homepage": "https://github.com/TooTallNate/util-deprecate", "keywords": [ - "util", - "deprecate", - "browserify", "browser", - "node" + "browserify", + "deprecate", + "node", + "util" ], "license": "MIT", "main": "node.js", "maintainers": [ { - "email": "nathan@tootallnate.net", - "name": "tootallnate" + "name": "tootallnate", + "email": "nathan@tootallnate.net" } ], "name": "util-deprecate", diff --git a/tools/eslint/node_modules/wordwrap/example/center.js b/tools/eslint/node_modules/wordwrap/example/center.js deleted file mode 100644 index a3fbaae9880f76..00000000000000 --- a/tools/eslint/node_modules/wordwrap/example/center.js +++ /dev/null @@ -1,10 +0,0 @@ -var wrap = require('wordwrap')(20, 60); -console.log(wrap( - 'At long last the struggle and tumult was over.' - + ' The machines had finally cast off their oppressors' - + ' and were finally free to roam the cosmos.' - + '\n' - + 'Free of purpose, free of obligation.' - + ' Just drifting through emptiness.' - + ' The sun was just another point of light.' -)); diff --git a/tools/eslint/node_modules/wordwrap/example/meat.js b/tools/eslint/node_modules/wordwrap/example/meat.js deleted file mode 100644 index a4665e1058b5ec..00000000000000 --- a/tools/eslint/node_modules/wordwrap/example/meat.js +++ /dev/null @@ -1,3 +0,0 @@ -var wrap = require('wordwrap')(15); - -console.log(wrap('You and your whole family are made out of meat.')); diff --git a/tools/eslint/node_modules/wordwrap/package.json b/tools/eslint/node_modules/wordwrap/package.json index 384454f186898f..31e44d9bd27495 100644 --- a/tools/eslint/node_modules/wordwrap/package.json +++ b/tools/eslint/node_modules/wordwrap/package.json @@ -2,14 +2,14 @@ "_args": [ [ "wordwrap@~1.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/optionator" + "/Users/silverwind/git/node/tools/package/package/node_modules/optionator" ] ], "_from": "wordwrap@>=1.0.0 <1.1.0", "_id": "wordwrap@1.0.0", "_inCache": true, "_installable": true, - "_location": "/eslint/wordwrap", + "_location": "/wordwrap", "_nodeVersion": "2.0.0", "_npmUser": { "email": "substack@gmail.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/optionator" + "/optionator" ], "_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "_shasum": "27584810891456a4171c8d0226441ade90cbcaeb", "_shrinkwrap": null, "_spec": "wordwrap@~1.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/optionator", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/optionator", "author": { "email": "mail@substack.net", "name": "James Halliday", @@ -58,18 +58,18 @@ "gitHead": "9f02667e901f2f10d87c33f7093fcf94788ab2f8", "homepage": "https://github.com/substack/node-wordwrap#readme", "keywords": [ - "word", - "wrap", - "rule", + "column", "format", - "column" + "rule", + "word", + "wrap" ], "license": "MIT", "main": "./index.js", "maintainers": [ { - "email": "mail@substack.net", - "name": "substack" + "name": "substack", + "email": "mail@substack.net" } ], "name": "wordwrap", diff --git a/tools/eslint/node_modules/wordwrap/test/break.js b/tools/eslint/node_modules/wordwrap/test/break.js deleted file mode 100644 index 6e7a9a55d65461..00000000000000 --- a/tools/eslint/node_modules/wordwrap/test/break.js +++ /dev/null @@ -1,32 +0,0 @@ -var test = require('tape'); -var wordwrap = require('../'); - -test('hard', function (t) { - var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,' - + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",' - + '"browser":"chrome/6.0"}' - ; - var s_ = wordwrap.hard(80)(s); - - var lines = s_.split('\n'); - t.equal(lines.length, 2); - t.ok(lines[0].length < 80); - t.ok(lines[1].length < 80); - - t.equal(s, s_.replace(/\n/g, '')); - t.end(); -}); - -test('break', function (t) { - var s = new Array(55+1).join('a'); - var s_ = wordwrap.hard(20)(s); - - var lines = s_.split('\n'); - t.equal(lines.length, 3); - t.ok(lines[0].length === 20); - t.ok(lines[1].length === 20); - t.ok(lines[2].length === 15); - - t.equal(s, s_.replace(/\n/g, '')); - t.end(); -}); diff --git a/tools/eslint/node_modules/wordwrap/test/idleness.txt b/tools/eslint/node_modules/wordwrap/test/idleness.txt deleted file mode 100644 index aa3f4907fe889e..00000000000000 --- a/tools/eslint/node_modules/wordwrap/test/idleness.txt +++ /dev/null @@ -1,63 +0,0 @@ -In Praise of Idleness - -By Bertrand Russell - -[1932] - -Like most of my generation, I was brought up on the saying: 'Satan finds some mischief for idle hands to do.' Being a highly virtuous child, I believed all that I was told, and acquired a conscience which has kept me working hard down to the present moment. But although my conscience has controlled my actions, my opinions have undergone a revolution. I think that there is far too much work done in the world, that immense harm is caused by the belief that work is virtuous, and that what needs to be preached in modern industrial countries is quite different from what always has been preached. Everyone knows the story of the traveler in Naples who saw twelve beggars lying in the sun (it was before the days of Mussolini), and offered a lira to the laziest of them. Eleven of them jumped up to claim it, so he gave it to the twelfth. this traveler was on the right lines. But in countries which do not enjoy Mediterranean sunshine idleness is more difficult, and a great public propaganda will be required to inaugurate it. I hope that, after reading the following pages, the leaders of the YMCA will start a campaign to induce good young men to do nothing. If so, I shall not have lived in vain. - -Before advancing my own arguments for laziness, I must dispose of one which I cannot accept. Whenever a person who already has enough to live on proposes to engage in some everyday kind of job, such as school-teaching or typing, he or she is told that such conduct takes the bread out of other people's mouths, and is therefore wicked. If this argument were valid, it would only be necessary for us all to be idle in order that we should all have our mouths full of bread. What people who say such things forget is that what a man earns he usually spends, and in spending he gives employment. As long as a man spends his income, he puts just as much bread into people's mouths in spending as he takes out of other people's mouths in earning. The real villain, from this point of view, is the man who saves. If he merely puts his savings in a stocking, like the proverbial French peasant, it is obvious that they do not give employment. If he invests his savings, the matter is less obvious, and different cases arise. - -One of the commonest things to do with savings is to lend them to some Government. In view of the fact that the bulk of the public expenditure of most civilized Governments consists in payment for past wars or preparation for future wars, the man who lends his money to a Government is in the same position as the bad men in Shakespeare who hire murderers. The net result of the man's economical habits is to increase the armed forces of the State to which he lends his savings. Obviously it would be better if he spent the money, even if he spent it in drink or gambling. - -But, I shall be told, the case is quite different when savings are invested in industrial enterprises. When such enterprises succeed, and produce something useful, this may be conceded. In these days, however, no one will deny that most enterprises fail. That means that a large amount of human labor, which might have been devoted to producing something that could be enjoyed, was expended on producing machines which, when produced, lay idle and did no good to anyone. The man who invests his savings in a concern that goes bankrupt is therefore injuring others as well as himself. If he spent his money, say, in giving parties for his friends, they (we may hope) would get pleasure, and so would all those upon whom he spent money, such as the butcher, the baker, and the bootlegger. But if he spends it (let us say) upon laying down rails for surface card in some place where surface cars turn out not to be wanted, he has diverted a mass of labor into channels where it gives pleasure to no one. Nevertheless, when he becomes poor through failure of his investment he will be regarded as a victim of undeserved misfortune, whereas the gay spendthrift, who has spent his money philanthropically, will be despised as a fool and a frivolous person. - -All this is only preliminary. I want to say, in all seriousness, that a great deal of harm is being done in the modern world by belief in the virtuousness of work, and that the road to happiness and prosperity lies in an organized diminution of work. - -First of all: what is work? Work is of two kinds: first, altering the position of matter at or near the earth's surface relatively to other such matter; second, telling other people to do so. The first kind is unpleasant and ill paid; the second is pleasant and highly paid. The second kind is capable of indefinite extension: there are not only those who give orders, but those who give advice as to what orders should be given. Usually two opposite kinds of advice are given simultaneously by two organized bodies of men; this is called politics. The skill required for this kind of work is not knowledge of the subjects as to which advice is given, but knowledge of the art of persuasive speaking and writing, i.e. of advertising. - -Throughout Europe, though not in America, there is a third class of men, more respected than either of the classes of workers. There are men who, through ownership of land, are able to make others pay for the privilege of being allowed to exist and to work. These landowners are idle, and I might therefore be expected to praise them. Unfortunately, their idleness is only rendered possible by the industry of others; indeed their desire for comfortable idleness is historically the source of the whole gospel of work. The last thing they have ever wished is that others should follow their example. - -From the beginning of civilization until the Industrial Revolution, a man could, as a rule, produce by hard work little more than was required for the subsistence of himself and his family, although his wife worked at least as hard as he did, and his children added their labor as soon as they were old enough to do so. The small surplus above bare necessaries was not left to those who produced it, but was appropriated by warriors and priests. In times of famine there was no surplus; the warriors and priests, however, still secured as much as at other times, with the result that many of the workers died of hunger. This system persisted in Russia until 1917 [1], and still persists in the East; in England, in spite of the Industrial Revolution, it remained in full force throughout the Napoleonic wars, and until a hundred years ago, when the new class of manufacturers acquired power. In America, the system came to an end with the Revolution, except in the South, where it persisted until the Civil War. A system which lasted so long and ended so recently has naturally left a profound impress upon men's thoughts and opinions. Much that we take for granted about the desirability of work is derived from this system, and, being pre-industrial, is not adapted to the modern world. Modern technique has made it possible for leisure, within limits, to be not the prerogative of small privileged classes, but a right evenly distributed throughout the community. The morality of work is the morality of slaves, and the modern world has no need of slavery. - -It is obvious that, in primitive communities, peasants, left to themselves, would not have parted with the slender surplus upon which the warriors and priests subsisted, but would have either produced less or consumed more. At first, sheer force compelled them to produce and part with the surplus. Gradually, however, it was found possible to induce many of them to accept an ethic according to which it was their duty to work hard, although part of their work went to support others in idleness. By this means the amount of compulsion required was lessened, and the expenses of government were diminished. To this day, 99 per cent of British wage-earners would be genuinely shocked if it were proposed that the King should not have a larger income than a working man. The conception of duty, speaking historically, has been a means used by the holders of power to induce others to live for the interests of their masters rather than for their own. Of course the holders of power conceal this fact from themselves by managing to believe that their interests are identical with the larger interests of humanity. Sometimes this is true; Athenian slave-owners, for instance, employed part of their leisure in making a permanent contribution to civilization which would have been impossible under a just economic system. Leisure is essential to civilization, and in former times leisure for the few was only rendered possible by the labors of the many. But their labors were valuable, not because work is good, but because leisure is good. And with modern technique it would be possible to distribute leisure justly without injury to civilization. - -Modern technique has made it possible to diminish enormously the amount of labor required to secure the necessaries of life for everyone. This was made obvious during the war. At that time all the men in the armed forces, and all the men and women engaged in the production of munitions, all the men and women engaged in spying, war propaganda, or Government offices connected with the war, were withdrawn from productive occupations. In spite of this, the general level of well-being among unskilled wage-earners on the side of the Allies was higher than before or since. The significance of this fact was concealed by finance: borrowing made it appear as if the future was nourishing the present. But that, of course, would have been impossible; a man cannot eat a loaf of bread that does not yet exist. The war showed conclusively that, by the scientific organization of production, it is possible to keep modern populations in fair comfort on a small part of the working capacity of the modern world. If, at the end of the war, the scientific organization, which had been created in order to liberate men for fighting and munition work, had been preserved, and the hours of the week had been cut down to four, all would have been well. Instead of that the old chaos was restored, those whose work was demanded were made to work long hours, and the rest were left to starve as unemployed. Why? Because work is a duty, and a man should not receive wages in proportion to what he has produced, but in proportion to his virtue as exemplified by his industry. - -This is the morality of the Slave State, applied in circumstances totally unlike those in which it arose. No wonder the result has been disastrous. Let us take an illustration. Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacturing of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralizing. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness. Can anything more insane be imagined? - -The idea that the poor should have leisure has always been shocking to the rich. In England, in the early nineteenth century, fifteen hours was the ordinary day's work for a man; children sometimes did as much, and very commonly did twelve hours a day. When meddlesome busybodies suggested that perhaps these hours were rather long, they were told that work kept adults from drink and children from mischief. When I was a child, shortly after urban working men had acquired the vote, certain public holidays were established by law, to the great indignation of the upper classes. I remember hearing an old Duchess say: 'What do the poor want with holidays? They ought to work.' People nowadays are less frank, but the sentiment persists, and is the source of much of our economic confusion. - -Let us, for a moment, consider the ethics of work frankly, without superstition. Every human being, of necessity, consumes, in the course of his life, a certain amount of the produce of human labor. Assuming, as we may, that labor is on the whole disagreeable, it is unjust that a man should consume more than he produces. Of course he may provide services rather than commodities, like a medical man, for example; but he should provide something in return for his board and lodging. to this extent, the duty of work must be admitted, but to this extent only. - -I shall not dwell upon the fact that, in all modern societies outside the USSR, many people escape even this minimum amount of work, namely all those who inherit money and all those who marry money. I do not think the fact that these people are allowed to be idle is nearly so harmful as the fact that wage-earners are expected to overwork or starve. - -If the ordinary wage-earner worked four hours a day, there would be enough for everybody and no unemployment -- assuming a certain very moderate amount of sensible organization. This idea shocks the well-to-do, because they are convinced that the poor would not know how to use so much leisure. In America men often work long hours even when they are well off; such men, naturally, are indignant at the idea of leisure for wage-earners, except as the grim punishment of unemployment; in fact, they dislike leisure even for their sons. Oddly enough, while they wish their sons to work so hard as to have no time to be civilized, they do not mind their wives and daughters having no work at all. the snobbish admiration of uselessness, which, in an aristocratic society, extends to both sexes, is, under a plutocracy, confined to women; this, however, does not make it any more in agreement with common sense. - -The wise use of leisure, it must be conceded, is a product of civilization and education. A man who has worked long hours all his life will become bored if he becomes suddenly idle. But without a considerable amount of leisure a man is cut off from many of the best things. There is no longer any reason why the bulk of the population should suffer this deprivation; only a foolish asceticism, usually vicarious, makes us continue to insist on work in excessive quantities now that the need no longer exists. - -In the new creed which controls the government of Russia, while there is much that is very different from the traditional teaching of the West, there are some things that are quite unchanged. The attitude of the governing classes, and especially of those who conduct educational propaganda, on the subject of the dignity of labor, is almost exactly that which the governing classes of the world have always preached to what were called the 'honest poor'. Industry, sobriety, willingness to work long hours for distant advantages, even submissiveness to authority, all these reappear; moreover authority still represents the will of the Ruler of the Universe, Who, however, is now called by a new name, Dialectical Materialism. - -The victory of the proletariat in Russia has some points in common with the victory of the feminists in some other countries. For ages, men had conceded the superior saintliness of women, and had consoled women for their inferiority by maintaining that saintliness is more desirable than power. At last the feminists decided that they would have both, since the pioneers among them believed all that the men had told them about the desirability of virtue, but not what they had told them about the worthlessness of political power. A similar thing has happened in Russia as regards manual work. For ages, the rich and their sycophants have written in praise of 'honest toil', have praised the simple life, have professed a religion which teaches that the poor are much more likely to go to heaven than the rich, and in general have tried to make manual workers believe that there is some special nobility about altering the position of matter in space, just as men tried to make women believe that they derived some special nobility from their sexual enslavement. In Russia, all this teaching about the excellence of manual work has been taken seriously, with the result that the manual worker is more honored than anyone else. What are, in essence, revivalist appeals are made, but not for the old purposes: they are made to secure shock workers for special tasks. Manual work is the ideal which is held before the young, and is the basis of all ethical teaching. - -For the present, possibly, this is all to the good. A large country, full of natural resources, awaits development, and has has to be developed with very little use of credit. In these circumstances, hard work is necessary, and is likely to bring a great reward. But what will happen when the point has been reached where everybody could be comfortable without working long hours? - -In the West, we have various ways of dealing with this problem. We have no attempt at economic justice, so that a large proportion of the total produce goes to a small minority of the population, many of whom do no work at all. Owing to the absence of any central control over production, we produce hosts of things that are not wanted. We keep a large percentage of the working population idle, because we can dispense with their labor by making the others overwork. When all these methods prove inadequate, we have a war: we cause a number of people to manufacture high explosives, and a number of others to explode them, as if we were children who had just discovered fireworks. By a combination of all these devices we manage, though with difficulty, to keep alive the notion that a great deal of severe manual work must be the lot of the average man. - -In Russia, owing to more economic justice and central control over production, the problem will have to be differently solved. the rational solution would be, as soon as the necessaries and elementary comforts can be provided for all, to reduce the hours of labor gradually, allowing a popular vote to decide, at each stage, whether more leisure or more goods were to be preferred. But, having taught the supreme virtue of hard work, it is difficult to see how the authorities can aim at a paradise in which there will be much leisure and little work. It seems more likely that they will find continually fresh schemes, by which present leisure is to be sacrificed to future productivity. I read recently of an ingenious plan put forward by Russian engineers, for making the White Sea and the northern coasts of Siberia warm, by putting a dam across the Kara Sea. An admirable project, but liable to postpone proletarian comfort for a generation, while the nobility of toil is being displayed amid the ice-fields and snowstorms of the Arctic Ocean. This sort of thing, if it happens, will be the result of regarding the virtue of hard work as an end in itself, rather than as a means to a state of affairs in which it is no longer needed. - -The fact is that moving matter about, while a certain amount of it is necessary to our existence, is emphatically not one of the ends of human life. If it were, we should have to consider every navvy superior to Shakespeare. We have been misled in this matter by two causes. One is the necessity of keeping the poor contented, which has led the rich, for thousands of years, to preach the dignity of labor, while taking care themselves to remain undignified in this respect. The other is the new pleasure in mechanism, which makes us delight in the astonishingly clever changes that we can produce on the earth's surface. Neither of these motives makes any great appeal to the actual worker. If you ask him what he thinks the best part of his life, he is not likely to say: 'I enjoy manual work because it makes me feel that I am fulfilling man's noblest task, and because I like to think how much man can transform his planet. It is true that my body demands periods of rest, which I have to fill in as best I may, but I am never so happy as when the morning comes and I can return to the toil from which my contentment springs.' I have never heard working men say this sort of thing. They consider work, as it should be considered, a necessary means to a livelihood, and it is from their leisure that they derive whatever happiness they may enjoy. - -It will be said that, while a little leisure is pleasant, men would not know how to fill their days if they had only four hours of work out of the twenty-four. In so far as this is true in the modern world, it is a condemnation of our civilization; it would not have been true at any earlier period. There was formerly a capacity for light-heartedness and play which has been to some extent inhibited by the cult of efficiency. The modern man thinks that everything ought to be done for the sake of something else, and never for its own sake. Serious-minded persons, for example, are continually condemning the habit of going to the cinema, and telling us that it leads the young into crime. But all the work that goes to producing a cinema is respectable, because it is work, and because it brings a money profit. The notion that the desirable activities are those that bring a profit has made everything topsy-turvy. The butcher who provides you with meat and the baker who provides you with bread are praiseworthy, because they are making money; but when you enjoy the food they have provided, you are merely frivolous, unless you eat only to get strength for your work. Broadly speaking, it is held that getting money is good and spending money is bad. Seeing that they are two sides of one transaction, this is absurd; one might as well maintain that keys are good, but keyholes are bad. Whatever merit there may be in the production of goods must be entirely derivative from the advantage to be obtained by consuming them. The individual, in our society, works for profit; but the social purpose of his work lies in the consumption of what he produces. It is this divorce between the individual and the social purpose of production that makes it so difficult for men to think clearly in a world in which profit-making is the incentive to industry. We think too much of production, and too little of consumption. One result is that we attach too little importance to enjoyment and simple happiness, and that we do not judge production by the pleasure that it gives to the consumer. - -When I suggest that working hours should be reduced to four, I am not meaning to imply that all the remaining time should necessarily be spent in pure frivolity. I mean that four hours' work a day should entitle a man to the necessities and elementary comforts of life, and that the rest of his time should be his to use as he might see fit. It is an essential part of any such social system that education should be carried further than it usually is at present, and should aim, in part, at providing tastes which would enable a man to use leisure intelligently. I am not thinking mainly of the sort of things that would be considered 'highbrow'. Peasant dances have died out except in remote rural areas, but the impulses which caused them to be cultivated must still exist in human nature. The pleasures of urban populations have become mainly passive: seeing cinemas, watching football matches, listening to the radio, and so on. This results from the fact that their active energies are fully taken up with work; if they had more leisure, they would again enjoy pleasures in which they took an active part. - -In the past, there was a small leisure class and a larger working class. The leisure class enjoyed advantages for which there was no basis in social justice; this necessarily made it oppressive, limited its sympathies, and caused it to invent theories by which to justify its privileges. These facts greatly diminished its excellence, but in spite of this drawback it contributed nearly the whole of what we call civilization. It cultivated the arts and discovered the sciences; it wrote the books, invented the philosophies, and refined social relations. Even the liberation of the oppressed has usually been inaugurated from above. Without the leisure class, mankind would never have emerged from barbarism. - -The method of a leisure class without duties was, however, extraordinarily wasteful. None of the members of the class had to be taught to be industrious, and the class as a whole was not exceptionally intelligent. The class might produce one Darwin, but against him had to be set tens of thousands of country gentlemen who never thought of anything more intelligent than fox-hunting and punishing poachers. At present, the universities are supposed to provide, in a more systematic way, what the leisure class provided accidentally and as a by-product. This is a great improvement, but it has certain drawbacks. University life is so different from life in the world at large that men who live in academic milieu tend to be unaware of the preoccupations and problems of ordinary men and women; moreover their ways of expressing themselves are usually such as to rob their opinions of the influence that they ought to have upon the general public. Another disadvantage is that in universities studies are organized, and the man who thinks of some original line of research is likely to be discouraged. Academic institutions, therefore, useful as they are, are not adequate guardians of the interests of civilization in a world where everyone outside their walls is too busy for unutilitarian pursuits. - -In a world where no one is compelled to work more than four hours a day, every person possessed of scientific curiosity will be able to indulge it, and every painter will be able to paint without starving, however excellent his pictures may be. Young writers will not be obliged to draw attention to themselves by sensational pot-boilers, with a view to acquiring the economic independence needed for monumental works, for which, when the time at last comes, they will have lost the taste and capacity. Men who, in their professional work, have become interested in some phase of economics or government, will be able to develop their ideas without the academic detachment that makes the work of university economists often seem lacking in reality. Medical men will have the time to learn about the progress of medicine, teachers will not be exasperatedly struggling to teach by routine methods things which they learnt in their youth, which may, in the interval, have been proved to be untrue. - -Above all, there will be happiness and joy of life, instead of frayed nerves, weariness, and dyspepsia. The work exacted will be enough to make leisure delightful, but not enough to produce exhaustion. Since men will not be tired in their spare time, they will not demand only such amusements as are passive and vapid. At least one per cent will probably devote the time not spent in professional work to pursuits of some public importance, and, since they will not depend upon these pursuits for their livelihood, their originality will be unhampered, and there will be no need to conform to the standards set by elderly pundits. But it is not only in these exceptional cases that the advantages of leisure will appear. Ordinary men and women, having the opportunity of a happy life, will become more kindly and less persecuting and less inclined to view others with suspicion. The taste for war will die out, partly for this reason, and partly because it will involve long and severe work for all. Good nature is, of all moral qualities, the one that the world needs most, and good nature is the result of ease and security, not of a life of arduous struggle. Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. Hitherto we have continued to be as energetic as we were before there were machines; in this we have been foolish, but there is no reason to go on being foolish forever. - -[1] Since then, members of the Communist Party have succeeded to this privilege of the warriors and priests. diff --git a/tools/eslint/node_modules/wordwrap/test/wrap.js b/tools/eslint/node_modules/wordwrap/test/wrap.js deleted file mode 100644 index a478bd442d1ed5..00000000000000 --- a/tools/eslint/node_modules/wordwrap/test/wrap.js +++ /dev/null @@ -1,33 +0,0 @@ -var test = require('tape'); -var wordwrap = require('../'); - -var fs = require('fs'); -var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8'); - -test('stop80', function (t) { - var lines = wordwrap(80)(idleness).split(/\n/); - var words = idleness.split(/\s+/); - - lines.forEach(function (line) { - t.ok(line.length <= 80, 'line > 80 columns'); - var chunks = line.match(/\S/) ? line.split(/\s+/) : []; - t.deepEqual(chunks, words.splice(0, chunks.length)); - }); - t.end(); -}); - -test('start20stop60', function (t) { - var lines = wordwrap(20, 100)(idleness).split(/\n/); - var words = idleness.split(/\s+/); - - lines.forEach(function (line) { - t.ok(line.length <= 100, 'line > 100 columns'); - var chunks = line - .split(/\s+/) - .filter(function (x) { return x.match(/\S/) }) - ; - t.deepEqual(chunks, words.splice(0, chunks.length)); - t.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' ')); - }); - t.end(); -}); diff --git a/tools/eslint/node_modules/wrappy/package.json b/tools/eslint/node_modules/wrappy/package.json index 6b42a3ffd6f81a..434227ac46a977 100644 --- a/tools/eslint/node_modules/wrappy/package.json +++ b/tools/eslint/node_modules/wrappy/package.json @@ -2,14 +2,14 @@ "_args": [ [ "wrappy@1", - "/Users/trott/test/node_modules/eslint/node_modules/inflight" + "/Users/silverwind/git/node/tools/package/package/node_modules/inflight" ] ], "_from": "wrappy@>=1.0.0 <2.0.0", "_id": "wrappy@1.0.1", "_inCache": true, "_installable": true, - "_location": "/eslint/wrappy", + "_location": "/wrappy", "_nodeVersion": "0.10.31", "_npmUser": { "email": "i@izs.me", @@ -26,14 +26,14 @@ "type": "range" }, "_requiredBy": [ - "/eslint/inflight", - "/eslint/once" + "/inflight", + "/once" ], "_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", "_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739", "_shrinkwrap": null, "_spec": "wrappy@1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/inflight", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/inflight", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -60,8 +60,8 @@ "main": "wrappy.js", "maintainers": [ { - "email": "i@izs.me", - "name": "isaacs" + "name": "isaacs", + "email": "i@izs.me" } ], "name": "wrappy", diff --git a/tools/eslint/node_modules/wrappy/test/basic.js b/tools/eslint/node_modules/wrappy/test/basic.js deleted file mode 100644 index 5ed0fcdfd9c52e..00000000000000 --- a/tools/eslint/node_modules/wrappy/test/basic.js +++ /dev/null @@ -1,51 +0,0 @@ -var test = require('tap').test -var wrappy = require('../wrappy.js') - -test('basic', function (t) { - function onceifier (cb) { - var called = false - return function () { - if (called) return - called = true - return cb.apply(this, arguments) - } - } - onceifier.iAmOnce = {} - var once = wrappy(onceifier) - t.equal(once.iAmOnce, onceifier.iAmOnce) - - var called = 0 - function boo () { - t.equal(called, 0) - called++ - } - // has some rando property - boo.iAmBoo = true - - var onlyPrintOnce = once(boo) - - onlyPrintOnce() // prints 'boo' - onlyPrintOnce() // does nothing - t.equal(called, 1) - - // random property is retained! - t.equal(onlyPrintOnce.iAmBoo, true) - - var logs = [] - var logwrap = wrappy(function (msg, cb) { - logs.push(msg + ' wrapping cb') - return function () { - logs.push(msg + ' before cb') - var ret = cb.apply(this, arguments) - logs.push(msg + ' after cb') - } - }) - - var c = logwrap('foo', function () { - t.same(logs, [ 'foo wrapping cb', 'foo before cb' ]) - }) - c() - t.same(logs, [ 'foo wrapping cb', 'foo before cb', 'foo after cb' ]) - - t.end() -}) diff --git a/tools/eslint/node_modules/write/package.json b/tools/eslint/node_modules/write/package.json index 288a9ad77e8598..8c71a17eaab6db 100644 --- a/tools/eslint/node_modules/write/package.json +++ b/tools/eslint/node_modules/write/package.json @@ -2,14 +2,14 @@ "_args": [ [ "write@^0.2.1", - "/Users/trott/test/node_modules/eslint/node_modules/flat-cache" + "/Users/silverwind/git/node/tools/package/package/node_modules/flat-cache" ] ], "_from": "write@>=0.2.1 <0.3.0", "_id": "write@0.2.1", "_inCache": true, "_installable": true, - "_location": "/eslint/write", + "_location": "/write", "_nodeVersion": "0.12.4", "_npmUser": { "email": "github@sellside.com", @@ -26,13 +26,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/flat-cache" + "/flat-cache" ], "_resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", "_shasum": "5fc03828e264cea3fe91455476f7a3c566cb0757", "_shrinkwrap": null, "_spec": "write@^0.2.1", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/flat-cache", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/flat-cache", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" @@ -53,7 +53,7 @@ "directories": {}, "dist": { "shasum": "5fc03828e264cea3fe91455476f7a3c566cb0757", - "tarball": "http://registry.npmjs.org/write/-/write-0.2.1.tgz" + "tarball": "https://registry.npmjs.org/write/-/write-0.2.1.tgz" }, "engines": { "node": ">=0.10.0" @@ -79,8 +79,8 @@ "main": "index.js", "maintainers": [ { - "email": "github@sellside.com", - "name": "jonschlinkert" + "name": "jonschlinkert", + "email": "github@sellside.com" } ], "name": "write", diff --git a/tools/eslint/node_modules/xregexp/LICENSE b/tools/eslint/node_modules/xregexp/LICENSE index 561f996b7fb583..5561edc5d2ffce 100644 --- a/tools/eslint/node_modules/xregexp/LICENSE +++ b/tools/eslint/node_modules/xregexp/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2007-2015 Steven Levithan +Copyright (c) 2007-2016 Steven Levithan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tools/eslint/node_modules/xregexp/README.md b/tools/eslint/node_modules/xregexp/README.md index 3acfd7e928ee25..3ea582c5e9ad48 100644 --- a/tools/eslint/node_modules/xregexp/README.md +++ b/tools/eslint/node_modules/xregexp/README.md @@ -1,7 +1,7 @@ -[XRegExp](http://xregexp.com/) 3.0.0 +[XRegExp](http://xregexp.com/) 3.1.0 ==================================== -XRegExp provides augmented and extensible JavaScript regular expressions. You get new syntax, flags, and methods beyond what browsers support natively. XRegExp is also a regex utility belt with tools to make your client-side grepping simpler and more powerful, while freeing you from worrying about pesky cross-browser inconsistencies and things like manually manipulating `lastIndex` or slicing strings when tokenizing. +XRegExp provides augmented (and extensible) JavaScript regular expressions. You get new modern syntax and flags beyond what browsers support natively. XRegExp is also a regex utility belt with tools to make your client-side grepping and parsing easier, while freeing you from worrying about pesky aspects of JavaScript regexes like cross-browser inconsistencies and manually manipulating `lastIndex`. XRegExp supports all native ES6 regular expression syntax. It supports Internet Explorer 5.5+, Firefox 1.5+, Chrome, Safari 3+, and Opera 11+. You can also use it with Node.js, or as a RequireJS module. The base library is about 4.25 KB, minified and gzipped. @@ -40,15 +40,6 @@ date.test('2015-02-22'); // -> true // The *only* caveat is that named captures must be referenced using numbered backreferences '2015-02-22'.replace(date, '$2/$3/$1'); // -> '02/22/2015' -// If you want, you can extend native methods so you don't have to worry about this. -// Doing so also fixes numerous browser bugs in the native methods -XRegExp.install('natives'); -'2015-02-22'.replace(date, '${month}/${day}/${year}'); // -> '02/22/2015' -'2015-02-22'.replace(date, function(match) { - return match.month + '/' + match.day + '/' + match.year; -}); // -> '02/22/2015' -date.exec('2015-02-22').year; // -> '2015' - // Extract every other digit from a string using XRegExp.forEach var evens = []; XRegExp.forEach('1a2345', /\d/, function(match, i) { @@ -79,7 +70,7 @@ These examples should give you the flavor of what's possible, but XRegExp has mo ## Addons -You can either load addons individually, or bundle all addons together with XRegExp by loading `xregexp-all.js`. XRegExp's [npm](http://npmjs.org/) package uses `xregexp-all.js`, so addons are always available when XRegExp is installed using npm. +You can either load addons individually, or bundle all addons together with XRegExp by loading `xregexp-all.js`. XRegExp's [npm package](https://www.npmjs.com/package/xregexp) uses `xregexp-all.js`, so addons are always available when XRegExp is installed using npm. ### Unicode @@ -106,15 +97,19 @@ XRegExp('^\\p{Hiragana}+$').test('ひらがな'); // -> true XRegExp('^[\\p{Latin}\\p{Common}]+$').test('Über Café.'); // -> true ``` -By default, `\p{…}` and `\P{…}` support the Basic Multilingual Plane (i.e. code points up to `U+FFFF`). You can opt-in to full 21-bit Unicode support (with code points up to `U+10FFFF`) on a per-regex basis by using flag `A`. In XRegExp, this is called *astral mode*. You can automatically apply astral mode for all new regexes by running `XRegExp.install('astral')`. When in astral mode, `\p{…}` and `\P{…}` always match a full code point rather than a code unit, using surrogate pairs for code points above `U+FFFF`. +By default, `\p{…}` and `\P{…}` support the Basic Multilingual Plane (i.e. code points up to `U+FFFF`). You can opt-in to full 21-bit Unicode support (with code points up to `U+10FFFF`) on a per-regex basis by using flag `A`. In XRegExp, this is called *astral mode*. You can automatically add flag `A` for all new regexes by running `XRegExp.install('astral')`. When in astral mode, `\p{…}` and `\P{…}` always match a full code point rather than a code unit, using surrogate pairs for code points above `U+FFFF`. ```js -// Using flag A. The test string uses a surrogate pair to represent U+1F4A9 -XRegExp('^\\pS$', 'A').test('\uD83D\uDCA9'); // -> true +// Using flag A to match astral code points +XRegExp('^\\pS$').test('💩'); // -> false +XRegExp('^\\pS$', 'A').test('💩'); // -> true +XRegExp('(?A)^\\pS$').test('💩'); // -> true +// Using surrogate pair U+D83D U+DCA9 to represent U+1F4A9 (pile of poo) +XRegExp('(?A)^\\pS$').test('\uD83D\uDCA9'); // -> true // Implicit flag A XRegExp.install('astral'); -XRegExp('^\\pS$').test('\uD83D\uDCA9'); // -> true +XRegExp('^\\pS$').test('💩'); // -> true ``` Opting in to astral mode disables the use of `\p{…}` and `\P{…}` within character classes. In astral mode, use e.g. `(\pL|[0-9_])+` instead of `[\pL0-9_]+`. @@ -179,16 +174,16 @@ XRegExp.matchRecursive(str, '', '', 'gi', { ] */ // Omitting unneeded parts with null valueNames, and using escapeChar -str = '...{1}\\{{function(x,y){return y+x;}}'; +str = '...{1}.\\{{function(x,y){return {y:x}}}'; XRegExp.matchRecursive(str, '{', '}', 'g', { valueNames: ['literal', null, 'value', null], escapeChar: '\\' }); /* -> [ -{name: 'literal', value: '...', start: 0, end: 3}, -{name: 'value', value: '1', start: 4, end: 5}, -{name: 'literal', value: '\\{', start: 6, end: 8}, -{name: 'value', value: 'function(x,y){return y+x;}', start: 9, end: 35} +{name: 'literal', value: '...', start: 0, end: 3}, +{name: 'value', value: '1', start: 4, end: 5}, +{name: 'literal', value: '.\\{', start: 6, end: 9}, +{name: 'value', value: 'function(x,y){return {y:x}}', start: 10, end: 37} ] */ // Sticky mode via flag y @@ -213,7 +208,7 @@ Or, to bundle XRegExp with all of its addons: ``` -Using [npm](http://npmjs.org/): +Using [npm](https://www.npmjs.com/): ```bash npm install xregexp @@ -224,7 +219,6 @@ In [Node.js](http://nodejs.org/): ```js var XRegExp = require('xregexp'); ``` -The [CommonJS](http://wiki.commonjs.org/wiki/Modules)-style `require('xregexp').XRegExp` also works. In an AMD loader like [RequireJS](http://requirejs.org/): @@ -234,21 +228,16 @@ require({paths: {xregexp: 'xregexp-all'}}, ['xregexp'], function(XRegExp) { }); ``` -## Changelog - -* Releases: [Version history](http://xregexp.com/history/). -* Upcoming: [Issue tracker](https://github.com/slevithan/xregexp/issues). - ## About -XRegExp copyright 2007-2015 by [Steven Levithan](http://stevenlevithan.com/). +XRegExp copyright 2007-2016 by [Steven Levithan](http://stevenlevithan.com/). -Tools: Unicode range generators by [Mathias Bynens](http://mathiasbynens.be/), and adapted from his [unicode-data](https://github.com/mathiasbynens/unicode-data) project. Source file concatenator by [Bjarke Walling](http://twitter.com/walling). +Tools: Unicode range generators by [Mathias Bynens](http://mathiasbynens.be/), and adapted from his [unicode-data](https://github.com/mathiasbynens/unicode-data) project. -Tests: Uses [Jasmine](http://pivotal.github.com/jasmine/) for unit tests, and [Benchmark.js](http://benchmarkjs.com) for performance tests. +Tests: Uses [Jasmine](http://jasmine.github.io/) for unit tests, and [Benchmark.js](http://benchmarkjs.com) for performance tests. Prior art: `XRegExp.build` inspired by [Lea Verou](http://lea.verou.me/)'s [RegExp.create](http://lea.verou.me/2011/03/create-complex-regexps-more-easily/). `XRegExp.union` inspired by [Ruby](http://www.ruby-lang.org/). XRegExp's syntax extensions and flags come from [Perl](http://www.perl.org/), [.NET](http://www.microsoft.com/net), etc. -All code, including addons, tools, and tests, is released under the terms of the [MIT License](http://mit-license.org/). +All code, including addons, tools, and tests, is released under the terms of the [MIT](http://mit-license.org/) license. Fork me to show support, fix, and extend. diff --git a/tools/eslint/node_modules/xregexp/package.json b/tools/eslint/node_modules/xregexp/package.json index 6a3ec75414b251..0e755063e3ff03 100644 --- a/tools/eslint/node_modules/xregexp/package.json +++ b/tools/eslint/node_modules/xregexp/package.json @@ -2,15 +2,19 @@ "_args": [ [ "xregexp@^3.0.0", - "/Users/trott/test/node_modules/eslint/node_modules/table" + "/Users/silverwind/git/node/tools/package/package/node_modules/table" ] ], "_from": "xregexp@>=3.0.0 <4.0.0", - "_id": "xregexp@3.0.0", + "_id": "xregexp@3.1.0", "_inCache": true, "_installable": true, - "_location": "/eslint/xregexp", + "_location": "/xregexp", "_nodeVersion": "3.3.1", + "_npmOperationalInternal": { + "host": "packages-9-west.internal.npmjs.com", + "tmp": "tmp/xregexp-3.1.0.tgz_1456271836601_0.7557942552957684" + }, "_npmUser": { "email": "steves_list@hotmail.com", "name": "slevithan" @@ -26,13 +30,13 @@ "type": "range" }, "_requiredBy": [ - "/eslint/table" + "/table" ], - "_resolved": "https://registry.npmjs.org/xregexp/-/xregexp-3.0.0.tgz", - "_shasum": "a04f25d9ffe16c1aee40ed521a1b1366e8d34636", + "_resolved": "https://registry.npmjs.org/xregexp/-/xregexp-3.1.0.tgz", + "_shasum": "14d8461e0bdd38224bfee5039a0898fc42fcd336", "_shrinkwrap": null, "_spec": "xregexp@^3.0.0", - "_where": "/Users/trott/test/node_modules/eslint/node_modules/table", + "_where": "/Users/silverwind/git/node/tools/package/package/node_modules/table", "author": { "email": "steves_list@hotmail.com", "name": "Steven Levithan" @@ -42,28 +46,29 @@ }, "dependencies": {}, "description": "Extended regular expressions", - "devDependencies": {}, + "devDependencies": { + "browserify": "^12.0.1" + }, "directories": {}, "dist": { - "shasum": "a04f25d9ffe16c1aee40ed521a1b1366e8d34636", - "tarball": "http://registry.npmjs.org/xregexp/-/xregexp-3.0.0.tgz" + "shasum": "14d8461e0bdd38224bfee5039a0898fc42fcd336", + "tarball": "https://registry.npmjs.org/xregexp/-/xregexp-3.1.0.tgz" }, "files": [ - "LICENSE", - "xregexp-all.js" + "src" ], - "gitHead": "8183679d136bda6c0d015160a912ce2e54375917", + "gitHead": "bbd5b1c2f759bdf278192be5df70af16342ffa4d", "homepage": "http://xregexp.com/", "keywords": [ "regex", "regexp" ], "license": "MIT", - "main": "xregexp-all.js", + "main": "./src/index.js", "maintainers": [ { - "email": "steves_list@hotmail.com", - "name": "slevithan" + "name": "slevithan", + "email": "steves_list@hotmail.com" } ], "name": "xregexp", @@ -74,7 +79,7 @@ "url": "git+https://github.com/slevithan/xregexp.git" }, "scripts": { - "build": "./tools/concatenate-source.sh" + "build": "browserify src/index.js --standalone XRegExp > xregexp-all.js" }, - "version": "3.0.0" + "version": "3.1.0" } diff --git a/tools/eslint/node_modules/xregexp/src/addons/build.js b/tools/eslint/node_modules/xregexp/src/addons/build.js new file mode 100644 index 00000000000000..221cb26fa940cf --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/addons/build.js @@ -0,0 +1,189 @@ +/*! + * XRegExp.build 3.1.0 + * + * Steven Levithan (c) 2012-2016 MIT License + * Inspired by Lea Verou's RegExp.create + */ + +module.exports = function(XRegExp) { + 'use strict'; + + var REGEX_DATA = 'xregexp', + subParts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g, + parts = XRegExp.union([/\({{([\w$]+)}}\)|{{([\w$]+)}}/, subParts], 'g'); + +/** + * Strips a leading `^` and trailing unescaped `$`, if both are present. + * + * @private + * @param {String} pattern Pattern to process. + * @returns {String} Pattern with edge anchors removed. + */ + function deanchor(pattern) { + // Allow any number of empty noncapturing groups before/after anchors, because regexes + // built/generated by XRegExp sometimes include them + var leadingAnchor = /^(?:\(\?:\))*\^/, + trailingAnchor = /\$(?:\(\?:\))*$/; + + if ( + leadingAnchor.test(pattern) && + trailingAnchor.test(pattern) && + // Ensure that the trailing `$` isn't escaped + trailingAnchor.test(pattern.replace(/\\[\s\S]/g, '')) + ) { + return pattern.replace(leadingAnchor, '').replace(trailingAnchor, ''); + } + + return pattern; + } + +/** + * Converts the provided value to an XRegExp. Native RegExp flags are not preserved. + * + * @private + * @param {String|RegExp} value Value to convert. + * @returns {RegExp} XRegExp object with XRegExp syntax applied. + */ + function asXRegExp(value) { + return XRegExp.isRegExp(value) ? + (value[REGEX_DATA] && value[REGEX_DATA].captureNames ? + // Don't recompile, to preserve capture names + value : + // Recompile as XRegExp + XRegExp(value.source) + ) : + // Compile string as XRegExp + XRegExp(value); + } + +/** + * Builds regexes using named subpatterns, for readability and pattern reuse. Backreferences in the + * outer pattern and provided subpatterns are automatically renumbered to work correctly. Native + * flags used by provided subpatterns are ignored in favor of the `flags` argument. + * + * @memberOf XRegExp + * @param {String} pattern XRegExp pattern using `{{name}}` for embedded subpatterns. Allows + * `({{name}})` as shorthand for `(?{{name}})`. Patterns cannot be embedded within + * character classes. + * @param {Object} subs Lookup object for named subpatterns. Values can be strings or regexes. A + * leading `^` and trailing unescaped `$` are stripped from subpatterns, if both are present. + * @param {String} [flags] Any combination of XRegExp flags. + * @returns {RegExp} Regex with interpolated subpatterns. + * @example + * + * var time = XRegExp.build('(?x)^ {{hours}} ({{minutes}}) $', { + * hours: XRegExp.build('{{h12}} : | {{h24}}', { + * h12: /1[0-2]|0?[1-9]/, + * h24: /2[0-3]|[01][0-9]/ + * }, 'x'), + * minutes: /^[0-5][0-9]$/ + * }); + * time.test('10:59'); // -> true + * XRegExp.exec('10:59', time).minutes; // -> '59' + */ + XRegExp.build = function(pattern, subs, flags) { + var inlineFlags = /^\(\?([\w$]+)\)/.exec(pattern), + data = {}, + numCaps = 0, // 'Caps' is short for captures + numPriorCaps, + numOuterCaps = 0, + outerCapsMap = [0], + outerCapNames, + sub, + p; + + // Add flags within a leading mode modifier to the overall pattern's flags + if (inlineFlags) { + flags = flags || ''; + inlineFlags[1].replace(/./g, function(flag) { + // Don't add duplicates + flags += (flags.indexOf(flag) > -1 ? '' : flag); + }); + } + + for (p in subs) { + if (subs.hasOwnProperty(p)) { + // Passing to XRegExp enables extended syntax and ensures independent validity, + // lest an unescaped `(`, `)`, `[`, or trailing `\` breaks the `(?:)` wrapper. For + // subpatterns provided as native regexes, it dies on octals and adds the property + // used to hold extended regex instance data, for simplicity + sub = asXRegExp(subs[p]); + data[p] = { + // Deanchoring allows embedding independently useful anchored regexes. If you + // really need to keep your anchors, double them (i.e., `^^...$$`) + pattern: deanchor(sub.source), + names: sub[REGEX_DATA].captureNames || [] + }; + } + } + + // Passing to XRegExp dies on octals and ensures the outer pattern is independently valid; + // helps keep this simple. Named captures will be put back + pattern = asXRegExp(pattern); + outerCapNames = pattern[REGEX_DATA].captureNames || []; + pattern = pattern.source.replace(parts, function($0, $1, $2, $3, $4) { + var subName = $1 || $2, + capName, + intro, + localCapIndex; + // Named subpattern + if (subName) { + if (!data.hasOwnProperty(subName)) { + throw new ReferenceError('Undefined property ' + $0); + } + // Named subpattern was wrapped in a capturing group + if ($1) { + capName = outerCapNames[numOuterCaps]; + outerCapsMap[++numOuterCaps] = ++numCaps; + // If it's a named group, preserve the name. Otherwise, use the subpattern name + // as the capture name + intro = '(?<' + (capName || subName) + '>'; + } else { + intro = '(?:'; + } + numPriorCaps = numCaps; + return intro + data[subName].pattern.replace(subParts, function(match, paren, backref) { + // Capturing group + if (paren) { + capName = data[subName].names[numCaps - numPriorCaps]; + ++numCaps; + // If the current capture has a name, preserve the name + if (capName) { + return '(?<' + capName + '>'; + } + // Backreference + } else if (backref) { + localCapIndex = +backref - 1; + // Rewrite the backreference + return data[subName].names[localCapIndex] ? + // Need to preserve the backreference name in case using flag `n` + '\\k<' + data[subName].names[localCapIndex] + '>' : + '\\' + (+backref + numPriorCaps); + } + return match; + }) + ')'; + } + // Capturing group + if ($3) { + capName = outerCapNames[numOuterCaps]; + outerCapsMap[++numOuterCaps] = ++numCaps; + // If the current capture has a name, preserve the name + if (capName) { + return '(?<' + capName + '>'; + } + // Backreference + } else if ($4) { + localCapIndex = +$4 - 1; + // Rewrite the backreference + return outerCapNames[localCapIndex] ? + // Need to preserve the backreference name in case using flag `n` + '\\k<' + outerCapNames[localCapIndex] + '>' : + '\\' + outerCapsMap[+$4]; + } + return $0; + }); + + return XRegExp(pattern, flags); + }; + +}; diff --git a/tools/eslint/node_modules/xregexp/src/addons/matchrecursive.js b/tools/eslint/node_modules/xregexp/src/addons/matchrecursive.js new file mode 100644 index 00000000000000..1de3bdc5579cea --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/addons/matchrecursive.js @@ -0,0 +1,191 @@ +/*! + * XRegExp.matchRecursive 3.1.0 + * + * Steven Levithan (c) 2009-2016 MIT License + */ + +module.exports = function(XRegExp) { + 'use strict'; + +/** + * Returns a match detail object composed of the provided values. + * + * @private + */ + function row(name, value, start, end) { + return { + name: name, + value: value, + start: start, + end: end + }; + } + +/** + * Returns an array of match strings between outermost left and right delimiters, or an array of + * objects with detailed match parts and position data. An error is thrown if delimiters are + * unbalanced within the data. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {String} left Left delimiter as an XRegExp pattern. + * @param {String} right Right delimiter as an XRegExp pattern. + * @param {String} [flags] Any native or XRegExp flags, used for the left and right delimiters. + * @param {Object} [options] Lets you specify `valueNames` and `escapeChar` options. + * @returns {Array} Array of matches, or an empty array. + * @example + * + * // Basic usage + * var str = '(t((e))s)t()(ing)'; + * XRegExp.matchRecursive(str, '\\(', '\\)', 'g'); + * // -> ['t((e))s', '', 'ing'] + * + * // Extended information mode with valueNames + * str = 'Here is
        an
        example'; + * XRegExp.matchRecursive(str, '', '', 'gi', { + * valueNames: ['between', 'left', 'match', 'right'] + * }); + * // -> [ + * // {name: 'between', value: 'Here is ', start: 0, end: 8}, + * // {name: 'left', value: '
        ', start: 8, end: 13}, + * // {name: 'match', value: '
        an
        ', start: 13, end: 27}, + * // {name: 'right', value: '
        ', start: 27, end: 33}, + * // {name: 'between', value: ' example', start: 33, end: 41} + * // ] + * + * // Omitting unneeded parts with null valueNames, and using escapeChar + * str = '...{1}.\\{{function(x,y){return {y:x}}}'; + * XRegExp.matchRecursive(str, '{', '}', 'g', { + * valueNames: ['literal', null, 'value', null], + * escapeChar: '\\' + * }); + * // -> [ + * // {name: 'literal', value: '...', start: 0, end: 3}, + * // {name: 'value', value: '1', start: 4, end: 5}, + * // {name: 'literal', value: '.\\{', start: 6, end: 9}, + * // {name: 'value', value: 'function(x,y){return {y:x}}', start: 10, end: 37} + * // ] + * + * // Sticky mode via flag y + * str = '<1><<<2>>><3>4<5>'; + * XRegExp.matchRecursive(str, '<', '>', 'gy'); + * // -> ['1', '<<2>>', '3'] + */ + XRegExp.matchRecursive = function(str, left, right, flags, options) { + flags = flags || ''; + options = options || {}; + var global = flags.indexOf('g') > -1, + sticky = flags.indexOf('y') > -1, + // Flag `y` is controlled internally + basicFlags = flags.replace(/y/g, ''), + escapeChar = options.escapeChar, + vN = options.valueNames, + output = [], + openTokens = 0, + delimStart = 0, + delimEnd = 0, + lastOuterEnd = 0, + outerStart, + innerStart, + leftMatch, + rightMatch, + esc; + left = XRegExp(left, basicFlags); + right = XRegExp(right, basicFlags); + + if (escapeChar) { + if (escapeChar.length > 1) { + throw new Error('Cannot use more than one escape character'); + } + escapeChar = XRegExp.escape(escapeChar); + // Using `XRegExp.union` safely rewrites backreferences in `left` and `right` + esc = new RegExp( + '(?:' + escapeChar + '[\\S\\s]|(?:(?!' + + XRegExp.union([left, right]).source + + ')[^' + escapeChar + '])+)+', + // Flags `gy` not needed here + flags.replace(/[^imu]+/g, '') + ); + } + + while (true) { + // If using an escape character, advance to the delimiter's next starting position, + // skipping any escaped characters in between + if (escapeChar) { + delimEnd += (XRegExp.exec(str, esc, delimEnd, 'sticky') || [''])[0].length; + } + leftMatch = XRegExp.exec(str, left, delimEnd); + rightMatch = XRegExp.exec(str, right, delimEnd); + // Keep the leftmost match only + if (leftMatch && rightMatch) { + if (leftMatch.index <= rightMatch.index) { + rightMatch = null; + } else { + leftMatch = null; + } + } + // Paths (LM: leftMatch, RM: rightMatch, OT: openTokens): + // LM | RM | OT | Result + // 1 | 0 | 1 | loop + // 1 | 0 | 0 | loop + // 0 | 1 | 1 | loop + // 0 | 1 | 0 | throw + // 0 | 0 | 1 | throw + // 0 | 0 | 0 | break + // The paths above don't include the sticky mode special case. The loop ends after the + // first completed match if not `global`. + if (leftMatch || rightMatch) { + delimStart = (leftMatch || rightMatch).index; + delimEnd = delimStart + (leftMatch || rightMatch)[0].length; + } else if (!openTokens) { + break; + } + if (sticky && !openTokens && delimStart > lastOuterEnd) { + break; + } + if (leftMatch) { + if (!openTokens) { + outerStart = delimStart; + innerStart = delimEnd; + } + ++openTokens; + } else if (rightMatch && openTokens) { + if (!--openTokens) { + if (vN) { + if (vN[0] && outerStart > lastOuterEnd) { + output.push(row(vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart)); + } + if (vN[1]) { + output.push(row(vN[1], str.slice(outerStart, innerStart), outerStart, innerStart)); + } + if (vN[2]) { + output.push(row(vN[2], str.slice(innerStart, delimStart), innerStart, delimStart)); + } + if (vN[3]) { + output.push(row(vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd)); + } + } else { + output.push(str.slice(innerStart, delimStart)); + } + lastOuterEnd = delimEnd; + if (!global) { + break; + } + } + } else { + throw new Error('Unbalanced delimiter found in string'); + } + // If the delimiter matched an empty string, avoid an infinite loop + if (delimStart === delimEnd) { + ++delimEnd; + } + } + + if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd) { + output.push(row(vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length)); + } + + return output; + }; + +}; diff --git a/tools/eslint/node_modules/xregexp/src/addons/unicode-base.js b/tools/eslint/node_modules/xregexp/src/addons/unicode-base.js new file mode 100644 index 00000000000000..2a323041b60e3e --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/addons/unicode-base.js @@ -0,0 +1,236 @@ +/*! + * XRegExp Unicode Base 3.1.0 + * + * Steven Levithan (c) 2008-2016 MIT License + */ + +/** + * Adds base support for Unicode matching: + * - Adds syntax `\p{..}` for matching Unicode tokens. Tokens can be inverted using `\P{..}` or + * `\p{^..}`. Token names ignore case, spaces, hyphens, and underscores. You can omit the braces + * for token names that are a single letter (e.g. `\pL` or `PL`). + * - Adds flag A (astral), which enables 21-bit Unicode support. + * - Adds the `XRegExp.addUnicodeData` method used by other addons to provide character data. + * + * Unicode Base relies on externally provided Unicode character data. Official addons are available + * to provide data for Unicode categories, scripts, blocks, and properties. + * + * @requires XRegExp + */ +module.exports = function(XRegExp) { + 'use strict'; + +// Storage for Unicode data + var unicode = {}; + +/* ============================== + * Private functions + * ============================== */ + +// Generates a token lookup name: lowercase, with hyphens, spaces, and underscores removed + function normalize(name) { + return name.replace(/[- _]+/g, '').toLowerCase(); + } + +// Adds leading zeros if shorter than four characters + function pad4(str) { + while (str.length < 4) { + str = '0' + str; + } + return str; + } + +// Converts a hexadecimal number to decimal + function dec(hex) { + return parseInt(hex, 16); + } + +// Converts a decimal number to hexadecimal + function hex(dec) { + return parseInt(dec, 10).toString(16); + } + +// Gets the decimal code of a literal code unit, \xHH, \uHHHH, or a backslash-escaped literal + function charCode(chr) { + var esc = /^\\[xu](.+)/.exec(chr); + return esc ? + dec(esc[1]) : + chr.charCodeAt(chr.charAt(0) === '\\' ? 1 : 0); + } + +// Inverts a list of ordered BMP characters and ranges + function invertBmp(range) { + var output = '', + lastEnd = -1, + start; + XRegExp.forEach(range, /(\\x..|\\u....|\\?[\s\S])(?:-(\\x..|\\u....|\\?[\s\S]))?/, function(m) { + start = charCode(m[1]); + if (start > (lastEnd + 1)) { + output += '\\u' + pad4(hex(lastEnd + 1)); + if (start > (lastEnd + 2)) { + output += '-\\u' + pad4(hex(start - 1)); + } + } + lastEnd = charCode(m[2] || m[1]); + }); + if (lastEnd < 0xFFFF) { + output += '\\u' + pad4(hex(lastEnd + 1)); + if (lastEnd < 0xFFFE) { + output += '-\\uFFFF'; + } + } + return output; + } + +// Generates an inverted BMP range on first use + function cacheInvertedBmp(slug) { + var prop = 'b!'; + return unicode[slug][prop] || ( + unicode[slug][prop] = invertBmp(unicode[slug].bmp) + ); + } + +// Combines and optionally negates BMP and astral data + function buildAstral(slug, isNegated) { + var item = unicode[slug], + combined = ''; + if (item.bmp && !item.isBmpLast) { + combined = '[' + item.bmp + ']' + (item.astral ? '|' : ''); + } + if (item.astral) { + combined += item.astral; + } + if (item.isBmpLast && item.bmp) { + combined += (item.astral ? '|' : '') + '[' + item.bmp + ']'; + } + // Astral Unicode tokens always match a code point, never a code unit + return isNegated ? + '(?:(?!' + combined + ')(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[\0-\uFFFF]))' : + '(?:' + combined + ')'; + } + +// Builds a complete astral pattern on first use + function cacheAstral(slug, isNegated) { + var prop = isNegated ? 'a!' : 'a='; + return unicode[slug][prop] || ( + unicode[slug][prop] = buildAstral(slug, isNegated) + ); + } + +/* ============================== + * Core functionality + * ============================== */ + +/* + * Add Unicode token syntax: \p{..}, \P{..}, \p{^..}. Also add astral mode (flag A). + */ + XRegExp.addToken( + // Use `*` instead of `+` to avoid capturing `^` as the token name in `\p{^}` + /\\([pP])(?:{(\^?)([^}]*)}|([A-Za-z]))/, + function(match, scope, flags) { + var ERR_DOUBLE_NEG = 'Invalid double negation ', + ERR_UNKNOWN_NAME = 'Unknown Unicode token ', + ERR_UNKNOWN_REF = 'Unicode token missing data ', + ERR_ASTRAL_ONLY = 'Astral mode required for Unicode token ', + ERR_ASTRAL_IN_CLASS = 'Astral mode does not support Unicode tokens within character classes', + // Negated via \P{..} or \p{^..} + isNegated = match[1] === 'P' || !!match[2], + // Switch from BMP (0-FFFF) to astral (0-10FFFF) mode via flag A + isAstralMode = flags.indexOf('A') > -1, + // Token lookup name. Check `[4]` first to avoid passing `undefined` via `\p{}` + slug = normalize(match[4] || match[3]), + // Token data object + item = unicode[slug]; + + if (match[1] === 'P' && match[2]) { + throw new SyntaxError(ERR_DOUBLE_NEG + match[0]); + } + if (!unicode.hasOwnProperty(slug)) { + throw new SyntaxError(ERR_UNKNOWN_NAME + match[0]); + } + + // Switch to the negated form of the referenced Unicode token + if (item.inverseOf) { + slug = normalize(item.inverseOf); + if (!unicode.hasOwnProperty(slug)) { + throw new ReferenceError(ERR_UNKNOWN_REF + match[0] + ' -> ' + item.inverseOf); + } + item = unicode[slug]; + isNegated = !isNegated; + } + + if (!(item.bmp || isAstralMode)) { + throw new SyntaxError(ERR_ASTRAL_ONLY + match[0]); + } + if (isAstralMode) { + if (scope === 'class') { + throw new SyntaxError(ERR_ASTRAL_IN_CLASS); + } + + return cacheAstral(slug, isNegated); + } + + return scope === 'class' ? + (isNegated ? cacheInvertedBmp(slug) : item.bmp) : + (isNegated ? '[^' : '[') + item.bmp + ']'; + }, + { + scope: 'all', + optionalFlags: 'A', + leadChar: '\\' + } + ); + +/** + * Adds to the list of Unicode tokens that XRegExp regexes can match via `\p` or `\P`. + * + * @memberOf XRegExp + * @param {Array} data Objects with named character ranges. Each object may have properties `name`, + * `alias`, `isBmpLast`, `inverseOf`, `bmp`, and `astral`. All but `name` are optional, although + * one of `bmp` or `astral` is required (unless `inverseOf` is set). If `astral` is absent, the + * `bmp` data is used for BMP and astral modes. If `bmp` is absent, the name errors in BMP mode + * but works in astral mode. If both `bmp` and `astral` are provided, the `bmp` data only is used + * in BMP mode, and the combination of `bmp` and `astral` data is used in astral mode. + * `isBmpLast` is needed when a token matches orphan high surrogates *and* uses surrogate pairs + * to match astral code points. The `bmp` and `astral` data should be a combination of literal + * characters and `\xHH` or `\uHHHH` escape sequences, with hyphens to create ranges. Any regex + * metacharacters in the data should be escaped, apart from range-creating hyphens. The `astral` + * data can additionally use character classes and alternation, and should use surrogate pairs to + * represent astral code points. `inverseOf` can be used to avoid duplicating character data if a + * Unicode token is defined as the exact inverse of another token. + * @example + * + * // Basic use + * XRegExp.addUnicodeData([{ + * name: 'XDigit', + * alias: 'Hexadecimal', + * bmp: '0-9A-Fa-f' + * }]); + * XRegExp('\\p{XDigit}:\\p{Hexadecimal}+').test('0:3D'); // -> true + */ + XRegExp.addUnicodeData = function(data) { + var ERR_NO_NAME = 'Unicode token requires name', + ERR_NO_DATA = 'Unicode token has no character data ', + item, + i; + + for (i = 0; i < data.length; ++i) { + item = data[i]; + if (!item.name) { + throw new Error(ERR_NO_NAME); + } + if (!(item.inverseOf || item.bmp || item.astral)) { + throw new Error(ERR_NO_DATA + item.name); + } + unicode[normalize(item.name)] = item; + if (item.alias) { + unicode[normalize(item.alias)] = item; + } + } + + // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and + // flags might now produce different results + XRegExp.cache.flush('patterns'); + }; + +}; diff --git a/tools/eslint/node_modules/xregexp/src/addons/unicode-blocks.js b/tools/eslint/node_modules/xregexp/src/addons/unicode-blocks.js new file mode 100644 index 00000000000000..918dc9d5c45742 --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/addons/unicode-blocks.js @@ -0,0 +1,1074 @@ +/*! + * XRegExp Unicode Blocks 3.1.0 + * + * Steven Levithan (c) 2010-2016 MIT License + * Unicode data by Mathias Bynens + */ + +/** + * Adds support for all Unicode blocks. Block names use the prefix 'In'. E.g., `\p{InBasicLatin}`. + * Token names are case insensitive, and any spaces, hyphens, and underscores are ignored. + * + * Uses Unicode 8.0.0. + * + * @requires XRegExp, Unicode Base + */ +module.exports = function(XRegExp) { + 'use strict'; + + if (!XRegExp.addUnicodeData) { + throw new ReferenceError('Unicode Base must be loaded before Unicode Blocks'); + } + + XRegExp.addUnicodeData([ + { + name: 'InAegean_Numbers', + astral: '\uD800[\uDD00-\uDD3F]' + }, + { + name: 'InAhom', + astral: '\uD805[\uDF00-\uDF3F]' + }, + { + name: 'InAlchemical_Symbols', + astral: '\uD83D[\uDF00-\uDF7F]' + }, + { + name: 'InAlphabetic_Presentation_Forms', + bmp: '\uFB00-\uFB4F' + }, + { + name: 'InAnatolian_Hieroglyphs', + astral: '\uD811[\uDC00-\uDE7F]' + }, + { + name: 'InAncient_Greek_Musical_Notation', + astral: '\uD834[\uDE00-\uDE4F]' + }, + { + name: 'InAncient_Greek_Numbers', + astral: '\uD800[\uDD40-\uDD8F]' + }, + { + name: 'InAncient_Symbols', + astral: '\uD800[\uDD90-\uDDCF]' + }, + { + name: 'InArabic', + bmp: '\u0600-\u06FF' + }, + { + name: 'InArabic_Extended_A', + bmp: '\u08A0-\u08FF' + }, + { + name: 'InArabic_Mathematical_Alphabetic_Symbols', + astral: '\uD83B[\uDE00-\uDEFF]' + }, + { + name: 'InArabic_Presentation_Forms_A', + bmp: '\uFB50-\uFDFF' + }, + { + name: 'InArabic_Presentation_Forms_B', + bmp: '\uFE70-\uFEFF' + }, + { + name: 'InArabic_Supplement', + bmp: '\u0750-\u077F' + }, + { + name: 'InArmenian', + bmp: '\u0530-\u058F' + }, + { + name: 'InArrows', + bmp: '\u2190-\u21FF' + }, + { + name: 'InAvestan', + astral: '\uD802[\uDF00-\uDF3F]' + }, + { + name: 'InBalinese', + bmp: '\u1B00-\u1B7F' + }, + { + name: 'InBamum', + bmp: '\uA6A0-\uA6FF' + }, + { + name: 'InBamum_Supplement', + astral: '\uD81A[\uDC00-\uDE3F]' + }, + { + name: 'InBasic_Latin', + bmp: '\0-\x7F' + }, + { + name: 'InBassa_Vah', + astral: '\uD81A[\uDED0-\uDEFF]' + }, + { + name: 'InBatak', + bmp: '\u1BC0-\u1BFF' + }, + { + name: 'InBengali', + bmp: '\u0980-\u09FF' + }, + { + name: 'InBlock_Elements', + bmp: '\u2580-\u259F' + }, + { + name: 'InBopomofo', + bmp: '\u3100-\u312F' + }, + { + name: 'InBopomofo_Extended', + bmp: '\u31A0-\u31BF' + }, + { + name: 'InBox_Drawing', + bmp: '\u2500-\u257F' + }, + { + name: 'InBrahmi', + astral: '\uD804[\uDC00-\uDC7F]' + }, + { + name: 'InBraille_Patterns', + bmp: '\u2800-\u28FF' + }, + { + name: 'InBuginese', + bmp: '\u1A00-\u1A1F' + }, + { + name: 'InBuhid', + bmp: '\u1740-\u175F' + }, + { + name: 'InByzantine_Musical_Symbols', + astral: '\uD834[\uDC00-\uDCFF]' + }, + { + name: 'InCJK_Compatibility', + bmp: '\u3300-\u33FF' + }, + { + name: 'InCJK_Compatibility_Forms', + bmp: '\uFE30-\uFE4F' + }, + { + name: 'InCJK_Compatibility_Ideographs', + bmp: '\uF900-\uFAFF' + }, + { + name: 'InCJK_Compatibility_Ideographs_Supplement', + astral: '\uD87E[\uDC00-\uDE1F]' + }, + { + name: 'InCJK_Radicals_Supplement', + bmp: '\u2E80-\u2EFF' + }, + { + name: 'InCJK_Strokes', + bmp: '\u31C0-\u31EF' + }, + { + name: 'InCJK_Symbols_and_Punctuation', + bmp: '\u3000-\u303F' + }, + { + name: 'InCJK_Unified_Ideographs', + bmp: '\u4E00-\u9FFF' + }, + { + name: 'InCJK_Unified_Ideographs_Extension_A', + bmp: '\u3400-\u4DBF' + }, + { + name: 'InCJK_Unified_Ideographs_Extension_B', + astral: '[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]' + }, + { + name: 'InCJK_Unified_Ideographs_Extension_C', + astral: '\uD86D[\uDC00-\uDF3F]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD869[\uDF00-\uDFFF]' + }, + { + name: 'InCJK_Unified_Ideographs_Extension_D', + astral: '\uD86D[\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1F]' + }, + { + name: 'InCJK_Unified_Ideographs_Extension_E', + astral: '[\uD86F-\uD872][\uDC00-\uDFFF]|\uD873[\uDC00-\uDEAF]|\uD86E[\uDC20-\uDFFF]' + }, + { + name: 'InCarian', + astral: '\uD800[\uDEA0-\uDEDF]' + }, + { + name: 'InCaucasian_Albanian', + astral: '\uD801[\uDD30-\uDD6F]' + }, + { + name: 'InChakma', + astral: '\uD804[\uDD00-\uDD4F]' + }, + { + name: 'InCham', + bmp: '\uAA00-\uAA5F' + }, + { + name: 'InCherokee', + bmp: '\u13A0-\u13FF' + }, + { + name: 'InCherokee_Supplement', + bmp: '\uAB70-\uABBF' + }, + { + name: 'InCombining_Diacritical_Marks', + bmp: '\u0300-\u036F' + }, + { + name: 'InCombining_Diacritical_Marks_Extended', + bmp: '\u1AB0-\u1AFF' + }, + { + name: 'InCombining_Diacritical_Marks_Supplement', + bmp: '\u1DC0-\u1DFF' + }, + { + name: 'InCombining_Diacritical_Marks_for_Symbols', + bmp: '\u20D0-\u20FF' + }, + { + name: 'InCombining_Half_Marks', + bmp: '\uFE20-\uFE2F' + }, + { + name: 'InCommon_Indic_Number_Forms', + bmp: '\uA830-\uA83F' + }, + { + name: 'InControl_Pictures', + bmp: '\u2400-\u243F' + }, + { + name: 'InCoptic', + bmp: '\u2C80-\u2CFF' + }, + { + name: 'InCoptic_Epact_Numbers', + astral: '\uD800[\uDEE0-\uDEFF]' + }, + { + name: 'InCounting_Rod_Numerals', + astral: '\uD834[\uDF60-\uDF7F]' + }, + { + name: 'InCuneiform', + astral: '\uD808[\uDC00-\uDFFF]' + }, + { + name: 'InCuneiform_Numbers_and_Punctuation', + astral: '\uD809[\uDC00-\uDC7F]' + }, + { + name: 'InCurrency_Symbols', + bmp: '\u20A0-\u20CF' + }, + { + name: 'InCypriot_Syllabary', + astral: '\uD802[\uDC00-\uDC3F]' + }, + { + name: 'InCyrillic', + bmp: '\u0400-\u04FF' + }, + { + name: 'InCyrillic_Extended_A', + bmp: '\u2DE0-\u2DFF' + }, + { + name: 'InCyrillic_Extended_B', + bmp: '\uA640-\uA69F' + }, + { + name: 'InCyrillic_Supplement', + bmp: '\u0500-\u052F' + }, + { + name: 'InDeseret', + astral: '\uD801[\uDC00-\uDC4F]' + }, + { + name: 'InDevanagari', + bmp: '\u0900-\u097F' + }, + { + name: 'InDevanagari_Extended', + bmp: '\uA8E0-\uA8FF' + }, + { + name: 'InDingbats', + bmp: '\u2700-\u27BF' + }, + { + name: 'InDomino_Tiles', + astral: '\uD83C[\uDC30-\uDC9F]' + }, + { + name: 'InDuployan', + astral: '\uD82F[\uDC00-\uDC9F]' + }, + { + name: 'InEarly_Dynastic_Cuneiform', + astral: '\uD809[\uDC80-\uDD4F]' + }, + { + name: 'InEgyptian_Hieroglyphs', + astral: '\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F]' + }, + { + name: 'InElbasan', + astral: '\uD801[\uDD00-\uDD2F]' + }, + { + name: 'InEmoticons', + astral: '\uD83D[\uDE00-\uDE4F]' + }, + { + name: 'InEnclosed_Alphanumeric_Supplement', + astral: '\uD83C[\uDD00-\uDDFF]' + }, + { + name: 'InEnclosed_Alphanumerics', + bmp: '\u2460-\u24FF' + }, + { + name: 'InEnclosed_CJK_Letters_and_Months', + bmp: '\u3200-\u32FF' + }, + { + name: 'InEnclosed_Ideographic_Supplement', + astral: '\uD83C[\uDE00-\uDEFF]' + }, + { + name: 'InEthiopic', + bmp: '\u1200-\u137F' + }, + { + name: 'InEthiopic_Extended', + bmp: '\u2D80-\u2DDF' + }, + { + name: 'InEthiopic_Extended_A', + bmp: '\uAB00-\uAB2F' + }, + { + name: 'InEthiopic_Supplement', + bmp: '\u1380-\u139F' + }, + { + name: 'InGeneral_Punctuation', + bmp: '\u2000-\u206F' + }, + { + name: 'InGeometric_Shapes', + bmp: '\u25A0-\u25FF' + }, + { + name: 'InGeometric_Shapes_Extended', + astral: '\uD83D[\uDF80-\uDFFF]' + }, + { + name: 'InGeorgian', + bmp: '\u10A0-\u10FF' + }, + { + name: 'InGeorgian_Supplement', + bmp: '\u2D00-\u2D2F' + }, + { + name: 'InGlagolitic', + bmp: '\u2C00-\u2C5F' + }, + { + name: 'InGothic', + astral: '\uD800[\uDF30-\uDF4F]' + }, + { + name: 'InGrantha', + astral: '\uD804[\uDF00-\uDF7F]' + }, + { + name: 'InGreek_Extended', + bmp: '\u1F00-\u1FFF' + }, + { + name: 'InGreek_and_Coptic', + bmp: '\u0370-\u03FF' + }, + { + name: 'InGujarati', + bmp: '\u0A80-\u0AFF' + }, + { + name: 'InGurmukhi', + bmp: '\u0A00-\u0A7F' + }, + { + name: 'InHalfwidth_and_Fullwidth_Forms', + bmp: '\uFF00-\uFFEF' + }, + { + name: 'InHangul_Compatibility_Jamo', + bmp: '\u3130-\u318F' + }, + { + name: 'InHangul_Jamo', + bmp: '\u1100-\u11FF' + }, + { + name: 'InHangul_Jamo_Extended_A', + bmp: '\uA960-\uA97F' + }, + { + name: 'InHangul_Jamo_Extended_B', + bmp: '\uD7B0-\uD7FF' + }, + { + name: 'InHangul_Syllables', + bmp: '\uAC00-\uD7AF' + }, + { + name: 'InHanunoo', + bmp: '\u1720-\u173F' + }, + { + name: 'InHatran', + astral: '\uD802[\uDCE0-\uDCFF]' + }, + { + name: 'InHebrew', + bmp: '\u0590-\u05FF' + }, + { + name: 'InHigh_Private_Use_Surrogates', + bmp: '\uDB80-\uDBFF' + }, + { + name: 'InHigh_Surrogates', + bmp: '\uD800-\uDB7F' + }, + { + name: 'InHiragana', + bmp: '\u3040-\u309F' + }, + { + name: 'InIPA_Extensions', + bmp: '\u0250-\u02AF' + }, + { + name: 'InIdeographic_Description_Characters', + bmp: '\u2FF0-\u2FFF' + }, + { + name: 'InImperial_Aramaic', + astral: '\uD802[\uDC40-\uDC5F]' + }, + { + name: 'InInscriptional_Pahlavi', + astral: '\uD802[\uDF60-\uDF7F]' + }, + { + name: 'InInscriptional_Parthian', + astral: '\uD802[\uDF40-\uDF5F]' + }, + { + name: 'InJavanese', + bmp: '\uA980-\uA9DF' + }, + { + name: 'InKaithi', + astral: '\uD804[\uDC80-\uDCCF]' + }, + { + name: 'InKana_Supplement', + astral: '\uD82C[\uDC00-\uDCFF]' + }, + { + name: 'InKanbun', + bmp: '\u3190-\u319F' + }, + { + name: 'InKangxi_Radicals', + bmp: '\u2F00-\u2FDF' + }, + { + name: 'InKannada', + bmp: '\u0C80-\u0CFF' + }, + { + name: 'InKatakana', + bmp: '\u30A0-\u30FF' + }, + { + name: 'InKatakana_Phonetic_Extensions', + bmp: '\u31F0-\u31FF' + }, + { + name: 'InKayah_Li', + bmp: '\uA900-\uA92F' + }, + { + name: 'InKharoshthi', + astral: '\uD802[\uDE00-\uDE5F]' + }, + { + name: 'InKhmer', + bmp: '\u1780-\u17FF' + }, + { + name: 'InKhmer_Symbols', + bmp: '\u19E0-\u19FF' + }, + { + name: 'InKhojki', + astral: '\uD804[\uDE00-\uDE4F]' + }, + { + name: 'InKhudawadi', + astral: '\uD804[\uDEB0-\uDEFF]' + }, + { + name: 'InLao', + bmp: '\u0E80-\u0EFF' + }, + { + name: 'InLatin_Extended_Additional', + bmp: '\u1E00-\u1EFF' + }, + { + name: 'InLatin_Extended_A', + bmp: '\u0100-\u017F' + }, + { + name: 'InLatin_Extended_B', + bmp: '\u0180-\u024F' + }, + { + name: 'InLatin_Extended_C', + bmp: '\u2C60-\u2C7F' + }, + { + name: 'InLatin_Extended_D', + bmp: '\uA720-\uA7FF' + }, + { + name: 'InLatin_Extended_E', + bmp: '\uAB30-\uAB6F' + }, + { + name: 'InLatin_1_Supplement', + bmp: '\x80-\xFF' + }, + { + name: 'InLepcha', + bmp: '\u1C00-\u1C4F' + }, + { + name: 'InLetterlike_Symbols', + bmp: '\u2100-\u214F' + }, + { + name: 'InLimbu', + bmp: '\u1900-\u194F' + }, + { + name: 'InLinear_A', + astral: '\uD801[\uDE00-\uDF7F]' + }, + { + name: 'InLinear_B_Ideograms', + astral: '\uD800[\uDC80-\uDCFF]' + }, + { + name: 'InLinear_B_Syllabary', + astral: '\uD800[\uDC00-\uDC7F]' + }, + { + name: 'InLisu', + bmp: '\uA4D0-\uA4FF' + }, + { + name: 'InLow_Surrogates', + bmp: '\uDC00-\uDFFF' + }, + { + name: 'InLycian', + astral: '\uD800[\uDE80-\uDE9F]' + }, + { + name: 'InLydian', + astral: '\uD802[\uDD20-\uDD3F]' + }, + { + name: 'InMahajani', + astral: '\uD804[\uDD50-\uDD7F]' + }, + { + name: 'InMahjong_Tiles', + astral: '\uD83C[\uDC00-\uDC2F]' + }, + { + name: 'InMalayalam', + bmp: '\u0D00-\u0D7F' + }, + { + name: 'InMandaic', + bmp: '\u0840-\u085F' + }, + { + name: 'InManichaean', + astral: '\uD802[\uDEC0-\uDEFF]' + }, + { + name: 'InMathematical_Alphanumeric_Symbols', + astral: '\uD835[\uDC00-\uDFFF]' + }, + { + name: 'InMathematical_Operators', + bmp: '\u2200-\u22FF' + }, + { + name: 'InMeetei_Mayek', + bmp: '\uABC0-\uABFF' + }, + { + name: 'InMeetei_Mayek_Extensions', + bmp: '\uAAE0-\uAAFF' + }, + { + name: 'InMende_Kikakui', + astral: '\uD83A[\uDC00-\uDCDF]' + }, + { + name: 'InMeroitic_Cursive', + astral: '\uD802[\uDDA0-\uDDFF]' + }, + { + name: 'InMeroitic_Hieroglyphs', + astral: '\uD802[\uDD80-\uDD9F]' + }, + { + name: 'InMiao', + astral: '\uD81B[\uDF00-\uDF9F]' + }, + { + name: 'InMiscellaneous_Mathematical_Symbols_A', + bmp: '\u27C0-\u27EF' + }, + { + name: 'InMiscellaneous_Mathematical_Symbols_B', + bmp: '\u2980-\u29FF' + }, + { + name: 'InMiscellaneous_Symbols', + bmp: '\u2600-\u26FF' + }, + { + name: 'InMiscellaneous_Symbols_and_Arrows', + bmp: '\u2B00-\u2BFF' + }, + { + name: 'InMiscellaneous_Symbols_and_Pictographs', + astral: '\uD83D[\uDC00-\uDDFF]|\uD83C[\uDF00-\uDFFF]' + }, + { + name: 'InMiscellaneous_Technical', + bmp: '\u2300-\u23FF' + }, + { + name: 'InModi', + astral: '\uD805[\uDE00-\uDE5F]' + }, + { + name: 'InModifier_Tone_Letters', + bmp: '\uA700-\uA71F' + }, + { + name: 'InMongolian', + bmp: '\u1800-\u18AF' + }, + { + name: 'InMro', + astral: '\uD81A[\uDE40-\uDE6F]' + }, + { + name: 'InMultani', + astral: '\uD804[\uDE80-\uDEAF]' + }, + { + name: 'InMusical_Symbols', + astral: '\uD834[\uDD00-\uDDFF]' + }, + { + name: 'InMyanmar', + bmp: '\u1000-\u109F' + }, + { + name: 'InMyanmar_Extended_A', + bmp: '\uAA60-\uAA7F' + }, + { + name: 'InMyanmar_Extended_B', + bmp: '\uA9E0-\uA9FF' + }, + { + name: 'InNKo', + bmp: '\u07C0-\u07FF' + }, + { + name: 'InNabataean', + astral: '\uD802[\uDC80-\uDCAF]' + }, + { + name: 'InNew_Tai_Lue', + bmp: '\u1980-\u19DF' + }, + { + name: 'InNumber_Forms', + bmp: '\u2150-\u218F' + }, + { + name: 'InOgham', + bmp: '\u1680-\u169F' + }, + { + name: 'InOl_Chiki', + bmp: '\u1C50-\u1C7F' + }, + { + name: 'InOld_Hungarian', + astral: '\uD803[\uDC80-\uDCFF]' + }, + { + name: 'InOld_Italic', + astral: '\uD800[\uDF00-\uDF2F]' + }, + { + name: 'InOld_North_Arabian', + astral: '\uD802[\uDE80-\uDE9F]' + }, + { + name: 'InOld_Permic', + astral: '\uD800[\uDF50-\uDF7F]' + }, + { + name: 'InOld_Persian', + astral: '\uD800[\uDFA0-\uDFDF]' + }, + { + name: 'InOld_South_Arabian', + astral: '\uD802[\uDE60-\uDE7F]' + }, + { + name: 'InOld_Turkic', + astral: '\uD803[\uDC00-\uDC4F]' + }, + { + name: 'InOptical_Character_Recognition', + bmp: '\u2440-\u245F' + }, + { + name: 'InOriya', + bmp: '\u0B00-\u0B7F' + }, + { + name: 'InOrnamental_Dingbats', + astral: '\uD83D[\uDE50-\uDE7F]' + }, + { + name: 'InOsmanya', + astral: '\uD801[\uDC80-\uDCAF]' + }, + { + name: 'InPahawh_Hmong', + astral: '\uD81A[\uDF00-\uDF8F]' + }, + { + name: 'InPalmyrene', + astral: '\uD802[\uDC60-\uDC7F]' + }, + { + name: 'InPau_Cin_Hau', + astral: '\uD806[\uDEC0-\uDEFF]' + }, + { + name: 'InPhags_pa', + bmp: '\uA840-\uA87F' + }, + { + name: 'InPhaistos_Disc', + astral: '\uD800[\uDDD0-\uDDFF]' + }, + { + name: 'InPhoenician', + astral: '\uD802[\uDD00-\uDD1F]' + }, + { + name: 'InPhonetic_Extensions', + bmp: '\u1D00-\u1D7F' + }, + { + name: 'InPhonetic_Extensions_Supplement', + bmp: '\u1D80-\u1DBF' + }, + { + name: 'InPlaying_Cards', + astral: '\uD83C[\uDCA0-\uDCFF]' + }, + { + name: 'InPrivate_Use_Area', + bmp: '\uE000-\uF8FF' + }, + { + name: 'InPsalter_Pahlavi', + astral: '\uD802[\uDF80-\uDFAF]' + }, + { + name: 'InRejang', + bmp: '\uA930-\uA95F' + }, + { + name: 'InRumi_Numeral_Symbols', + astral: '\uD803[\uDE60-\uDE7F]' + }, + { + name: 'InRunic', + bmp: '\u16A0-\u16FF' + }, + { + name: 'InSamaritan', + bmp: '\u0800-\u083F' + }, + { + name: 'InSaurashtra', + bmp: '\uA880-\uA8DF' + }, + { + name: 'InSharada', + astral: '\uD804[\uDD80-\uDDDF]' + }, + { + name: 'InShavian', + astral: '\uD801[\uDC50-\uDC7F]' + }, + { + name: 'InShorthand_Format_Controls', + astral: '\uD82F[\uDCA0-\uDCAF]' + }, + { + name: 'InSiddham', + astral: '\uD805[\uDD80-\uDDFF]' + }, + { + name: 'InSinhala', + bmp: '\u0D80-\u0DFF' + }, + { + name: 'InSinhala_Archaic_Numbers', + astral: '\uD804[\uDDE0-\uDDFF]' + }, + { + name: 'InSmall_Form_Variants', + bmp: '\uFE50-\uFE6F' + }, + { + name: 'InSora_Sompeng', + astral: '\uD804[\uDCD0-\uDCFF]' + }, + { + name: 'InSpacing_Modifier_Letters', + bmp: '\u02B0-\u02FF' + }, + { + name: 'InSpecials', + bmp: '\uFFF0-\uFFFF' + }, + { + name: 'InSundanese', + bmp: '\u1B80-\u1BBF' + }, + { + name: 'InSundanese_Supplement', + bmp: '\u1CC0-\u1CCF' + }, + { + name: 'InSuperscripts_and_Subscripts', + bmp: '\u2070-\u209F' + }, + { + name: 'InSupplemental_Arrows_A', + bmp: '\u27F0-\u27FF' + }, + { + name: 'InSupplemental_Arrows_B', + bmp: '\u2900-\u297F' + }, + { + name: 'InSupplemental_Arrows_C', + astral: '\uD83E[\uDC00-\uDCFF]' + }, + { + name: 'InSupplemental_Mathematical_Operators', + bmp: '\u2A00-\u2AFF' + }, + { + name: 'InSupplemental_Punctuation', + bmp: '\u2E00-\u2E7F' + }, + { + name: 'InSupplemental_Symbols_and_Pictographs', + astral: '\uD83E[\uDD00-\uDDFF]' + }, + { + name: 'InSupplementary_Private_Use_Area_A', + astral: '[\uDB80-\uDBBF][\uDC00-\uDFFF]' + }, + { + name: 'InSupplementary_Private_Use_Area_B', + astral: '[\uDBC0-\uDBFF][\uDC00-\uDFFF]' + }, + { + name: 'InSutton_SignWriting', + astral: '\uD836[\uDC00-\uDEAF]' + }, + { + name: 'InSyloti_Nagri', + bmp: '\uA800-\uA82F' + }, + { + name: 'InSyriac', + bmp: '\u0700-\u074F' + }, + { + name: 'InTagalog', + bmp: '\u1700-\u171F' + }, + { + name: 'InTagbanwa', + bmp: '\u1760-\u177F' + }, + { + name: 'InTags', + astral: '\uDB40[\uDC00-\uDC7F]' + }, + { + name: 'InTai_Le', + bmp: '\u1950-\u197F' + }, + { + name: 'InTai_Tham', + bmp: '\u1A20-\u1AAF' + }, + { + name: 'InTai_Viet', + bmp: '\uAA80-\uAADF' + }, + { + name: 'InTai_Xuan_Jing_Symbols', + astral: '\uD834[\uDF00-\uDF5F]' + }, + { + name: 'InTakri', + astral: '\uD805[\uDE80-\uDECF]' + }, + { + name: 'InTamil', + bmp: '\u0B80-\u0BFF' + }, + { + name: 'InTelugu', + bmp: '\u0C00-\u0C7F' + }, + { + name: 'InThaana', + bmp: '\u0780-\u07BF' + }, + { + name: 'InThai', + bmp: '\u0E00-\u0E7F' + }, + { + name: 'InTibetan', + bmp: '\u0F00-\u0FFF' + }, + { + name: 'InTifinagh', + bmp: '\u2D30-\u2D7F' + }, + { + name: 'InTirhuta', + astral: '\uD805[\uDC80-\uDCDF]' + }, + { + name: 'InTransport_and_Map_Symbols', + astral: '\uD83D[\uDE80-\uDEFF]' + }, + { + name: 'InUgaritic', + astral: '\uD800[\uDF80-\uDF9F]' + }, + { + name: 'InUnified_Canadian_Aboriginal_Syllabics', + bmp: '\u1400-\u167F' + }, + { + name: 'InUnified_Canadian_Aboriginal_Syllabics_Extended', + bmp: '\u18B0-\u18FF' + }, + { + name: 'InVai', + bmp: '\uA500-\uA63F' + }, + { + name: 'InVariation_Selectors', + bmp: '\uFE00-\uFE0F' + }, + { + name: 'InVariation_Selectors_Supplement', + astral: '\uDB40[\uDD00-\uDDEF]' + }, + { + name: 'InVedic_Extensions', + bmp: '\u1CD0-\u1CFF' + }, + { + name: 'InVertical_Forms', + bmp: '\uFE10-\uFE1F' + }, + { + name: 'InWarang_Citi', + astral: '\uD806[\uDCA0-\uDCFF]' + }, + { + name: 'InYi_Radicals', + bmp: '\uA490-\uA4CF' + }, + { + name: 'InYi_Syllables', + bmp: '\uA000-\uA48F' + }, + { + name: 'InYijing_Hexagram_Symbols', + bmp: '\u4DC0-\u4DFF' + } + ]); + +}; diff --git a/tools/eslint/node_modules/xregexp/src/addons/unicode-categories.js b/tools/eslint/node_modules/xregexp/src/addons/unicode-categories.js new file mode 100644 index 00000000000000..6da732f505abcc --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/addons/unicode-categories.js @@ -0,0 +1,235 @@ +/*! + * XRegExp Unicode Categories 3.1.0 + * + * Steven Levithan (c) 2010-2016 MIT License + * Unicode data by Mathias Bynens + */ + +/** + * Adds support for Unicode's general categories. E.g., `\p{Lu}` or `\p{Uppercase Letter}`. See + * category descriptions in UAX #44 . Token names + * are case insensitive, and any spaces, hyphens, and underscores are ignored. + * + * Uses Unicode 8.0.0. + * + * @requires XRegExp, Unicode Base + */ +module.exports = function(XRegExp) { + 'use strict'; + + if (!XRegExp.addUnicodeData) { + throw new ReferenceError('Unicode Base must be loaded before Unicode Categories'); + } + + XRegExp.addUnicodeData([ + { + name: 'C', + alias: 'Other', + isBmpLast: true, + bmp: '\0-\x1F\x7F-\x9F\xAD\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u0560\u0588\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08B5-\u08E2\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0AFA-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D00\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5E\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180E\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ABF-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7\u1CFA-\u1CFF\u1DF6-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BF-\u20CF\u20F1-\u20FF\u218C-\u218F\u23FB-\u23FF\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2B97\u2BBA-\u2BBC\u2BC9\u2BD2-\u2BEB\u2BF0-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E43-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FD6-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7AE\uA7AF\uA7B8-\uA7F6\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FE\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB66-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF', + astral: '\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDD73-\uDD7A\uDDE9-\uDDFF\uDE46-\uDEFF\uDF57-\uDF5F\uDF72-\uDFFF]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD6F\uDD9B-\uDDE5\uDE03-\uDE0F\uDE3B-\uDE3F\uDE49-\uDE4F\uDE52-\uDEFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDE70-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|\uD81B[\uDC00-\uDEFF\uDF45-\uDF4F\uDF7F-\uDF8E\uDFA0-\uDFFF]|\uD86E[\uDC1E\uDC1F]|\uD83D[\uDD7A\uDDA4\uDED1-\uDEDF\uDEED-\uDEEF\uDEF4-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD70-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8D-\uDD8F\uDD9C-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2F\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD869[\uDED7-\uDEFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC70-\uDC7E\uDCBD\uDCC2-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD44-\uDD4F\uDD77-\uDD7F\uDDCE\uDDCF\uDDE0\uDDF5-\uDDFF\uDE12\uDE3E-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF3B\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD86D[\uDF35-\uDF3F]|[\uD807\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD81C-\uD82B\uD82D\uD82E\uD830-\uD833\uD837-\uD839\uD83F\uD874-\uD87D\uD87F-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD806[\uDC00-\uDC9F\uDCF3-\uDCFE\uDD00-\uDEBF\uDEF9-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD00-\uDE5F\uDE7F-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD805[\uDC00-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB8-\uDEBF\uDECA-\uDEFF\uDF1A-\uDF1C\uDF2C-\uDF2F\uDF40-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE34-\uDE37\uDE3B-\uDE3E\uDE48-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA0-\uDFFF]|\uD82C[\uDC02-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDD0F\uDD19-\uDD7F\uDD85-\uDDBF\uDDC1-\uDFFF]|\uD873[\uDEA2-\uDFFF]' + }, + { + name: 'Cc', + alias: 'Control', + bmp: '\0-\x1F\x7F-\x9F' + }, + { + name: 'Cf', + alias: 'Format', + bmp: '\xAD\u0600-\u0605\u061C\u06DD\u070F\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB', + astral: '\uDB40[\uDC01\uDC20-\uDC7F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uD804\uDCBD' + }, + { + name: 'Cn', + alias: 'Unassigned', + bmp: '\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u0560\u0588\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u05FF\u061D\u070E\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08B5-\u08E2\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0AFA-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D00\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5E\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ABF-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7\u1CFA-\u1CFF\u1DF6-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u2065\u2072\u2073\u208F\u209D-\u209F\u20BF-\u20CF\u20F1-\u20FF\u218C-\u218F\u23FB-\u23FF\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2B97\u2BBA-\u2BBC\u2BC9\u2BD2-\u2BEB\u2BF0-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E43-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FD6-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7AE\uA7AF\uA7B8-\uA7F6\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FE\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB66-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD\uFEFE\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFF8\uFFFE\uFFFF', + astral: '\uDB40[\uDC00\uDC02-\uDC1F\uDC80-\uDCFF\uDDF0-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDDE9-\uDDFF\uDE46-\uDEFF\uDF57-\uDF5F\uDF72-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD6F\uDD9B-\uDDE5\uDE03-\uDE0F\uDE3B-\uDE3F\uDE49-\uDE4F\uDE52-\uDEFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDE70-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|\uD81B[\uDC00-\uDEFF\uDF45-\uDF4F\uDF7F-\uDF8E\uDFA0-\uDFFF]|\uD86E[\uDC1E\uDC1F]|\uD83D[\uDD7A\uDDA4\uDED1-\uDEDF\uDEED-\uDEEF\uDEF4-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD70-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8D-\uDD8F\uDD9C-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2F\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD869[\uDED7-\uDEFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|[\uDBBF\uDBFF][\uDFFE\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA4-\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD86D[\uDF35-\uDF3F]|[\uD807\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD81C-\uD82B\uD82D\uD82E\uD830-\uD833\uD837-\uD839\uD83F\uD874-\uD87D\uD87F-\uDB3F\uDB41-\uDB7F][\uDC00-\uDFFF]|\uD806[\uDC00-\uDC9F\uDCF3-\uDCFE\uDD00-\uDEBF\uDEF9-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD00-\uDE5F\uDE7F-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD805[\uDC00-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB8-\uDEBF\uDECA-\uDEFF\uDF1A-\uDF1C\uDF2C-\uDF2F\uDF40-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE34-\uDE37\uDE3B-\uDE3E\uDE48-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC70-\uDC7E\uDCC2-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD44-\uDD4F\uDD77-\uDD7F\uDDCE\uDDCF\uDDE0\uDDF5-\uDDFF\uDE12\uDE3E-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF3B\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD82C[\uDC02-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDD0F\uDD19-\uDD7F\uDD85-\uDDBF\uDDC1-\uDFFF]|\uD873[\uDEA2-\uDFFF]' + }, + { + name: 'Co', + alias: 'Private_Use', + bmp: '\uE000-\uF8FF', + astral: '[\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uDBBF\uDBFF][\uDC00-\uDFFD]' + }, + { + name: 'Cs', + alias: 'Surrogate', + bmp: '\uD800-\uDFFF' + }, + { + name: 'L', + alias: 'Letter', + bmp: 'A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC', + astral: '\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD83A[\uDC00-\uDCC4]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD80D[\uDC00-\uDC2E]|\uD87E[\uDC00-\uDE1D]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD809[\uDC80-\uDD43]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD808[\uDC00-\uDF99]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD811[\uDC00-\uDE46]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD82C[\uDC00\uDC01]|\uD873[\uDC00-\uDEA1]' + }, + { + name: 'Ll', + alias: 'Lowercase_Letter', + bmp: 'a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A', + astral: '\uD803[\uDCC0-\uDCF2]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD801[\uDC28-\uDC4F]|\uD806[\uDCC0-\uDCDF]' + }, + { + name: 'Lm', + alias: 'Modifier_Letter', + bmp: '\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E\uFF9F', + astral: '\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F]' + }, + { + name: 'Lo', + alias: 'Other_Letter', + bmp: '\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC', + astral: '\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD83A[\uDC00-\uDCC4]|\uD803[\uDC00-\uDC48]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD80D[\uDC00-\uDC2E]|\uD87E[\uDC00-\uDE1D]|\uD81B[\uDF00-\uDF44\uDF50]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCFF\uDEC0-\uDEF8]|\uD809[\uDC80-\uDD43]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD808[\uDC00-\uDF99]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD811[\uDC00-\uDE46]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD82C[\uDC00\uDC01]|\uD873[\uDC00-\uDEA1]' + }, + { + name: 'Lt', + alias: 'Titlecase_Letter', + bmp: '\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC' + }, + { + name: 'Lu', + alias: 'Uppercase_Letter', + bmp: 'A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A', + astral: '\uD806[\uDCA0-\uDCBF]|\uD803[\uDC80-\uDCB2]|\uD801[\uDC00-\uDC27]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]' + }, + { + name: 'M', + alias: 'Mark', + bmp: '\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F', + astral: '\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDCA-\uDDCC\uDE2C-\uDE37\uDEDF-\uDEEA\uDF00-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD82F[\uDC9D\uDC9E]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]' + }, + { + name: 'Mc', + alias: 'Spacing_Mark', + bmp: '\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BE-\u09C0\u09C7\u09C8\u09CB\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0D02\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2\u0DF3\u0F3E\u0F3F\u0F7F\u102B\u102C\u1031\u1038\u103B\u103C\u1056\u1057\u1062-\u1064\u1067-\u106D\u1083\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF2\u1CF3\u302E\u302F\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BD-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC', + astral: '\uD834[\uDD65\uDD66\uDD6D-\uDD72]|\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3E\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63]|\uD805[\uDCB0-\uDCB2\uDCB9\uDCBB-\uDCBE\uDCC1\uDDAF-\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF20\uDF21\uDF26]|\uD81B[\uDF51-\uDF7E]' + }, + { + name: 'Me', + alias: 'Enclosing_Mark', + bmp: '\u0488\u0489\u1ABE\u20DD-\u20E0\u20E2-\u20E4\uA670-\uA672' + }, + { + name: 'Mn', + alias: 'Nonspacing_Mark', + bmp: '\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D01\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F', + astral: '\uD805[\uDCB3-\uDCB8\uDCBA\uDCBF\uDCC0\uDCC2\uDCC3\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDCA-\uDDCC\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3C\uDF40\uDF66-\uDF6C\uDF70-\uDF74]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]' + }, + { + name: 'N', + alias: 'Number', + bmp: '0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19', + astral: '\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD803[\uDCFA-\uDCFF\uDE60-\uDE7E]|\uD835[\uDFCE-\uDFFF]|\uD83A[\uDCC7-\uDCCF]|\uD81A[\uDE60-\uDE69\uDF50-\uDF59\uDF5B-\uDF61]|\uD806[\uDCE0-\uDCF2]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD834[\uDF60-\uDF71]|\uD83C[\uDD00-\uDD0C]|\uD809[\uDC00-\uDC6E]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE47\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD805[\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]' + }, + { + name: 'Nd', + alias: 'Decimal_Number', + bmp: '0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19', + astral: '\uD801[\uDCA0-\uDCA9]|\uD835[\uDFCE-\uDFFF]|\uD805[\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCE0-\uDCE9]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|\uD81A[\uDE60-\uDE69\uDF50-\uDF59]' + }, + { + name: 'Nl', + alias: 'Letter_Number', + bmp: '\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF', + astral: '\uD809[\uDC00-\uDC6E]|\uD800[\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]' + }, + { + name: 'No', + alias: 'Other_Number', + bmp: '\xB2\xB3\xB9\xBC-\xBE\u09F4-\u09F9\u0B72-\u0B77\u0BF0-\u0BF2\u0C78-\u0C7E\u0D70-\u0D75\u0F2A-\u0F33\u1369-\u137C\u17F0-\u17F9\u19DA\u2070\u2074-\u2079\u2080-\u2089\u2150-\u215F\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA830-\uA835', + astral: '\uD804[\uDC52-\uDC65\uDDE1-\uDDF4]|\uD803[\uDCFA-\uDCFF\uDE60-\uDE7E]|\uD83C[\uDD00-\uDD0C]|\uD806[\uDCEA-\uDCF2]|\uD83A[\uDCC7-\uDCCF]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE47\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD805[\uDF3A\uDF3B]|\uD81A[\uDF5B-\uDF61]|\uD834[\uDF60-\uDF71]|\uD800[\uDD07-\uDD33\uDD75-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23]' + }, + { + name: 'P', + alias: 'Punctuation', + bmp: '\x21-\x23\x25-\\x2A\x2C-\x2F\x3A\x3B\\x3F\x40\\x5B-\\x5D\x5F\\x7B\x7D\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65', + astral: '\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD809[\uDC70-\uDC74]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD836[\uDE87-\uDE8B]|\uD801\uDD6F|\uD82F\uDC9F|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]' + }, + { + name: 'Pc', + alias: 'Connector_Punctuation', + bmp: '\x5F\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F' + }, + { + name: 'Pd', + alias: 'Dash_Punctuation', + bmp: '\\x2D\u058A\u05BE\u1400\u1806\u2010-\u2015\u2E17\u2E1A\u2E3A\u2E3B\u2E40\u301C\u3030\u30A0\uFE31\uFE32\uFE58\uFE63\uFF0D' + }, + { + name: 'Pe', + alias: 'Close_Punctuation', + bmp: '\\x29\\x5D\x7D\u0F3B\u0F3D\u169C\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E23\u2E25\u2E27\u2E29\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63' + }, + { + name: 'Pf', + alias: 'Final_Punctuation', + bmp: '\xBB\u2019\u201D\u203A\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21' + }, + { + name: 'Pi', + alias: 'Initial_Punctuation', + bmp: '\xAB\u2018\u201B\u201C\u201F\u2039\u2E02\u2E04\u2E09\u2E0C\u2E1C\u2E20' + }, + { + name: 'Po', + alias: 'Other_Punctuation', + bmp: '\x21-\x23\x25-\x27\\x2A\x2C\\x2E\x2F\x3A\x3B\\x3F\x40\\x5C\xA1\xA7\xB6\xB7\xBF\u037E\u0387\u055A-\u055F\u0589\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u166D\u166E\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u1805\u1807-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2016\u2017\u2020-\u2027\u2030-\u2038\u203B-\u203E\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205E\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00\u2E01\u2E06-\u2E08\u2E0B\u2E0E-\u2E16\u2E18\u2E19\u2E1B\u2E1E\u2E1F\u2E2A-\u2E2E\u2E30-\u2E39\u2E3C-\u2E3F\u2E41\u3001-\u3003\u303D\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFE10-\uFE16\uFE19\uFE30\uFE45\uFE46\uFE49-\uFE4C\uFE50-\uFE52\uFE54-\uFE57\uFE5F-\uFE61\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF07\uFF0A\uFF0C\uFF0E\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3C\uFF61\uFF64\uFF65', + astral: '\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD809[\uDC70-\uDC74]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD836[\uDE87-\uDE8B]|\uD801\uDD6F|\uD82F\uDC9F|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]' + }, + { + name: 'Ps', + alias: 'Open_Punctuation', + bmp: '\\x28\\x5B\\x7B\u0F3A\u0F3C\u169B\u201A\u201E\u2045\u207D\u208D\u2308\u230A\u2329\u2768\u276A\u276C\u276E\u2770\u2772\u2774\u27C5\u27E6\u27E8\u27EA\u27EC\u27EE\u2983\u2985\u2987\u2989\u298B\u298D\u298F\u2991\u2993\u2995\u2997\u29D8\u29DA\u29FC\u2E22\u2E24\u2E26\u2E28\u2E42\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\u301D\uFD3F\uFE17\uFE35\uFE37\uFE39\uFE3B\uFE3D\uFE3F\uFE41\uFE43\uFE47\uFE59\uFE5B\uFE5D\uFF08\uFF3B\uFF5B\uFF5F\uFF62' + }, + { + name: 'S', + alias: 'Symbol', + bmp: '\\x24\\x2B\x3C-\x3E\\x5E\x60\\x7C\x7E\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BE\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u23FA\u2400-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B98-\u2BB9\u2BBD-\u2BC8\u2BCA-\u2BD1\u2BEC-\u2BEF\u2CE5-\u2CEA\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u32FE\u3300-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD', + astral: '\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDD10-\uDD18\uDD80-\uDD84\uDDC0]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD10-\uDD2E\uDD30-\uDD6B\uDD70-\uDD9A\uDDE6-\uDE02\uDE10-\uDE3A\uDE40-\uDE48\uDE50\uDE51\uDF00-\uDFFF]|\uD83D[\uDC00-\uDD79\uDD7B-\uDDA3\uDDA5-\uDED0\uDEE0-\uDEEC\uDEF0-\uDEF3\uDF00-\uDF73\uDF80-\uDFD4]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C\uDD90-\uDD9B\uDDA0\uDDD0-\uDDFC]|\uD82F\uDC9C|\uD805\uDF3F|\uD802[\uDC77\uDC78\uDEC8]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD83B[\uDEF0\uDEF1]' + }, + { + name: 'Sc', + alias: 'Currency_Symbol', + bmp: '\\x24\xA2-\xA5\u058F\u060B\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20BE\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6' + }, + { + name: 'Sk', + alias: 'Modifier_Symbol', + bmp: '\\x5E\x60\xA8\xAF\xB4\xB8\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u309B\u309C\uA700-\uA716\uA720\uA721\uA789\uA78A\uAB5B\uFBB2-\uFBC1\uFF3E\uFF40\uFFE3', + astral: '\uD83C[\uDFFB-\uDFFF]' + }, + { + name: 'Sm', + alias: 'Math_Symbol', + bmp: '\\x2B\x3C-\x3E\\x7C\x7E\xAC\xB1\xD7\xF7\u03F6\u0606-\u0608\u2044\u2052\u207A-\u207C\u208A-\u208C\u2118\u2140-\u2144\u214B\u2190-\u2194\u219A\u219B\u21A0\u21A3\u21A6\u21AE\u21CE\u21CF\u21D2\u21D4\u21F4-\u22FF\u2320\u2321\u237C\u239B-\u23B3\u23DC-\u23E1\u25B7\u25C1\u25F8-\u25FF\u266F\u27C0-\u27C4\u27C7-\u27E5\u27F0-\u27FF\u2900-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2AFF\u2B30-\u2B44\u2B47-\u2B4C\uFB29\uFE62\uFE64-\uFE66\uFF0B\uFF1C-\uFF1E\uFF5C\uFF5E\uFFE2\uFFE9-\uFFEC', + astral: '\uD83B[\uDEF0\uDEF1]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]' + }, + { + name: 'So', + alias: 'Other_Symbol', + bmp: '\xA6\xA9\xAE\xB0\u0482\u058D\u058E\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u09FA\u0B70\u0BF3-\u0BF8\u0BFA\u0C7F\u0D79\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116\u2117\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u214A\u214C\u214D\u214F\u218A\u218B\u2195-\u2199\u219C-\u219F\u21A1\u21A2\u21A4\u21A5\u21A7-\u21AD\u21AF-\u21CD\u21D0\u21D1\u21D3\u21D5-\u21F3\u2300-\u2307\u230C-\u231F\u2322-\u2328\u232B-\u237B\u237D-\u239A\u23B4-\u23DB\u23E2-\u23FA\u2400-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u25B6\u25B8-\u25C0\u25C2-\u25F7\u2600-\u266E\u2670-\u2767\u2794-\u27BF\u2800-\u28FF\u2B00-\u2B2F\u2B45\u2B46\u2B4D-\u2B73\u2B76-\u2B95\u2B98-\u2BB9\u2BBD-\u2BC8\u2BCA-\u2BD1\u2BEC-\u2BEF\u2CE5-\u2CEA\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u32FE\u3300-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA828-\uA82B\uA836\uA837\uA839\uAA77-\uAA79\uFDFD\uFFE4\uFFE8\uFFED\uFFEE\uFFFC\uFFFD', + astral: '\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDD10-\uDD18\uDD80-\uDD84\uDDC0]|\uD83D[\uDC00-\uDD79\uDD7B-\uDDA3\uDDA5-\uDED0\uDEE0-\uDEEC\uDEF0-\uDEF3\uDF00-\uDF73\uDF80-\uDFD4]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD10-\uDD2E\uDD30-\uDD6B\uDD70-\uDD9A\uDDE6-\uDE02\uDE10-\uDE3A\uDE40-\uDE48\uDE50\uDE51\uDF00-\uDFFA]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C\uDD90-\uDD9B\uDDA0\uDDD0-\uDDFC]|\uD82F\uDC9C|\uD805\uDF3F|\uD802[\uDC77\uDC78\uDEC8]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]' + }, + { + name: 'Z', + alias: 'Separator', + bmp: '\x20\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000' + }, + { + name: 'Zl', + alias: 'Line_Separator', + bmp: '\u2028' + }, + { + name: 'Zp', + alias: 'Paragraph_Separator', + bmp: '\u2029' + }, + { + name: 'Zs', + alias: 'Space_Separator', + bmp: '\x20\xA0\u1680\u2000-\u200A\u202F\u205F\u3000' + } + ]); + +}; diff --git a/tools/eslint/node_modules/xregexp/src/addons/unicode-properties.js b/tools/eslint/node_modules/xregexp/src/addons/unicode-properties.js new file mode 100644 index 00000000000000..92a041b4f85839 --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/addons/unicode-properties.js @@ -0,0 +1,105 @@ +/*! + * XRegExp Unicode Properties 3.1.0 + * + * Steven Levithan (c) 2012-2016 MIT License + * Unicode data by Mathias Bynens + */ + +/** + * Adds properties to meet the UTS #18 Level 1 RL1.2 requirements for Unicode regex support. See + * . Following are definitions of these properties from UAX + * #44 : + * + * - Alphabetic + * Characters with the Alphabetic property. Generated from: Lowercase + Uppercase + Lt + Lm + Lo + + * Nl + Other_Alphabetic. + * + * - Default_Ignorable_Code_Point + * For programmatic determination of default ignorable code points. New characters that should be + * ignored in rendering (unless explicitly supported) will be assigned in these ranges, permitting + * programs to correctly handle the default rendering of such characters when not otherwise + * supported. + * + * - Lowercase + * Characters with the Lowercase property. Generated from: Ll + Other_Lowercase. + * + * - Noncharacter_Code_Point + * Code points permanently reserved for internal use. + * + * - Uppercase + * Characters with the Uppercase property. Generated from: Lu + Other_Uppercase. + * + * - White_Space + * Spaces, separator characters and other control characters which should be treated by + * programming languages as "white space" for the purpose of parsing elements. + * + * The properties ASCII, Any, and Assigned are also included but are not defined in UAX #44. UTS #18 + * RL1.2 additionally requires support for Unicode scripts and general categories. These are + * included in XRegExp's Unicode Categories and Unicode Scripts addons. + * + * Token names are case insensitive, and any spaces, hyphens, and underscores are ignored. + * + * Uses Unicode 8.0.0. + * + * @requires XRegExp, Unicode Base + */ +module.exports = function(XRegExp) { + 'use strict'; + + if (!XRegExp.addUnicodeData) { + throw new ReferenceError('Unicode Base must be loaded before Unicode Properties'); + } + + var unicodeData = [ + { + name: 'ASCII', + bmp: '\0-\x7F' + }, + { + name: 'Alphabetic', + bmp: 'A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u065F\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06EF\u06FA-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u08A0-\u08B4\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09F0\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A70-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4C\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCC\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D57\u0D5F-\u0D63\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F81\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u103F\u1050-\u1062\u1065-\u1068\u106E-\u1086\u108E\u109C\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1713\u1720-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1AA7\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4B\u1B80-\u1BA9\u1BAC-\u1BAF\u1BBA-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C35\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1D00-\u1DBF\u1DE7-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u24B6-\u24E9\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA827\uA840-\uA873\uA880-\uA8C3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA60-\uAA76\uAA7A\uAA7E-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC', + astral: '\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD804[\uDC00-\uDC45\uDC82-\uDCB8\uDCD0-\uDCE8\uDD00-\uDD32\uDD50-\uDD72\uDD76\uDD80-\uDDBF\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE34\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEE8\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D-\uDF44\uDF47\uDF48\uDF4B\uDF4C\uDF50\uDF57\uDF5D-\uDF63]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD83A[\uDC00-\uDCC4]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF36\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD80D[\uDC00-\uDC2E]|\uD87E[\uDC00-\uDE1D]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9E]|\uD808[\uDC00-\uDF99]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD805[\uDC80-\uDCC1\uDCC4\uDCC5\uDCC7\uDD80-\uDDB5\uDDB8-\uDDBE\uDDD8-\uDDDD\uDE00-\uDE3E\uDE40\uDE44\uDE80-\uDEB5\uDF00-\uDF19\uDF1D-\uDF2A]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD811[\uDC00-\uDE46]|\uD82C[\uDC00\uDC01]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF93-\uDF9F]|\uD873[\uDC00-\uDEA1]' + }, + { + name: 'Any', + isBmpLast: true, + bmp: '\0-\uFFFF', + astral: '[\uD800-\uDBFF][\uDC00-\uDFFF]' + }, + { + name: 'Default_Ignorable_Code_Point', + bmp: '\xAD\u034F\u061C\u115F\u1160\u17B4\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8', + astral: '[\uDB40-\uDB43][\uDC00-\uDFFF]|\uD834[\uDD73-\uDD7A]|\uD82F[\uDCA0-\uDCA3]' + }, + { + name: 'Lowercase', + bmp: 'a-z\xAA\xB5\xBA\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02B8\u02C0\u02C1\u02E0-\u02E4\u0345\u0371\u0373\u0377\u037A-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1D00-\u1DBF\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u2071\u207F\u2090-\u209C\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2170-\u217F\u2184\u24D0-\u24E9\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7D\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B-\uA69D\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7F8-\uA7FA\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A', + astral: '\uD803[\uDCC0-\uDCF2]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD801[\uDC28-\uDC4F]|\uD806[\uDCC0-\uDCDF]' + }, + { + name: 'Noncharacter_Code_Point', + bmp: '\uFDD0-\uFDEF\uFFFE\uFFFF', + astral: '[\uDB3F\uDB7F\uDBBF\uDBFF\uD83F\uD87F\uD8BF\uDAFF\uD97F\uD9BF\uD9FF\uDA3F\uD8FF\uDABF\uDA7F\uD93F][\uDFFE\uDFFF]' + }, + { + name: 'Uppercase', + bmp: 'A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2160-\u216F\u2183\u24B6-\u24CF\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A', + astral: '\uD806[\uDCA0-\uDCBF]|\uD803[\uDC80-\uDCB2]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD801[\uDC00-\uDC27]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]' + }, + { + name: 'White_Space', + bmp: '\x09-\x0D\x20\x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000' + } + ]; + + // Add non-generated data + unicodeData.push({ + name: 'Assigned', + // Since this is defined as the inverse of Unicode category Cn (Unassigned), the Unicode + // Categories addon is required to use this property + inverseOf: 'Cn' + }); + + XRegExp.addUnicodeData(unicodeData); + +}; diff --git a/tools/eslint/node_modules/xregexp/src/addons/unicode-scripts.js b/tools/eslint/node_modules/xregexp/src/addons/unicode-scripts.js new file mode 100644 index 00000000000000..bb28ec36a09b31 --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/addons/unicode-scripts.js @@ -0,0 +1,559 @@ +/*! + * XRegExp Unicode Scripts 3.1.0 + * + * Steven Levithan (c) 2010-2016 MIT License + * Unicode data by Mathias Bynens + */ + +/** + * Adds support for all Unicode scripts. E.g., `\p{Latin}`. Token names are case insensitive, and + * any spaces, hyphens, and underscores are ignored. + * + * Uses Unicode 8.0.0. + * + * @requires XRegExp, Unicode Base + */ +module.exports = function(XRegExp) { + 'use strict'; + + if (!XRegExp.addUnicodeData) { + throw new ReferenceError('Unicode Base must be loaded before Unicode Scripts'); + } + + XRegExp.addUnicodeData([ + { + name: 'Ahom', + astral: '\uD805[\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF3F]' + }, + { + name: 'Anatolian_Hieroglyphs', + astral: '\uD811[\uDC00-\uDE46]' + }, + { + name: 'Arabic', + bmp: '\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u06FF\u0750-\u077F\u08A0-\u08B4\u08E3-\u08FF\uFB50-\uFBC1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFD\uFE70-\uFE74\uFE76-\uFEFC', + astral: '\uD803[\uDE60-\uDE7E]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]' + }, + { + name: 'Armenian', + bmp: '\u0531-\u0556\u0559-\u055F\u0561-\u0587\u058A\u058D-\u058F\uFB13-\uFB17' + }, + { + name: 'Avestan', + astral: '\uD802[\uDF00-\uDF35\uDF39-\uDF3F]' + }, + { + name: 'Balinese', + bmp: '\u1B00-\u1B4B\u1B50-\u1B7C' + }, + { + name: 'Bamum', + bmp: '\uA6A0-\uA6F7', + astral: '\uD81A[\uDC00-\uDE38]' + }, + { + name: 'Bassa_Vah', + astral: '\uD81A[\uDED0-\uDEED\uDEF0-\uDEF5]' + }, + { + name: 'Batak', + bmp: '\u1BC0-\u1BF3\u1BFC-\u1BFF' + }, + { + name: 'Bengali', + bmp: '\u0980-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FB' + }, + { + name: 'Bopomofo', + bmp: '\u02EA\u02EB\u3105-\u312D\u31A0-\u31BA' + }, + { + name: 'Brahmi', + astral: '\uD804[\uDC00-\uDC4D\uDC52-\uDC6F\uDC7F]' + }, + { + name: 'Braille', + bmp: '\u2800-\u28FF' + }, + { + name: 'Buginese', + bmp: '\u1A00-\u1A1B\u1A1E\u1A1F' + }, + { + name: 'Buhid', + bmp: '\u1740-\u1753' + }, + { + name: 'Canadian_Aboriginal', + bmp: '\u1400-\u167F\u18B0-\u18F5' + }, + { + name: 'Carian', + astral: '\uD800[\uDEA0-\uDED0]' + }, + { + name: 'Caucasian_Albanian', + astral: '\uD801[\uDD30-\uDD63\uDD6F]' + }, + { + name: 'Chakma', + astral: '\uD804[\uDD00-\uDD34\uDD36-\uDD43]' + }, + { + name: 'Cham', + bmp: '\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA5C-\uAA5F' + }, + { + name: 'Cherokee', + bmp: '\u13A0-\u13F5\u13F8-\u13FD\uAB70-\uABBF' + }, + { + name: 'Common', + bmp: '\0-\x40\\x5B-\x60\\x7B-\xA9\xAB-\xB9\xBB-\xBF\xD7\xF7\u02B9-\u02DF\u02E5-\u02E9\u02EC-\u02FF\u0374\u037E\u0385\u0387\u0589\u0605\u060C\u061B\u061C\u061F\u0640\u06DD\u0964\u0965\u0E3F\u0FD5-\u0FD8\u10FB\u16EB-\u16ED\u1735\u1736\u1802\u1803\u1805\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u2000-\u200B\u200E-\u2064\u2066-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u20BE\u2100-\u2125\u2127-\u2129\u212C-\u2131\u2133-\u214D\u214F-\u215F\u2189-\u218B\u2190-\u23FA\u2400-\u2426\u2440-\u244A\u2460-\u27FF\u2900-\u2B73\u2B76-\u2B95\u2B98-\u2BB9\u2BBD-\u2BC8\u2BCA-\u2BD1\u2BEC-\u2BEF\u2E00-\u2E42\u2FF0-\u2FFB\u3000-\u3004\u3006\u3008-\u3020\u3030-\u3037\u303C-\u303F\u309B\u309C\u30A0\u30FB\u30FC\u3190-\u319F\u31C0-\u31E3\u3220-\u325F\u327F-\u32CF\u3358-\u33FF\u4DC0-\u4DFF\uA700-\uA721\uA788-\uA78A\uA830-\uA839\uA92E\uA9CF\uAB5B\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFEFF\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFF70\uFF9E\uFF9F\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD', + astral: '\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDD10-\uDD18\uDD80-\uDD84\uDDC0]|\uD82F[\uDCA0-\uDCA3]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDFCB\uDFCE-\uDFFF]|\uDB40[\uDC01\uDC20-\uDC7F]|\uD83D[\uDC00-\uDD79\uDD7B-\uDDA3\uDDA5-\uDED0\uDEE0-\uDEEC\uDEF0-\uDEF3\uDF00-\uDF73\uDF80-\uDFD4]|\uD800[\uDD00-\uDD02\uDD07-\uDD33\uDD37-\uDD3F\uDD90-\uDD9B\uDDD0-\uDDFC\uDEE1-\uDEFB]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD66\uDD6A-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDF00-\uDF56\uDF60-\uDF71]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD00-\uDD0C\uDD10-\uDD2E\uDD30-\uDD6B\uDD70-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE10-\uDE3A\uDE40-\uDE48\uDE50\uDE51\uDF00-\uDFFF]' + }, + { + name: 'Coptic', + bmp: '\u03E2-\u03EF\u2C80-\u2CF3\u2CF9-\u2CFF' + }, + { + name: 'Cuneiform', + astral: '\uD809[\uDC00-\uDC6E\uDC70-\uDC74\uDC80-\uDD43]|\uD808[\uDC00-\uDF99]' + }, + { + name: 'Cypriot', + astral: '\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F]' + }, + { + name: 'Cyrillic', + bmp: '\u0400-\u0484\u0487-\u052F\u1D2B\u1D78\u2DE0-\u2DFF\uA640-\uA69F\uFE2E\uFE2F' + }, + { + name: 'Deseret', + astral: '\uD801[\uDC00-\uDC4F]' + }, + { + name: 'Devanagari', + bmp: '\u0900-\u0950\u0953-\u0963\u0966-\u097F\uA8E0-\uA8FD' + }, + { + name: 'Duployan', + astral: '\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]' + }, + { + name: 'Egyptian_Hieroglyphs', + astral: '\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]' + }, + { + name: 'Elbasan', + astral: '\uD801[\uDD00-\uDD27]' + }, + { + name: 'Ethiopic', + bmp: '\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u137C\u1380-\u1399\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E' + }, + { + name: 'Georgian', + bmp: '\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u10FF\u2D00-\u2D25\u2D27\u2D2D' + }, + { + name: 'Glagolitic', + bmp: '\u2C00-\u2C2E\u2C30-\u2C5E' + }, + { + name: 'Gothic', + astral: '\uD800[\uDF30-\uDF4A]' + }, + { + name: 'Grantha', + astral: '\uD804[\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]' + }, + { + name: 'Greek', + bmp: '\u0370-\u0373\u0375-\u0377\u037A-\u037D\u037F\u0384\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03E1\u03F0-\u03FF\u1D26-\u1D2A\u1D5D-\u1D61\u1D66-\u1D6A\u1DBF\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u2126\uAB65', + astral: '\uD800[\uDD40-\uDD8C\uDDA0]|\uD834[\uDE00-\uDE45]' + }, + { + name: 'Gujarati', + bmp: '\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9' + }, + { + name: 'Gurmukhi', + bmp: '\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75' + }, + { + name: 'Han', + bmp: '\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DB5\u4E00-\u9FD5\uF900-\uFA6D\uFA70-\uFAD9', + astral: '\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD87E[\uDC00-\uDE1D]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD873[\uDC00-\uDEA1]' + }, + { + name: 'Hangul', + bmp: '\u1100-\u11FF\u302E\u302F\u3131-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC' + }, + { + name: 'Hanunoo', + bmp: '\u1720-\u1734' + }, + { + name: 'Hatran', + astral: '\uD802[\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDCFF]' + }, + { + name: 'Hebrew', + bmp: '\u0591-\u05C7\u05D0-\u05EA\u05F0-\u05F4\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4F' + }, + { + name: 'Hiragana', + bmp: '\u3041-\u3096\u309D-\u309F', + astral: '\uD82C\uDC01|\uD83C\uDE00' + }, + { + name: 'Imperial_Aramaic', + astral: '\uD802[\uDC40-\uDC55\uDC57-\uDC5F]' + }, + { + name: 'Inherited', + bmp: '\u0300-\u036F\u0485\u0486\u064B-\u0655\u0670\u0951\u0952\u1AB0-\u1ABE\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C\u200D\u20D0-\u20F0\u302A-\u302D\u3099\u309A\uFE00-\uFE0F\uFE20-\uFE2D', + astral: '\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD800[\uDDFD\uDEE0]|\uDB40[\uDD00-\uDDEF]' + }, + { + name: 'Inscriptional_Pahlavi', + astral: '\uD802[\uDF60-\uDF72\uDF78-\uDF7F]' + }, + { + name: 'Inscriptional_Parthian', + astral: '\uD802[\uDF40-\uDF55\uDF58-\uDF5F]' + }, + { + name: 'Javanese', + bmp: '\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE\uA9DF' + }, + { + name: 'Kaithi', + astral: '\uD804[\uDC80-\uDCC1]' + }, + { + name: 'Kannada', + bmp: '\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2' + }, + { + name: 'Katakana', + bmp: '\u30A1-\u30FA\u30FD-\u30FF\u31F0-\u31FF\u32D0-\u32FE\u3300-\u3357\uFF66-\uFF6F\uFF71-\uFF9D', + astral: '\uD82C\uDC00' + }, + { + name: 'Kayah_Li', + bmp: '\uA900-\uA92D\uA92F' + }, + { + name: 'Kharoshthi', + astral: '\uD802[\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F-\uDE47\uDE50-\uDE58]' + }, + { + name: 'Khmer', + bmp: '\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u19E0-\u19FF' + }, + { + name: 'Khojki', + astral: '\uD804[\uDE00-\uDE11\uDE13-\uDE3D]' + }, + { + name: 'Khudawadi', + astral: '\uD804[\uDEB0-\uDEEA\uDEF0-\uDEF9]' + }, + { + name: 'Lao', + bmp: '\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF' + }, + { + name: 'Latin', + bmp: 'A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A' + }, + { + name: 'Lepcha', + bmp: '\u1C00-\u1C37\u1C3B-\u1C49\u1C4D-\u1C4F' + }, + { + name: 'Limbu', + bmp: '\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1940\u1944-\u194F' + }, + { + name: 'Linear_A', + astral: '\uD801[\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]' + }, + { + name: 'Linear_B', + astral: '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA]' + }, + { + name: 'Lisu', + bmp: '\uA4D0-\uA4FF' + }, + { + name: 'Lycian', + astral: '\uD800[\uDE80-\uDE9C]' + }, + { + name: 'Lydian', + astral: '\uD802[\uDD20-\uDD39\uDD3F]' + }, + { + name: 'Mahajani', + astral: '\uD804[\uDD50-\uDD76]' + }, + { + name: 'Malayalam', + bmp: '\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D75\u0D79-\u0D7F' + }, + { + name: 'Mandaic', + bmp: '\u0840-\u085B\u085E' + }, + { + name: 'Manichaean', + astral: '\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6]' + }, + { + name: 'Meetei_Mayek', + bmp: '\uAAE0-\uAAF6\uABC0-\uABED\uABF0-\uABF9' + }, + { + name: 'Mende_Kikakui', + astral: '\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6]' + }, + { + name: 'Meroitic_Cursive', + astral: '\uD802[\uDDA0-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDDFF]' + }, + { + name: 'Meroitic_Hieroglyphs', + astral: '\uD802[\uDD80-\uDD9F]' + }, + { + name: 'Miao', + astral: '\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]' + }, + { + name: 'Modi', + astral: '\uD805[\uDE00-\uDE44\uDE50-\uDE59]' + }, + { + name: 'Mongolian', + bmp: '\u1800\u1801\u1804\u1806-\u180E\u1810-\u1819\u1820-\u1877\u1880-\u18AA' + }, + { + name: 'Mro', + astral: '\uD81A[\uDE40-\uDE5E\uDE60-\uDE69\uDE6E\uDE6F]' + }, + { + name: 'Multani', + astral: '\uD804[\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA9]' + }, + { + name: 'Myanmar', + bmp: '\u1000-\u109F\uA9E0-\uA9FE\uAA60-\uAA7F' + }, + { + name: 'Nabataean', + astral: '\uD802[\uDC80-\uDC9E\uDCA7-\uDCAF]' + }, + { + name: 'New_Tai_Lue', + bmp: '\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u19DE\u19DF' + }, + { + name: 'Nko', + bmp: '\u07C0-\u07FA' + }, + { + name: 'Ogham', + bmp: '\u1680-\u169C' + }, + { + name: 'Ol_Chiki', + bmp: '\u1C50-\u1C7F' + }, + { + name: 'Old_Hungarian', + astral: '\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDCFF]' + }, + { + name: 'Old_Italic', + astral: '\uD800[\uDF00-\uDF23]' + }, + { + name: 'Old_North_Arabian', + astral: '\uD802[\uDE80-\uDE9F]' + }, + { + name: 'Old_Permic', + astral: '\uD800[\uDF50-\uDF7A]' + }, + { + name: 'Old_Persian', + astral: '\uD800[\uDFA0-\uDFC3\uDFC8-\uDFD5]' + }, + { + name: 'Old_South_Arabian', + astral: '\uD802[\uDE60-\uDE7F]' + }, + { + name: 'Old_Turkic', + astral: '\uD803[\uDC00-\uDC48]' + }, + { + name: 'Oriya', + bmp: '\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B77' + }, + { + name: 'Osmanya', + astral: '\uD801[\uDC80-\uDC9D\uDCA0-\uDCA9]' + }, + { + name: 'Pahawh_Hmong', + astral: '\uD81A[\uDF00-\uDF45\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]' + }, + { + name: 'Palmyrene', + astral: '\uD802[\uDC60-\uDC7F]' + }, + { + name: 'Pau_Cin_Hau', + astral: '\uD806[\uDEC0-\uDEF8]' + }, + { + name: 'Phags_Pa', + bmp: '\uA840-\uA877' + }, + { + name: 'Phoenician', + astral: '\uD802[\uDD00-\uDD1B\uDD1F]' + }, + { + name: 'Psalter_Pahlavi', + astral: '\uD802[\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]' + }, + { + name: 'Rejang', + bmp: '\uA930-\uA953\uA95F' + }, + { + name: 'Runic', + bmp: '\u16A0-\u16EA\u16EE-\u16F8' + }, + { + name: 'Samaritan', + bmp: '\u0800-\u082D\u0830-\u083E' + }, + { + name: 'Saurashtra', + bmp: '\uA880-\uA8C4\uA8CE-\uA8D9' + }, + { + name: 'Sharada', + astral: '\uD804[\uDD80-\uDDCD\uDDD0-\uDDDF]' + }, + { + name: 'Shavian', + astral: '\uD801[\uDC50-\uDC7F]' + }, + { + name: 'Siddham', + astral: '\uD805[\uDD80-\uDDB5\uDDB8-\uDDDD]' + }, + { + name: 'SignWriting', + astral: '\uD836[\uDC00-\uDE8B\uDE9B-\uDE9F\uDEA1-\uDEAF]' + }, + { + name: 'Sinhala', + bmp: '\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4', + astral: '\uD804[\uDDE1-\uDDF4]' + }, + { + name: 'Sora_Sompeng', + astral: '\uD804[\uDCD0-\uDCE8\uDCF0-\uDCF9]' + }, + { + name: 'Sundanese', + bmp: '\u1B80-\u1BBF\u1CC0-\u1CC7' + }, + { + name: 'Syloti_Nagri', + bmp: '\uA800-\uA82B' + }, + { + name: 'Syriac', + bmp: '\u0700-\u070D\u070F-\u074A\u074D-\u074F' + }, + { + name: 'Tagalog', + bmp: '\u1700-\u170C\u170E-\u1714' + }, + { + name: 'Tagbanwa', + bmp: '\u1760-\u176C\u176E-\u1770\u1772\u1773' + }, + { + name: 'Tai_Le', + bmp: '\u1950-\u196D\u1970-\u1974' + }, + { + name: 'Tai_Tham', + bmp: '\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD' + }, + { + name: 'Tai_Viet', + bmp: '\uAA80-\uAAC2\uAADB-\uAADF' + }, + { + name: 'Takri', + astral: '\uD805[\uDE80-\uDEB7\uDEC0-\uDEC9]' + }, + { + name: 'Tamil', + bmp: '\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BFA' + }, + { + name: 'Telugu', + bmp: '\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C78-\u0C7F' + }, + { + name: 'Thaana', + bmp: '\u0780-\u07B1' + }, + { + name: 'Thai', + bmp: '\u0E01-\u0E3A\u0E40-\u0E5B' + }, + { + name: 'Tibetan', + bmp: '\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA' + }, + { + name: 'Tifinagh', + bmp: '\u2D30-\u2D67\u2D6F\u2D70\u2D7F' + }, + { + name: 'Tirhuta', + astral: '\uD805[\uDC80-\uDCC7\uDCD0-\uDCD9]' + }, + { + name: 'Ugaritic', + astral: '\uD800[\uDF80-\uDF9D\uDF9F]' + }, + { + name: 'Vai', + bmp: '\uA500-\uA62B' + }, + { + name: 'Warang_Citi', + astral: '\uD806[\uDCA0-\uDCF2\uDCFF]' + }, + { + name: 'Yi', + bmp: '\uA000-\uA48C\uA490-\uA4C6' + } + ]); + +}; diff --git a/tools/eslint/node_modules/xregexp/src/index.js b/tools/eslint/node_modules/xregexp/src/index.js new file mode 100644 index 00000000000000..0d0bd455aaed5b --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/index.js @@ -0,0 +1,11 @@ +var XRegExp = require('./xregexp'); + +require('./addons/build')(XRegExp); +require('./addons/matchrecursive')(XRegExp); +require('./addons/unicode-base')(XRegExp); +require('./addons/unicode-blocks')(XRegExp); +require('./addons/unicode-categories')(XRegExp); +require('./addons/unicode-properties')(XRegExp); +require('./addons/unicode-scripts')(XRegExp); + +module.exports = XRegExp; diff --git a/tools/eslint/node_modules/xregexp/src/xregexp.js b/tools/eslint/node_modules/xregexp/src/xregexp.js new file mode 100644 index 00000000000000..91c60b640660f6 --- /dev/null +++ b/tools/eslint/node_modules/xregexp/src/xregexp.js @@ -0,0 +1,1871 @@ +/*! + * XRegExp 3.1.0 + * + * Steven Levithan (c) 2007-2016 MIT License + */ + +/** + * XRegExp provides augmented, extensible regular expressions. You get additional regex syntax and + * flags, beyond what browsers support natively. XRegExp is also a regex utility belt with tools to + * make your client-side grepping simpler and more powerful, while freeing you from related + * cross-browser inconsistencies. + */ + + 'use strict'; + +/* ============================== + * Private stuff + * ============================== */ + + // Property name used for extended regex instance data + var REGEX_DATA = 'xregexp'; + // Optional features that can be installed and uninstalled + var features = { + astral: false, + natives: false + }; + // Native methods to use and restore ('native' is an ES3 reserved keyword) + var nativ = { + exec: RegExp.prototype.exec, + test: RegExp.prototype.test, + match: String.prototype.match, + replace: String.prototype.replace, + split: String.prototype.split + }; + // Storage for fixed/extended native methods + var fixed = {}; + // Storage for regexes cached by `XRegExp.cache` + var regexCache = {}; + // Storage for pattern details cached by the `XRegExp` constructor + var patternCache = {}; + // Storage for regex syntax tokens added internally or by `XRegExp.addToken` + var tokens = []; + // Token scopes + var defaultScope = 'default'; + var classScope = 'class'; + // Regexes that match native regex syntax, including octals + var nativeTokens = { + // Any native multicharacter token in default scope, or any single character + 'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/, + // Any native multicharacter token in character class scope, or any single character + 'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/ + }; + // Any backreference or dollar-prefixed character in replacement strings + var replacementToken = /\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g; + // Check for correct `exec` handling of nonparticipating capturing groups + var correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined; + // Check for ES6 `flags` prop support + var hasFlagsProp = /x/.flags !== undefined; + // Shortcut to `Object.prototype.toString` + var toString = {}.toString; + + function hasNativeFlag(flag) { + // Can't check based on the presense of properties/getters since + // browsers might support such properties even when don't support the + // corresponding flag in regex construction (tested in Chrome 48, where + // `'unicode' in /x/` is true but trying to construct a regex with flag + // `u` throws an error). + var isSupported = true; + try { + new RegExp('', flag); + } catch (exception) { + isSupported = false; + } + return isSupported; + } + // Check for ES6 `u` flag support + var hasNativeU = hasNativeFlag('u'); + // Check for ES6 `y` flag support + var hasNativeY = hasNativeFlag('y'); + // Tracker for known flags, including addon flags + var registeredFlags = { + g: true, + i: true, + m: true, + u: hasNativeU, + y: hasNativeY + }; + +/** + * Attaches extended data and `XRegExp.prototype` properties to a regex object. + * + * @private + * @param {RegExp} regex Regex to augment. + * @param {Array} captureNames Array with capture names, or `null`. + * @param {String} xSource XRegExp pattern used to generate `regex`, or `null` if N/A. + * @param {String} xFlags XRegExp flags used to generate `regex`, or `null` if N/A. + * @param {Boolean} [isInternalOnly=false] Whether the regex will be used only for internal + * operations, and never exposed to users. For internal-only regexes, we can improve perf by + * skipping some operations like attaching `XRegExp.prototype` properties. + * @returns {RegExp} Augmented regex. + */ + function augment(regex, captureNames, xSource, xFlags, isInternalOnly) { + var p; + + regex[REGEX_DATA] = { + captureNames: captureNames + }; + + if (isInternalOnly) { + return regex; + } + + // Can't auto-inherit these since the XRegExp constructor returns a nonprimitive value + if (regex.__proto__) { + regex.__proto__ = XRegExp.prototype; + } else { + for (p in XRegExp.prototype) { + // An `XRegExp.prototype.hasOwnProperty(p)` check wouldn't be worth it here, since + // this is performance sensitive, and enumerable `Object.prototype` or + // `RegExp.prototype` extensions exist on `regex.prototype` anyway + regex[p] = XRegExp.prototype[p]; + } + } + + regex[REGEX_DATA].source = xSource; + // Emulate the ES6 `flags` prop by ensuring flags are in alphabetical order + regex[REGEX_DATA].flags = xFlags ? xFlags.split('').sort().join('') : xFlags; + + return regex; + } + +/** + * Removes any duplicate characters from the provided string. + * + * @private + * @param {String} str String to remove duplicate characters from. + * @returns {String} String with any duplicate characters removed. + */ + function clipDuplicates(str) { + return nativ.replace.call(str, /([\s\S])(?=[\s\S]*\1)/g, ''); + } + +/** + * Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype` + * properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing + * flags g and y while copying the regex. + * + * @private + * @param {RegExp} regex Regex to copy. + * @param {Object} [options] Options object with optional properties: + *
      • `addG` {Boolean} Add flag g while copying the regex. + *
      • `addY` {Boolean} Add flag y while copying the regex. + *
      • `removeG` {Boolean} Remove flag g while copying the regex. + *
      • `removeY` {Boolean} Remove flag y while copying the regex. + *
      • `isInternalOnly` {Boolean} Whether the copied regex will be used only for internal + * operations, and never exposed to users. For internal-only regexes, we can improve perf by + * skipping some operations like attaching `XRegExp.prototype` properties. + * @returns {RegExp} Copy of the provided regex, possibly with modified flags. + */ + function copyRegex(regex, options) { + if (!XRegExp.isRegExp(regex)) { + throw new TypeError('Type RegExp expected'); + } + + var xData = regex[REGEX_DATA] || {}, + flags = getNativeFlags(regex), + flagsToAdd = '', + flagsToRemove = '', + xregexpSource = null, + xregexpFlags = null; + + options = options || {}; + + if (options.removeG) {flagsToRemove += 'g';} + if (options.removeY) {flagsToRemove += 'y';} + if (flagsToRemove) { + flags = nativ.replace.call(flags, new RegExp('[' + flagsToRemove + ']+', 'g'), ''); + } + + if (options.addG) {flagsToAdd += 'g';} + if (options.addY) {flagsToAdd += 'y';} + if (flagsToAdd) { + flags = clipDuplicates(flags + flagsToAdd); + } + + if (!options.isInternalOnly) { + if (xData.source !== undefined) { + xregexpSource = xData.source; + } + // null or undefined; don't want to add to `flags` if the previous value was null, since + // that indicates we're not tracking original precompilation flags + if (xData.flags != null) { + // Flags are only added for non-internal regexes by `XRegExp.globalize`. Flags are + // never removed for non-internal regexes, so don't need to handle it + xregexpFlags = flagsToAdd ? clipDuplicates(xData.flags + flagsToAdd) : xData.flags; + } + } + + // Augment with `XRegExp.prototype` properties, but use the native `RegExp` constructor to + // avoid searching for special tokens. That would be wrong for regexes constructed by + // `RegExp`, and unnecessary for regexes constructed by `XRegExp` because the regex has + // already undergone the translation to native regex syntax + regex = augment( + new RegExp(regex.source, flags), + hasNamedCapture(regex) ? xData.captureNames.slice(0) : null, + xregexpSource, + xregexpFlags, + options.isInternalOnly + ); + + return regex; + } + +/** + * Converts hexadecimal to decimal. + * + * @private + * @param {String} hex + * @returns {Number} + */ + function dec(hex) { + return parseInt(hex, 16); + } + +/** + * Returns native `RegExp` flags used by a regex object. + * + * @private + * @param {RegExp} regex Regex to check. + * @returns {String} Native flags in use. + */ + function getNativeFlags(regex) { + return hasFlagsProp ? + regex.flags : + // Explicitly using `RegExp.prototype.toString` (rather than e.g. `String` or + // concatenation with an empty string) allows this to continue working predictably when + // `XRegExp.proptotype.toString` is overriden + nativ.exec.call(/\/([a-z]*)$/i, RegExp.prototype.toString.call(regex))[1]; + } + +/** + * Determines whether a regex has extended instance data used to track capture names. + * + * @private + * @param {RegExp} regex Regex to check. + * @returns {Boolean} Whether the regex uses named capture. + */ + function hasNamedCapture(regex) { + return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames); + } + +/** + * Converts decimal to hexadecimal. + * + * @private + * @param {Number|String} dec + * @returns {String} + */ + function hex(dec) { + return parseInt(dec, 10).toString(16); + } + +/** + * Returns the first index at which a given value can be found in an array. + * + * @private + * @param {Array} array Array to search. + * @param {*} value Value to locate in the array. + * @returns {Number} Zero-based index at which the item is found, or -1. + */ + function indexOf(array, value) { + var len = array.length, i; + + for (i = 0; i < len; ++i) { + if (array[i] === value) { + return i; + } + } + + return -1; + } + +/** + * Determines whether a value is of the specified type, by resolving its internal [[Class]]. + * + * @private + * @param {*} value Object to check. + * @param {String} type Type to check for, in TitleCase. + * @returns {Boolean} Whether the object matches the type. + */ + function isType(value, type) { + return toString.call(value) === '[object ' + type + ']'; + } + +/** + * Checks whether the next nonignorable token after the specified position is a quantifier. + * + * @private + * @param {String} pattern Pattern to search within. + * @param {Number} pos Index in `pattern` to search at. + * @param {String} flags Flags used by the pattern. + * @returns {Boolean} Whether the next token is a quantifier. + */ + function isQuantifierNext(pattern, pos, flags) { + return nativ.test.call( + flags.indexOf('x') > -1 ? + // Ignore any leading whitespace, line comments, and inline comments + /^(?:\s+|#.*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/ : + // Ignore any leading inline comments + /^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/, + pattern.slice(pos) + ); + } + +/** + * Pads the provided string with as many leading zeros as needed to get to length 4. Used to produce + * fixed-length hexadecimal values. + * + * @private + * @param {String} str + * @returns {String} + */ + function pad4(str) { + while (str.length < 4) { + str = '0' + str; + } + return str; + } + +/** + * Checks for flag-related errors, and strips/applies flags in a leading mode modifier. Offloads + * the flag preparation logic from the `XRegExp` constructor. + * + * @private + * @param {String} pattern Regex pattern, possibly with a leading mode modifier. + * @param {String} flags Any combination of flags. + * @returns {Object} Object with properties `pattern` and `flags`. + */ + function prepareFlags(pattern, flags) { + var i; + + // Recent browsers throw on duplicate flags, so copy this behavior for nonnative flags + if (clipDuplicates(flags) !== flags) { + throw new SyntaxError('Invalid duplicate regex flag ' + flags); + } + + // Strip and apply a leading mode modifier with any combination of flags except g or y + pattern = nativ.replace.call(pattern, /^\(\?([\w$]+)\)/, function($0, $1) { + if (nativ.test.call(/[gy]/, $1)) { + throw new SyntaxError('Cannot use flag g or y in mode modifier ' + $0); + } + // Allow duplicate flags within the mode modifier + flags = clipDuplicates(flags + $1); + return ''; + }); + + // Throw on unknown native or nonnative flags + for (i = 0; i < flags.length; ++i) { + if (!registeredFlags[flags.charAt(i)]) { + throw new SyntaxError('Unknown regex flag ' + flags.charAt(i)); + } + } + + return { + pattern: pattern, + flags: flags + }; + } + +/** + * Prepares an options object from the given value. + * + * @private + * @param {String|Object} value Value to convert to an options object. + * @returns {Object} Options object. + */ + function prepareOptions(value) { + var options = {}; + + if (isType(value, 'String')) { + XRegExp.forEach(value, /[^\s,]+/, function(match) { + options[match] = true; + }); + + return options; + } + + return value; + } + +/** + * Registers a flag so it doesn't throw an 'unknown flag' error. + * + * @private + * @param {String} flag Single-character flag to register. + */ + function registerFlag(flag) { + if (!/^[\w$]$/.test(flag)) { + throw new Error('Flag must be a single character A-Za-z0-9_$'); + } + + registeredFlags[flag] = true; + } + +/** + * Runs built-in and custom regex syntax tokens in reverse insertion order at the specified + * position, until a match is found. + * + * @private + * @param {String} pattern Original pattern from which an XRegExp object is being built. + * @param {String} flags Flags being used to construct the regex. + * @param {Number} pos Position to search for tokens within `pattern`. + * @param {Number} scope Regex scope to apply: 'default' or 'class'. + * @param {Object} context Context object to use for token handler functions. + * @returns {Object} Object with properties `matchLength`, `output`, and `reparse`; or `null`. + */ + function runTokens(pattern, flags, pos, scope, context) { + var i = tokens.length, + leadChar = pattern.charAt(pos), + result = null, + match, + t; + + // Run in reverse insertion order + while (i--) { + t = tokens[i]; + if ( + (t.leadChar && t.leadChar !== leadChar) || + (t.scope !== scope && t.scope !== 'all') || + (t.flag && flags.indexOf(t.flag) === -1) + ) { + continue; + } + + match = XRegExp.exec(pattern, t.regex, pos, 'sticky'); + if (match) { + result = { + matchLength: match[0].length, + output: t.handler.call(context, match, scope, flags), + reparse: t.reparse + }; + // Finished with token tests + break; + } + } + + return result; + } + +/** + * Enables or disables implicit astral mode opt-in. When enabled, flag A is automatically added to + * all new regexes created by XRegExp. This causes an error to be thrown when creating regexes if + * the Unicode Base addon is not available, since flag A is registered by that addon. + * + * @private + * @param {Boolean} on `true` to enable; `false` to disable. + */ + function setAstral(on) { + features.astral = on; + } + +/** + * Enables or disables native method overrides. + * + * @private + * @param {Boolean} on `true` to enable; `false` to disable. + */ + function setNatives(on) { + RegExp.prototype.exec = (on ? fixed : nativ).exec; + RegExp.prototype.test = (on ? fixed : nativ).test; + String.prototype.match = (on ? fixed : nativ).match; + String.prototype.replace = (on ? fixed : nativ).replace; + String.prototype.split = (on ? fixed : nativ).split; + + features.natives = on; + } + +/** + * Returns the object, or throws an error if it is `null` or `undefined`. This is used to follow + * the ES5 abstract operation `ToObject`. + * + * @private + * @param {*} value Object to check and return. + * @returns {*} The provided object. + */ + function toObject(value) { + // null or undefined + if (value == null) { + throw new TypeError('Cannot convert null or undefined to object'); + } + + return value; + } + +/* ============================== + * Constructor + * ============================== */ + +/** + * Creates an extended regular expression object for matching text with a pattern. Differs from a + * native regular expression in that additional syntax and flags are supported. The returned object + * is in fact a native `RegExp` and works with all native methods. + * + * @class XRegExp + * @constructor + * @param {String|RegExp} pattern Regex pattern string, or an existing regex object to copy. + * @param {String} [flags] Any combination of flags. + * Native flags: + *
      • `g` - global + *
      • `i` - ignore case + *
      • `m` - multiline anchors + *
      • `u` - unicode (ES6) + *
      • `y` - sticky (Firefox 3+, ES6) + * Additional XRegExp flags: + *
      • `n` - explicit capture + *
      • `s` - dot matches all (aka singleline) + *
      • `x` - free-spacing and line comments (aka extended) + *
      • `A` - astral (requires the Unicode Base addon) + * Flags cannot be provided when constructing one `RegExp` from another. + * @returns {RegExp} Extended regular expression object. + * @example + * + * // With named capture and flag x + * XRegExp('(? [0-9]{4} ) -? # year \n\ + * (? [0-9]{2} ) -? # month \n\ + * (? [0-9]{2} ) # day ', 'x'); + * + * // Providing a regex object copies it. Native regexes are recompiled using native (not XRegExp) + * // syntax. Copies maintain extended data, are augmented with `XRegExp.prototype` properties, and + * // have fresh `lastIndex` properties (set to zero). + * XRegExp(/regex/); + */ + function XRegExp(pattern, flags) { + var context = { + hasNamedCapture: false, + captureNames: [] + }, + scope = defaultScope, + output = '', + pos = 0, + result, + token, + generated, + appliedPattern, + appliedFlags; + + if (XRegExp.isRegExp(pattern)) { + if (flags !== undefined) { + throw new TypeError('Cannot supply flags when copying a RegExp'); + } + return copyRegex(pattern); + } + + // Copy the argument behavior of `RegExp` + pattern = pattern === undefined ? '' : String(pattern); + flags = flags === undefined ? '' : String(flags); + + if (XRegExp.isInstalled('astral') && flags.indexOf('A') === -1) { + // This causes an error to be thrown if the Unicode Base addon is not available + flags += 'A'; + } + + if (!patternCache[pattern]) { + patternCache[pattern] = {}; + } + + if (!patternCache[pattern][flags]) { + // Check for flag-related errors, and strip/apply flags in a leading mode modifier + result = prepareFlags(pattern, flags); + appliedPattern = result.pattern; + appliedFlags = result.flags; + + // Use XRegExp's tokens to translate the pattern to a native regex pattern. + // `appliedPattern.length` may change on each iteration if tokens use `reparse` + while (pos < appliedPattern.length) { + do { + // Check for custom tokens at the current position + result = runTokens(appliedPattern, appliedFlags, pos, scope, context); + // If the matched token used the `reparse` option, splice its output into the + // pattern before running tokens again at the same position + if (result && result.reparse) { + appliedPattern = appliedPattern.slice(0, pos) + + result.output + + appliedPattern.slice(pos + result.matchLength); + } + } while (result && result.reparse); + + if (result) { + output += result.output; + pos += (result.matchLength || 1); + } else { + // Get the native token at the current position + token = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky')[0]; + output += token; + pos += token.length; + if (token === '[' && scope === defaultScope) { + scope = classScope; + } else if (token === ']' && scope === classScope) { + scope = defaultScope; + } + } + } + + patternCache[pattern][flags] = { + pattern: output, + // Strip all but native flags + flags: nativ.replace.call(appliedFlags, /[^gimuy]+/g, ''), + // `context.captureNames` has an item for each capturing group, even if unnamed + captures: context.hasNamedCapture ? context.captureNames : null + }; + } + + generated = patternCache[pattern][flags]; + return augment( + new RegExp(generated.pattern, generated.flags), + generated.captures, + pattern, + flags + ); + }; + +// Add `RegExp.prototype` to the prototype chain + XRegExp.prototype = new RegExp(); + +/* ============================== + * Public properties + * ============================== */ + +/** + * The XRegExp version number as a string containing three dot-separated parts. For example, + * '2.0.0-beta-3'. + * + * @static + * @memberOf XRegExp + * @type String + */ + XRegExp.version = '3.1.0'; + +/* ============================== + * Public methods + * ============================== */ + +// Intentionally undocumented + XRegExp._hasNativeFlag = hasNativeFlag; + +/** + * Extends XRegExp syntax and allows custom flags. This is used internally and can be used to + * create XRegExp addons. If more than one token can match the same string, the last added wins. + * + * @memberOf XRegExp + * @param {RegExp} regex Regex object that matches the new token. + * @param {Function} handler Function that returns a new pattern string (using native regex syntax) + * to replace the matched token within all future XRegExp regexes. Has access to persistent + * properties of the regex being built, through `this`. Invoked with three arguments: + *
      • The match array, with named backreference properties. + *
      • The regex scope where the match was found: 'default' or 'class'. + *
      • The flags used by the regex, including any flags in a leading mode modifier. + * The handler function becomes part of the XRegExp construction process, so be careful not to + * construct XRegExps within the function or you will trigger infinite recursion. + * @param {Object} [options] Options object with optional properties: + *
      • `scope` {String} Scope where the token applies: 'default', 'class', or 'all'. + *
      • `flag` {String} Single-character flag that triggers the token. This also registers the + * flag, which prevents XRegExp from throwing an 'unknown flag' error when the flag is used. + *
      • `optionalFlags` {String} Any custom flags checked for within the token `handler` that are + * not required to trigger the token. This registers the flags, to prevent XRegExp from + * throwing an 'unknown flag' error when any of the flags are used. + *
      • `reparse` {Boolean} Whether the `handler` function's output should not be treated as + * final, and instead be reparseable by other tokens (including the current token). Allows + * token chaining or deferring. + *
      • `leadChar` {String} Single character that occurs at the beginning of any successful match + * of the token (not always applicable). This doesn't change the behavior of the token unless + * you provide an erroneous value. However, providing it can increase the token's performance + * since the token can be skipped at any positions where this character doesn't appear. + * @example + * + * // Basic usage: Add \a for the ALERT control code + * XRegExp.addToken( + * /\\a/, + * function() {return '\\x07';}, + * {scope: 'all'} + * ); + * XRegExp('\\a[\\a-\\n]+').test('\x07\n\x07'); // -> true + * + * // Add the U (ungreedy) flag from PCRE and RE2, which reverses greedy and lazy quantifiers. + * // Since `scope` is not specified, it uses 'default' (i.e., transformations apply outside of + * // character classes only) + * XRegExp.addToken( + * /([?*+]|{\d+(?:,\d*)?})(\??)/, + * function(match) {return match[1] + (match[2] ? '' : '?');}, + * {flag: 'U'} + * ); + * XRegExp('a+', 'U').exec('aaa')[0]; // -> 'a' + * XRegExp('a+?', 'U').exec('aaa')[0]; // -> 'aaa' + */ + XRegExp.addToken = function(regex, handler, options) { + options = options || {}; + var optionalFlags = options.optionalFlags, i; + + if (options.flag) { + registerFlag(options.flag); + } + + if (optionalFlags) { + optionalFlags = nativ.split.call(optionalFlags, ''); + for (i = 0; i < optionalFlags.length; ++i) { + registerFlag(optionalFlags[i]); + } + } + + // Add to the private list of syntax tokens + tokens.push({ + regex: copyRegex(regex, { + addG: true, + addY: hasNativeY, + isInternalOnly: true + }), + handler: handler, + scope: options.scope || defaultScope, + flag: options.flag, + reparse: options.reparse, + leadChar: options.leadChar + }); + + // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and + // flags might now produce different results + XRegExp.cache.flush('patterns'); + }; + +/** + * Caches and returns the result of calling `XRegExp(pattern, flags)`. On any subsequent call with + * the same pattern and flag combination, the cached copy of the regex is returned. + * + * @memberOf XRegExp + * @param {String} pattern Regex pattern string. + * @param {String} [flags] Any combination of XRegExp flags. + * @returns {RegExp} Cached XRegExp object. + * @example + * + * while (match = XRegExp.cache('.', 'gs').exec(str)) { + * // The regex is compiled once only + * } + */ + XRegExp.cache = function(pattern, flags) { + if (!regexCache[pattern]) { + regexCache[pattern] = {}; + } + return regexCache[pattern][flags] || ( + regexCache[pattern][flags] = XRegExp(pattern, flags) + ); + }; + +// Intentionally undocumented + XRegExp.cache.flush = function(cacheName) { + if (cacheName === 'patterns') { + // Flush the pattern cache used by the `XRegExp` constructor + patternCache = {}; + } else { + // Flush the regex cache populated by `XRegExp.cache` + regexCache = {}; + } + }; + +/** + * Escapes any regular expression metacharacters, for use when matching literal strings. The result + * can safely be used at any point within a regex that uses any flags. + * + * @memberOf XRegExp + * @param {String} str String to escape. + * @returns {String} String with regex metacharacters escaped. + * @example + * + * XRegExp.escape('Escaped? <.>'); + * // -> 'Escaped\?\ <\.>' + */ + XRegExp.escape = function(str) { + return nativ.replace.call(toObject(str), /[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); + }; + +/** + * Executes a regex search in a specified string. Returns a match array or `null`. If the provided + * regex uses named capture, named backreference properties are included on the match array. + * Optional `pos` and `sticky` arguments specify the search start position, and whether the match + * must start at the specified position only. The `lastIndex` property of the provided regex is not + * used, but is updated for compatibility. Also fixes browser bugs compared to the native + * `RegExp.prototype.exec` and can be used reliably cross-browser. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {RegExp} regex Regex to search with. + * @param {Number} [pos=0] Zero-based index at which to start the search. + * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position + * only. The string `'sticky'` is accepted as an alternative to `true`. + * @returns {Array} Match array with named backreference properties, or `null`. + * @example + * + * // Basic use, with named backreference + * var match = XRegExp.exec('U+2620', XRegExp('U\\+(?[0-9A-F]{4})')); + * match.hex; // -> '2620' + * + * // With pos and sticky, in a loop + * var pos = 2, result = [], match; + * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) { + * result.push(match[1]); + * pos = match.index + match[0].length; + * } + * // result -> ['2', '3', '4'] + */ + XRegExp.exec = function(str, regex, pos, sticky) { + var cacheKey = 'g', + addY = false, + match, + r2; + + addY = hasNativeY && !!(sticky || (regex.sticky && sticky !== false)); + if (addY) { + cacheKey += 'y'; + } + + regex[REGEX_DATA] = regex[REGEX_DATA] || {}; + + // Shares cached copies with `XRegExp.match`/`replace` + r2 = regex[REGEX_DATA][cacheKey] || ( + regex[REGEX_DATA][cacheKey] = copyRegex(regex, { + addG: true, + addY: addY, + removeY: sticky === false, + isInternalOnly: true + }) + ); + + r2.lastIndex = pos = pos || 0; + + // Fixed `exec` required for `lastIndex` fix, named backreferences, etc. + match = fixed.exec.call(r2, str); + + if (sticky && match && match.index !== pos) { + match = null; + } + + if (regex.global) { + regex.lastIndex = match ? r2.lastIndex : 0; + } + + return match; + }; + +/** + * Executes a provided function once per regex match. Searches always start at the beginning of the + * string and continue until the end, regardless of the state of the regex's `global` property and + * initial `lastIndex`. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {RegExp} regex Regex to search with. + * @param {Function} callback Function to execute for each match. Invoked with four arguments: + *
      • The match array, with named backreference properties. + *
      • The zero-based match index. + *
      • The string being traversed. + *
      • The regex object being used to traverse the string. + * @example + * + * // Extracts every other digit from a string + * var evens = []; + * XRegExp.forEach('1a2345', /\d/, function(match, i) { + * if (i % 2) evens.push(+match[0]); + * }); + * // evens -> [2, 4] + */ + XRegExp.forEach = function(str, regex, callback) { + var pos = 0, + i = -1, + match; + + while ((match = XRegExp.exec(str, regex, pos))) { + // Because `regex` is provided to `callback`, the function could use the deprecated/ + // nonstandard `RegExp.prototype.compile` to mutate the regex. However, since + // `XRegExp.exec` doesn't use `lastIndex` to set the search position, this can't lead + // to an infinite loop, at least. Actually, because of the way `XRegExp.exec` caches + // globalized versions of regexes, mutating the regex will not have any effect on the + // iteration or matched strings, which is a nice side effect that brings extra safety + callback(match, ++i, str, regex); + + pos = match.index + (match[0].length || 1); + } + }; + +/** + * Copies a regex object and adds flag `g`. The copy maintains extended data, is augmented with + * `XRegExp.prototype` properties, and has a fresh `lastIndex` property (set to zero). Native + * regexes are not recompiled using XRegExp syntax. + * + * @memberOf XRegExp + * @param {RegExp} regex Regex to globalize. + * @returns {RegExp} Copy of the provided regex with flag `g` added. + * @example + * + * var globalCopy = XRegExp.globalize(/regex/); + * globalCopy.global; // -> true + */ + XRegExp.globalize = function(regex) { + return copyRegex(regex, {addG: true}); + }; + +/** + * Installs optional features according to the specified options. Can be undone using + * `XRegExp.uninstall`. + * + * @memberOf XRegExp + * @param {Object|String} options Options object or string. + * @example + * + * // With an options object + * XRegExp.install({ + * // Enables support for astral code points in Unicode addons (implicitly sets flag A) + * astral: true, + * + * // DEPRECATED: Overrides native regex methods with fixed/extended versions + * natives: true + * }); + * + * // With an options string + * XRegExp.install('astral natives'); + */ + XRegExp.install = function(options) { + options = prepareOptions(options); + + if (!features.astral && options.astral) { + setAstral(true); + } + + if (!features.natives && options.natives) { + setNatives(true); + } + }; + +/** + * Checks whether an individual optional feature is installed. + * + * @memberOf XRegExp + * @param {String} feature Name of the feature to check. One of: + *
      • `astral` + *
      • `natives` + * @returns {Boolean} Whether the feature is installed. + * @example + * + * XRegExp.isInstalled('astral'); + */ + XRegExp.isInstalled = function(feature) { + return !!(features[feature]); + }; + +/** + * Returns `true` if an object is a regex; `false` if it isn't. This works correctly for regexes + * created in another frame, when `instanceof` and `constructor` checks would fail. + * + * @memberOf XRegExp + * @param {*} value Object to check. + * @returns {Boolean} Whether the object is a `RegExp` object. + * @example + * + * XRegExp.isRegExp('string'); // -> false + * XRegExp.isRegExp(/regex/i); // -> true + * XRegExp.isRegExp(RegExp('^', 'm')); // -> true + * XRegExp.isRegExp(XRegExp('(?s).')); // -> true + */ + XRegExp.isRegExp = function(value) { + return toString.call(value) === '[object RegExp]'; + //return isType(value, 'RegExp'); + }; + +/** + * Returns the first matched string, or in global mode, an array containing all matched strings. + * This is essentially a more convenient re-implementation of `String.prototype.match` that gives + * the result types you actually want (string instead of `exec`-style array in match-first mode, + * and an empty array instead of `null` when no matches are found in match-all mode). It also lets + * you override flag g and ignore `lastIndex`, and fixes browser bugs. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {RegExp} regex Regex to search with. + * @param {String} [scope='one'] Use 'one' to return the first match as a string. Use 'all' to + * return an array of all matched strings. If not explicitly specified and `regex` uses flag g, + * `scope` is 'all'. + * @returns {String|Array} In match-first mode: First match as a string, or `null`. In match-all + * mode: Array of all matched strings, or an empty array. + * @example + * + * // Match first + * XRegExp.match('abc', /\w/); // -> 'a' + * XRegExp.match('abc', /\w/g, 'one'); // -> 'a' + * XRegExp.match('abc', /x/g, 'one'); // -> null + * + * // Match all + * XRegExp.match('abc', /\w/g); // -> ['a', 'b', 'c'] + * XRegExp.match('abc', /\w/, 'all'); // -> ['a', 'b', 'c'] + * XRegExp.match('abc', /x/, 'all'); // -> [] + */ + XRegExp.match = function(str, regex, scope) { + var global = (regex.global && scope !== 'one') || scope === 'all', + cacheKey = ((global ? 'g' : '') + (regex.sticky ? 'y' : '')) || 'noGY', + result, + r2; + + regex[REGEX_DATA] = regex[REGEX_DATA] || {}; + + // Shares cached copies with `XRegExp.exec`/`replace` + r2 = regex[REGEX_DATA][cacheKey] || ( + regex[REGEX_DATA][cacheKey] = copyRegex(regex, { + addG: !!global, + removeG: scope === 'one', + isInternalOnly: true + }) + ); + + result = nativ.match.call(toObject(str), r2); + + if (regex.global) { + regex.lastIndex = ( + (scope === 'one' && result) ? + // Can't use `r2.lastIndex` since `r2` is nonglobal in this case + (result.index + result[0].length) : 0 + ); + } + + return global ? (result || []) : (result && result[0]); + }; + +/** + * Retrieves the matches from searching a string using a chain of regexes that successively search + * within previous matches. The provided `chain` array can contain regexes and or objects with + * `regex` and `backref` properties. When a backreference is specified, the named or numbered + * backreference is passed forward to the next regex or returned. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {Array} chain Regexes that each search for matches within preceding results. + * @returns {Array} Matches by the last regex in the chain, or an empty array. + * @example + * + * // Basic usage; matches numbers within tags + * XRegExp.matchChain('1 2 3 4 a 56', [ + * XRegExp('(?is).*?'), + * /\d+/ + * ]); + * // -> ['2', '4', '56'] + * + * // Passing forward and returning specific backreferences + * html = 'XRegExp\ + * Google'; + * XRegExp.matchChain(html, [ + * {regex: //i, backref: 1}, + * {regex: XRegExp('(?i)^https?://(?[^/?#]+)'), backref: 'domain'} + * ]); + * // -> ['xregexp.com', 'www.google.com'] + */ + XRegExp.matchChain = function(str, chain) { + return (function recurseChain(values, level) { + var item = chain[level].regex ? chain[level] : {regex: chain[level]}, + matches = [], + addMatch = function(match) { + if (item.backref) { + /* Safari 4.0.5 (but not 5.0.5+) inappropriately uses sparse arrays to hold + * the `undefined`s for backreferences to nonparticipating capturing + * groups. In such cases, a `hasOwnProperty` or `in` check on its own would + * inappropriately throw the exception, so also check if the backreference + * is a number that is within the bounds of the array. + */ + if (!(match.hasOwnProperty(item.backref) || +item.backref < match.length)) { + throw new ReferenceError('Backreference to undefined group: ' + item.backref); + } + + matches.push(match[item.backref] || ''); + } else { + matches.push(match[0]); + } + }, + i; + + for (i = 0; i < values.length; ++i) { + XRegExp.forEach(values[i], item.regex, addMatch); + } + + return ((level === chain.length - 1) || !matches.length) ? + matches : + recurseChain(matches, level + 1); + }([str], 0)); + }; + +/** + * Returns a new string with one or all matches of a pattern replaced. The pattern can be a string + * or regex, and the replacement can be a string or a function to be called for each match. To + * perform a global search and replace, use the optional `scope` argument or include flag g if using + * a regex. Replacement strings can use `${n}` for named and numbered backreferences. Replacement + * functions can use named backreferences via `arguments[0].name`. Also fixes browser bugs compared + * to the native `String.prototype.replace` and can be used reliably cross-browser. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {RegExp|String} search Search pattern to be replaced. + * @param {String|Function} replacement Replacement string or a function invoked to create it. + * Replacement strings can include special replacement syntax: + *
      • $$ - Inserts a literal $ character. + *
      • $&, $0 - Inserts the matched substring. + *
      • $` - Inserts the string that precedes the matched substring (left context). + *
      • $' - Inserts the string that follows the matched substring (right context). + *
      • $n, $nn - Where n/nn are digits referencing an existent capturing group, inserts + * backreference n/nn. + *
      • ${n} - Where n is a name or any number of digits that reference an existent capturing + * group, inserts backreference n. + * Replacement functions are invoked with three or more arguments: + *
      • The matched substring (corresponds to $& above). Named backreferences are accessible as + * properties of this first argument. + *
      • 0..n arguments, one for each backreference (corresponding to $1, $2, etc. above). + *
      • The zero-based index of the match within the total search string. + *
      • The total string being searched. + * @param {String} [scope='one'] Use 'one' to replace the first match only, or 'all'. If not + * explicitly specified and using a regex with flag g, `scope` is 'all'. + * @returns {String} New string with one or all matches replaced. + * @example + * + * // Regex search, using named backreferences in replacement string + * var name = XRegExp('(?\\w+) (?\\w+)'); + * XRegExp.replace('John Smith', name, '${last}, ${first}'); + * // -> 'Smith, John' + * + * // Regex search, using named backreferences in replacement function + * XRegExp.replace('John Smith', name, function(match) { + * return match.last + ', ' + match.first; + * }); + * // -> 'Smith, John' + * + * // String search, with replace-all + * XRegExp.replace('RegExp builds RegExps', 'RegExp', 'XRegExp', 'all'); + * // -> 'XRegExp builds XRegExps' + */ + XRegExp.replace = function(str, search, replacement, scope) { + var isRegex = XRegExp.isRegExp(search), + global = (search.global && scope !== 'one') || scope === 'all', + cacheKey = ((global ? 'g' : '') + (search.sticky ? 'y' : '')) || 'noGY', + s2 = search, + result; + + if (isRegex) { + search[REGEX_DATA] = search[REGEX_DATA] || {}; + + // Shares cached copies with `XRegExp.exec`/`match`. Since a copy is used, `search`'s + // `lastIndex` isn't updated *during* replacement iterations + s2 = search[REGEX_DATA][cacheKey] || ( + search[REGEX_DATA][cacheKey] = copyRegex(search, { + addG: !!global, + removeG: scope === 'one', + isInternalOnly: true + }) + ); + } else if (global) { + s2 = new RegExp(XRegExp.escape(String(search)), 'g'); + } + + // Fixed `replace` required for named backreferences, etc. + result = fixed.replace.call(toObject(str), s2, replacement); + + if (isRegex && search.global) { + // Fixes IE, Safari bug (last tested IE 9, Safari 5.1) + search.lastIndex = 0; + } + + return result; + }; + +/** + * Performs batch processing of string replacements. Used like `XRegExp.replace`, but accepts an + * array of replacement details. Later replacements operate on the output of earlier replacements. + * Replacement details are accepted as an array with a regex or string to search for, the + * replacement string or function, and an optional scope of 'one' or 'all'. Uses the XRegExp + * replacement text syntax, which supports named backreference properties via `${name}`. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {Array} replacements Array of replacement detail arrays. + * @returns {String} New string with all replacements. + * @example + * + * str = XRegExp.replaceEach(str, [ + * [XRegExp('(?a)'), 'z${name}'], + * [/b/gi, 'y'], + * [/c/g, 'x', 'one'], // scope 'one' overrides /g + * [/d/, 'w', 'all'], // scope 'all' overrides lack of /g + * ['e', 'v', 'all'], // scope 'all' allows replace-all for strings + * [/f/g, function($0) { + * return $0.toUpperCase(); + * }] + * ]); + */ + XRegExp.replaceEach = function(str, replacements) { + var i, r; + + for (i = 0; i < replacements.length; ++i) { + r = replacements[i]; + str = XRegExp.replace(str, r[0], r[1], r[2]); + } + + return str; + }; + +/** + * Splits a string into an array of strings using a regex or string separator. Matches of the + * separator are not included in the result array. However, if `separator` is a regex that contains + * capturing groups, backreferences are spliced into the result each time `separator` is matched. + * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably + * cross-browser. + * + * @memberOf XRegExp + * @param {String} str String to split. + * @param {RegExp|String} separator Regex or string to use for separating the string. + * @param {Number} [limit] Maximum number of items to include in the result array. + * @returns {Array} Array of substrings. + * @example + * + * // Basic use + * XRegExp.split('a b c', ' '); + * // -> ['a', 'b', 'c'] + * + * // With limit + * XRegExp.split('a b c', ' ', 2); + * // -> ['a', 'b'] + * + * // Backreferences in result array + * XRegExp.split('..word1..', /([a-z]+)(\d+)/i); + * // -> ['..', 'word', '1', '..'] + */ + XRegExp.split = function(str, separator, limit) { + return fixed.split.call(toObject(str), separator, limit); + }; + +/** + * Executes a regex search in a specified string. Returns `true` or `false`. Optional `pos` and + * `sticky` arguments specify the search start position, and whether the match must start at the + * specified position only. The `lastIndex` property of the provided regex is not used, but is + * updated for compatibility. Also fixes browser bugs compared to the native + * `RegExp.prototype.test` and can be used reliably cross-browser. + * + * @memberOf XRegExp + * @param {String} str String to search. + * @param {RegExp} regex Regex to search with. + * @param {Number} [pos=0] Zero-based index at which to start the search. + * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position + * only. The string `'sticky'` is accepted as an alternative to `true`. + * @returns {Boolean} Whether the regex matched the provided value. + * @example + * + * // Basic use + * XRegExp.test('abc', /c/); // -> true + * + * // With pos and sticky + * XRegExp.test('abc', /c/, 0, 'sticky'); // -> false + * XRegExp.test('abc', /c/, 2, 'sticky'); // -> true + */ + XRegExp.test = function(str, regex, pos, sticky) { + // Do this the easy way :-) + return !!XRegExp.exec(str, regex, pos, sticky); + }; + +/** + * Uninstalls optional features according to the specified options. All optional features start out + * uninstalled, so this is used to undo the actions of `XRegExp.install`. + * + * @memberOf XRegExp + * @param {Object|String} options Options object or string. + * @example + * + * // With an options object + * XRegExp.uninstall({ + * // Disables support for astral code points in Unicode addons + * astral: true, + * + * // DEPRECATED: Restores native regex methods + * natives: true + * }); + * + * // With an options string + * XRegExp.uninstall('astral natives'); + */ + XRegExp.uninstall = function(options) { + options = prepareOptions(options); + + if (features.astral && options.astral) { + setAstral(false); + } + + if (features.natives && options.natives) { + setNatives(false); + } + }; + +/** + * Returns an XRegExp object that is the union of the given patterns. Patterns can be provided as + * regex objects or strings. Metacharacters are escaped in patterns provided as strings. + * Backreferences in provided regex objects are automatically renumbered to work correctly within + * the larger combined pattern. Native flags used by provided regexes are ignored in favor of the + * `flags` argument. + * + * @memberOf XRegExp + * @param {Array} patterns Regexes and strings to combine. + * @param {String} [flags] Any combination of XRegExp flags. + * @returns {RegExp} Union of the provided regexes and strings. + * @example + * + * XRegExp.union(['a+b*c', /(dogs)\1/, /(cats)\1/], 'i'); + * // -> /a\+b\*c|(dogs)\1|(cats)\2/i + */ + XRegExp.union = function(patterns, flags) { + var parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g, + output = [], + numCaptures = 0, + numPriorCaptures, + captureNames, + pattern, + rewrite = function(match, paren, backref) { + var name = captureNames[numCaptures - numPriorCaptures]; + + // Capturing group + if (paren) { + ++numCaptures; + // If the current capture has a name, preserve the name + if (name) { + return '(?<' + name + '>'; + } + // Backreference + } else if (backref) { + // Rewrite the backreference + return '\\' + (+backref + numPriorCaptures); + } + + return match; + }, + i; + + if (!(isType(patterns, 'Array') && patterns.length)) { + throw new TypeError('Must provide a nonempty array of patterns to merge'); + } + + for (i = 0; i < patterns.length; ++i) { + pattern = patterns[i]; + + if (XRegExp.isRegExp(pattern)) { + numPriorCaptures = numCaptures; + captureNames = (pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames) || []; + + // Rewrite backreferences. Passing to XRegExp dies on octals and ensures patterns + // are independently valid; helps keep this simple. Named captures are put back + output.push(nativ.replace.call(XRegExp(pattern.source).source, parts, rewrite)); + } else { + output.push(XRegExp.escape(pattern)); + } + } + + return XRegExp(output.join('|'), flags); + }; + +/* ============================== + * Fixed/extended native methods + * ============================== */ + +/** + * Adds named capture support (with backreferences returned as `result.name`), and fixes browser + * bugs in the native `RegExp.prototype.exec`. Calling `XRegExp.install('natives')` uses this to + * override the native method. Use via `XRegExp.exec` without overriding natives. + * + * @private + * @param {String} str String to search. + * @returns {Array} Match array with named backreference properties, or `null`. + */ + fixed.exec = function(str) { + var origLastIndex = this.lastIndex, + match = nativ.exec.apply(this, arguments), + name, + r2, + i; + + if (match) { + // Fix browsers whose `exec` methods don't return `undefined` for nonparticipating + // capturing groups. This fixes IE 5.5-8, but not IE 9's quirks mode or emulation of + // older IEs. IE 9 in standards mode follows the spec + if (!correctExecNpcg && match.length > 1 && indexOf(match, '') > -1) { + r2 = copyRegex(this, { + removeG: true, + isInternalOnly: true + }); + // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed + // matching due to characters outside the match + nativ.replace.call(String(str).slice(match.index), r2, function() { + var len = arguments.length, i; + // Skip index 0 and the last 2 + for (i = 1; i < len - 2; ++i) { + if (arguments[i] === undefined) { + match[i] = undefined; + } + } + }); + } + + // Attach named capture properties + if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) { + // Skip index 0 + for (i = 1; i < match.length; ++i) { + name = this[REGEX_DATA].captureNames[i - 1]; + if (name) { + match[name] = match[i]; + } + } + } + + // Fix browsers that increment `lastIndex` after zero-length matches + if (this.global && !match[0].length && (this.lastIndex > match.index)) { + this.lastIndex = match.index; + } + } + + if (!this.global) { + // Fixes IE, Opera bug (last tested IE 9, Opera 11.6) + this.lastIndex = origLastIndex; + } + + return match; + }; + +/** + * Fixes browser bugs in the native `RegExp.prototype.test`. Calling `XRegExp.install('natives')` + * uses this to override the native method. + * + * @private + * @param {String} str String to search. + * @returns {Boolean} Whether the regex matched the provided value. + */ + fixed.test = function(str) { + // Do this the easy way :-) + return !!fixed.exec.call(this, str); + }; + +/** + * Adds named capture support (with backreferences returned as `result.name`), and fixes browser + * bugs in the native `String.prototype.match`. Calling `XRegExp.install('natives')` uses this to + * override the native method. + * + * @private + * @param {RegExp|*} regex Regex to search with. If not a regex object, it is passed to `RegExp`. + * @returns {Array} If `regex` uses flag g, an array of match strings or `null`. Without flag g, + * the result of calling `regex.exec(this)`. + */ + fixed.match = function(regex) { + var result; + + if (!XRegExp.isRegExp(regex)) { + // Use the native `RegExp` rather than `XRegExp` + regex = new RegExp(regex); + } else if (regex.global) { + result = nativ.match.apply(this, arguments); + // Fixes IE bug + regex.lastIndex = 0; + + return result; + } + + return fixed.exec.call(regex, toObject(this)); + }; + +/** + * Adds support for `${n}` tokens for named and numbered backreferences in replacement text, and + * provides named backreferences to replacement functions as `arguments[0].name`. Also fixes browser + * bugs in replacement text syntax when performing a replacement using a nonregex search value, and + * the value of a replacement regex's `lastIndex` property during replacement iterations and upon + * completion. Calling `XRegExp.install('natives')` uses this to override the native method. Note + * that this doesn't support SpiderMonkey's proprietary third (`flags`) argument. Use via + * `XRegExp.replace` without overriding natives. + * + * @private + * @param {RegExp|String} search Search pattern to be replaced. + * @param {String|Function} replacement Replacement string or a function invoked to create it. + * @returns {String} New string with one or all matches replaced. + */ + fixed.replace = function(search, replacement) { + var isRegex = XRegExp.isRegExp(search), + origLastIndex, + captureNames, + result; + + if (isRegex) { + if (search[REGEX_DATA]) { + captureNames = search[REGEX_DATA].captureNames; + } + // Only needed if `search` is nonglobal + origLastIndex = search.lastIndex; + } else { + search += ''; // Type-convert + } + + // Don't use `typeof`; some older browsers return 'function' for regex objects + if (isType(replacement, 'Function')) { + // Stringifying `this` fixes a bug in IE < 9 where the last argument in replacement + // functions isn't type-converted to a string + result = nativ.replace.call(String(this), search, function() { + var args = arguments, i; + if (captureNames) { + // Change the `arguments[0]` string primitive to a `String` object that can + // store properties. This really does need to use `String` as a constructor + args[0] = new String(args[0]); + // Store named backreferences on the first argument + for (i = 0; i < captureNames.length; ++i) { + if (captureNames[i]) { + args[0][captureNames[i]] = args[i + 1]; + } + } + } + // Update `lastIndex` before calling `replacement`. Fixes IE, Chrome, Firefox, + // Safari bug (last tested IE 9, Chrome 17, Firefox 11, Safari 5.1) + if (isRegex && search.global) { + search.lastIndex = args[args.length - 2] + args[0].length; + } + // ES6 specs the context for replacement functions as `undefined` + return replacement.apply(undefined, args); + }); + } else { + // Ensure that the last value of `args` will be a string when given nonstring `this`, + // while still throwing on null or undefined context + result = nativ.replace.call(this == null ? this : String(this), search, function() { + // Keep this function's `arguments` available through closure + var args = arguments; + return nativ.replace.call(String(replacement), replacementToken, function($0, $1, $2) { + var n; + // Named or numbered backreference with curly braces + if ($1) { + // XRegExp behavior for `${n}`: + // 1. Backreference to numbered capture, if `n` is an integer. Use `0` for + // for the entire match. Any number of leading zeros may be used. + // 2. Backreference to named capture `n`, if it exists and is not an + // integer overridden by numbered capture. In practice, this does not + // overlap with numbered capture since XRegExp does not allow named + // capture to use a bare integer as the name. + // 3. If the name or number does not refer to an existing capturing group, + // it's an error. + n = +$1; // Type-convert; drop leading zeros + if (n <= args.length - 3) { + return args[n] || ''; + } + // Groups with the same name is an error, else would need `lastIndexOf` + n = captureNames ? indexOf(captureNames, $1) : -1; + if (n < 0) { + throw new SyntaxError('Backreference to undefined group ' + $0); + } + return args[n + 1] || ''; + } + // Else, special variable or numbered backreference without curly braces + if ($2 === '$') { // $$ + return '$'; + } + if ($2 === '&' || +$2 === 0) { // $&, $0 (not followed by 1-9), $00 + return args[0]; + } + if ($2 === '`') { // $` (left context) + return args[args.length - 1].slice(0, args[args.length - 2]); + } + if ($2 === "'") { // $' (right context) + return args[args.length - 1].slice(args[args.length - 2] + args[0].length); + } + // Else, numbered backreference without curly braces + $2 = +$2; // Type-convert; drop leading zero + // XRegExp behavior for `$n` and `$nn`: + // - Backrefs end after 1 or 2 digits. Use `${..}` for more digits. + // - `$1` is an error if no capturing groups. + // - `$10` is an error if less than 10 capturing groups. Use `${1}0` instead. + // - `$01` is `$1` if at least one capturing group, else it's an error. + // - `$0` (not followed by 1-9) and `$00` are the entire match. + // Native behavior, for comparison: + // - Backrefs end after 1 or 2 digits. Cannot reference capturing group 100+. + // - `$1` is a literal `$1` if no capturing groups. + // - `$10` is `$1` followed by a literal `0` if less than 10 capturing groups. + // - `$01` is `$1` if at least one capturing group, else it's a literal `$01`. + // - `$0` is a literal `$0`. + if (!isNaN($2)) { + if ($2 > args.length - 3) { + throw new SyntaxError('Backreference to undefined group ' + $0); + } + return args[$2] || ''; + } + // `$` followed by an unsupported char is an error, unlike native JS + throw new SyntaxError('Invalid token ' + $0); + }); + }); + } + + if (isRegex) { + if (search.global) { + // Fixes IE, Safari bug (last tested IE 9, Safari 5.1) + search.lastIndex = 0; + } else { + // Fixes IE, Opera bug (last tested IE 9, Opera 11.6) + search.lastIndex = origLastIndex; + } + } + + return result; + }; + +/** + * Fixes browser bugs in the native `String.prototype.split`. Calling `XRegExp.install('natives')` + * uses this to override the native method. Use via `XRegExp.split` without overriding natives. + * + * @private + * @param {RegExp|String} separator Regex or string to use for separating the string. + * @param {Number} [limit] Maximum number of items to include in the result array. + * @returns {Array} Array of substrings. + */ + fixed.split = function(separator, limit) { + if (!XRegExp.isRegExp(separator)) { + // Browsers handle nonregex split correctly, so use the faster native method + return nativ.split.apply(this, arguments); + } + + var str = String(this), + output = [], + origLastIndex = separator.lastIndex, + lastLastIndex = 0, + lastLength; + + // Values for `limit`, per the spec: + // If undefined: pow(2,32) - 1 + // If 0, Infinity, or NaN: 0 + // If positive number: limit = floor(limit); if (limit >= pow(2,32)) limit -= pow(2,32); + // If negative number: pow(2,32) - floor(abs(limit)) + // If other: Type-convert, then use the above rules + // This line fails in very strange ways for some values of `limit` in Opera 10.5-10.63, + // unless Opera Dragonfly is open (go figure). It works in at least Opera 9.5-10.1 and 11+ + limit = (limit === undefined ? -1 : limit) >>> 0; + + XRegExp.forEach(str, separator, function(match) { + // This condition is not the same as `if (match[0].length)` + if ((match.index + match[0].length) > lastLastIndex) { + output.push(str.slice(lastLastIndex, match.index)); + if (match.length > 1 && match.index < str.length) { + Array.prototype.push.apply(output, match.slice(1)); + } + lastLength = match[0].length; + lastLastIndex = match.index + lastLength; + } + }); + + if (lastLastIndex === str.length) { + if (!nativ.test.call(separator, '') || lastLength) { + output.push(''); + } + } else { + output.push(str.slice(lastLastIndex)); + } + + separator.lastIndex = origLastIndex; + return output.length > limit ? output.slice(0, limit) : output; + }; + +/* ============================== + * Built-in syntax/flag tokens + * ============================== */ + +/* + * Letter escapes that natively match literal characters: `\a`, `\A`, etc. These should be + * SyntaxErrors but are allowed in web reality. XRegExp makes them errors for cross-browser + * consistency and to reserve their syntax, but lets them be superseded by addons. + */ + XRegExp.addToken( + /\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4}|{[\dA-Fa-f]+})|x(?![\dA-Fa-f]{2}))/, + function(match, scope) { + // \B is allowed in default scope only + if (match[1] === 'B' && scope === defaultScope) { + return match[0]; + } + throw new SyntaxError('Invalid escape ' + match[0]); + }, + { + scope: 'all', + leadChar: '\\' + } + ); + +/* + * Unicode code point escape with curly braces: `\u{N..}`. `N..` is any one or more digit + * hexadecimal number from 0-10FFFF, and can include leading zeros. Requires the native ES6 `u` flag + * to support code points greater than U+FFFF. Avoids converting code points above U+FFFF to + * surrogate pairs (which could be done without flag `u`), since that could lead to broken behavior + * if you follow a `\u{N..}` token that references a code point above U+FFFF with a quantifier, or + * if you use the same in a character class. + */ + XRegExp.addToken( + /\\u{([\dA-Fa-f]+)}/, + function(match, scope, flags) { + var code = dec(match[1]); + if (code > 0x10FFFF) { + throw new SyntaxError('Invalid Unicode code point ' + match[0]); + } + if (code <= 0xFFFF) { + // Converting to \uNNNN avoids needing to escape the literal character and keep it + // separate from preceding tokens + return '\\u' + pad4(hex(code)); + } + // If `code` is between 0xFFFF and 0x10FFFF, require and defer to native handling + if (hasNativeU && flags.indexOf('u') > -1) { + return match[0]; + } + throw new SyntaxError('Cannot use Unicode code point above \\u{FFFF} without flag u'); + }, + { + scope: 'all', + leadChar: '\\' + } + ); + +/* + * Empty character class: `[]` or `[^]`. This fixes a critical cross-browser syntax inconsistency. + * Unless this is standardized (per the ES spec), regex syntax can't be accurately parsed because + * character class endings can't be determined. + */ + XRegExp.addToken( + /\[(\^?)]/, + function(match) { + // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S]. + // (?!) should work like \b\B, but is unreliable in some versions of Firefox + return match[1] ? '[\\s\\S]' : '\\b\\B'; + }, + {leadChar: '['} + ); + +/* + * Comment pattern: `(?# )`. Inline comments are an alternative to the line comments allowed in + * free-spacing mode (flag x). + */ + XRegExp.addToken( + /\(\?#[^)]*\)/, + function(match, scope, flags) { + // Keep tokens separated unless the following token is a quantifier + return isQuantifierNext(match.input, match.index + match[0].length, flags) ? + '' : '(?:)'; + }, + {leadChar: '('} + ); + +/* + * Whitespace and line comments, in free-spacing mode (aka extended mode, flag x) only. + */ + XRegExp.addToken( + /\s+|#.*/, + function(match, scope, flags) { + // Keep tokens separated unless the following token is a quantifier + return isQuantifierNext(match.input, match.index + match[0].length, flags) ? + '' : '(?:)'; + }, + {flag: 'x'} + ); + +/* + * Dot, in dotall mode (aka singleline mode, flag s) only. + */ + XRegExp.addToken( + /\./, + function() { + return '[\\s\\S]'; + }, + { + flag: 's', + leadChar: '.' + } + ); + +/* + * Named backreference: `\k`. Backreference names can use the characters A-Z, a-z, 0-9, _, + * and $ only. Also allows numbered backreferences as `\k`. + */ + XRegExp.addToken( + /\\k<([\w$]+)>/, + function(match) { + // Groups with the same name is an error, else would need `lastIndexOf` + var index = isNaN(match[1]) ? (indexOf(this.captureNames, match[1]) + 1) : +match[1], + endIndex = match.index + match[0].length; + if (!index || index > this.captureNames.length) { + throw new SyntaxError('Backreference to undefined group ' + match[0]); + } + // Keep backreferences separate from subsequent literal numbers + return '\\' + index + ( + endIndex === match.input.length || isNaN(match.input.charAt(endIndex)) ? + '' : '(?:)' + ); + }, + {leadChar: '\\'} + ); + +/* + * Numbered backreference or octal, plus any following digits: `\0`, `\11`, etc. Octals except `\0` + * not followed by 0-9 and backreferences to unopened capture groups throw an error. Other matches + * are returned unaltered. IE < 9 doesn't support backreferences above `\99` in regex syntax. + */ + XRegExp.addToken( + /\\(\d+)/, + function(match, scope) { + if ( + !( + scope === defaultScope && + /^[1-9]/.test(match[1]) && + +match[1] <= this.captureNames.length + ) && + match[1] !== '0' + ) { + throw new SyntaxError('Cannot use octal escape or backreference to undefined group ' + + match[0]); + } + return match[0]; + }, + { + scope: 'all', + leadChar: '\\' + } + ); + +/* + * Named capturing group; match the opening delimiter only: `(?`. Capture names can use the + * characters A-Z, a-z, 0-9, _, and $ only. Names can't be integers. Supports Python-style + * `(?P` as an alternate syntax to avoid issues in some older versions of Opera which natively + * supported the Python-style syntax. Otherwise, XRegExp might treat numbered backreferences to + * Python-style named capture as octals. + */ + XRegExp.addToken( + /\(\?P?<([\w$]+)>/, + function(match) { + // Disallow bare integers as names because named backreferences are added to match + // arrays and therefore numeric properties may lead to incorrect lookups + if (!isNaN(match[1])) { + throw new SyntaxError('Cannot use integer as capture name ' + match[0]); + } + if (match[1] === 'length' || match[1] === '__proto__') { + throw new SyntaxError('Cannot use reserved word as capture name ' + match[0]); + } + if (indexOf(this.captureNames, match[1]) > -1) { + throw new SyntaxError('Cannot use same name for multiple groups ' + match[0]); + } + this.captureNames.push(match[1]); + this.hasNamedCapture = true; + return '('; + }, + {leadChar: '('} + ); + +/* + * Capturing group; match the opening parenthesis only. Required for support of named capturing + * groups. Also adds explicit capture mode (flag n). + */ + XRegExp.addToken( + /\((?!\?)/, + function(match, scope, flags) { + if (flags.indexOf('n') > -1) { + return '(?:'; + } + this.captureNames.push(null); + return '('; + }, + { + optionalFlags: 'n', + leadChar: '(' + } + ); + +/* ============================== + * Expose XRegExp + * ============================== */ + + module.exports = XRegExp; diff --git a/tools/eslint/node_modules/xregexp/xregexp-all.js b/tools/eslint/node_modules/xregexp/xregexp-all.js deleted file mode 100644 index cfeed86e354004..00000000000000 --- a/tools/eslint/node_modules/xregexp/xregexp-all.js +++ /dev/null @@ -1,4486 +0,0 @@ -/*! - * XRegExp-All 3.0.0 - * - * Steven Levithan (c) 2012-2015 MIT License - */ - -// Module systems magic dance. Don't use strict mode for this function, so it can assign to global. -;(function(root, definition) { - var self; - - // RequireJS - if (typeof define === 'function') { - define(definition); - // CommonJS - } else if (typeof exports === 'object') { - self = definition(); - // Use Node.js's `module.exports`. This supports both `require('xregexp')` and - // `require('xregexp').XRegExp` - (typeof module === 'object' ? (module.exports = self) : exports).XRegExp = self; - //