From 6bb935c092170fea549f63a605055fc0a57abd1e Mon Sep 17 00:00:00 2001 From: isaacs Date: Sat, 29 Jun 2019 14:54:10 -0700 Subject: [PATCH] read-package-tree@5.3.1 --- node_modules/.gitignore | 45 +- node_modules/define-properties/.editorconfig | 13 + node_modules/define-properties/.jscs.json | 175 ++ node_modules/define-properties/.travis.yml | 233 +++ node_modules/define-properties/CHANGELOG.md | 44 + node_modules/define-properties/LICENSE | 21 + node_modules/define-properties/README.md | 86 + node_modules/define-properties/index.js | 58 + node_modules/define-properties/package.json | 69 + node_modules/define-properties/test/index.js | 125 ++ node_modules/es-abstract/.editorconfig | 13 + node_modules/es-abstract/.jscs.json | 174 ++ node_modules/es-abstract/.nycrc | 14 + node_modules/es-abstract/.travis.yml | 232 +++ node_modules/es-abstract/CHANGELOG.md | 175 ++ node_modules/es-abstract/GetIntrinsic.js | 177 ++ node_modules/es-abstract/LICENSE | 21 + node_modules/es-abstract/Makefile | 61 + node_modules/es-abstract/README.md | 44 + node_modules/es-abstract/es2015.js | 693 +++++++ node_modules/es-abstract/es2016.js | 16 + node_modules/es-abstract/es2017.js | 25 + node_modules/es-abstract/es5.js | 242 +++ node_modules/es-abstract/es6.js | 3 + node_modules/es-abstract/es7.js | 3 + node_modules/es-abstract/helpers/assign.js | 17 + node_modules/es-abstract/helpers/isFinite.js | 3 + node_modules/es-abstract/helpers/isNaN.js | 3 + .../es-abstract/helpers/isPrimitive.js | 3 + node_modules/es-abstract/helpers/mod.js | 4 + node_modules/es-abstract/helpers/sign.js | 3 + node_modules/es-abstract/index.js | 22 + node_modules/es-abstract/operations/2015.js | 78 + node_modules/es-abstract/operations/2016.js | 80 + node_modules/es-abstract/operations/2017.js | 82 + node_modules/es-abstract/operations/es5.js | 10 + node_modules/es-abstract/package.json | 102 ++ node_modules/es-abstract/test/GetIntrinsic.js | 34 + node_modules/es-abstract/test/diffOps.js | 24 + node_modules/es-abstract/test/es2015.js | 11 + node_modules/es-abstract/test/es2016.js | 11 + node_modules/es-abstract/test/es2017.js | 11 + node_modules/es-abstract/test/es5.js | 415 +++++ node_modules/es-abstract/test/es6.js | 18 + node_modules/es-abstract/test/es7.js | 18 + .../es-abstract/test/helpers/values.js | 53 + node_modules/es-abstract/test/index.js | 28 + node_modules/es-abstract/test/tests.js | 1610 +++++++++++++++++ node_modules/es-to-primitive/.editorconfig | 20 + node_modules/es-to-primitive/.jscs.json | 176 ++ node_modules/es-to-primitive/.travis.yml | 243 +++ node_modules/es-to-primitive/CHANGELOG.md | 38 + node_modules/es-to-primitive/LICENSE | 22 + node_modules/es-to-primitive/Makefile | 61 + node_modules/es-to-primitive/README.md | 51 + node_modules/es-to-primitive/es2015.js | 75 + node_modules/es-to-primitive/es5.js | 45 + node_modules/es-to-primitive/es6.js | 3 + .../es-to-primitive/helpers/isPrimitive.js | 3 + node_modules/es-to-primitive/index.js | 17 + node_modules/es-to-primitive/package.json | 86 + node_modules/es-to-primitive/test/es2015.js | 151 ++ node_modules/es-to-primitive/test/es5.js | 94 + node_modules/es-to-primitive/test/es6.js | 151 ++ node_modules/es-to-primitive/test/index.js | 20 + node_modules/function-bind/.editorconfig | 20 + node_modules/function-bind/.jscs.json | 176 ++ node_modules/function-bind/.npmignore | 22 + node_modules/function-bind/.travis.yml | 168 ++ node_modules/function-bind/LICENSE | 20 + node_modules/function-bind/README.md | 48 + node_modules/function-bind/implementation.js | 52 + node_modules/function-bind/index.js | 5 + node_modules/function-bind/package.json | 67 + node_modules/function-bind/test/index.js | 252 +++ node_modules/has-symbols/.npmignore | 37 + node_modules/has-symbols/.travis.yml | 113 ++ node_modules/has-symbols/CHANGELOG.md | 3 + node_modules/has-symbols/LICENSE | 21 + node_modules/has-symbols/README.md | 45 + node_modules/has-symbols/index.js | 13 + node_modules/has-symbols/package.json | 82 + node_modules/has-symbols/shams.js | 42 + node_modules/has-symbols/test/index.js | 22 + .../has-symbols/test/shams/core-js.js | 28 + .../test/shams/get-own-property-symbols.js | 28 + node_modules/has-symbols/test/tests.js | 54 + node_modules/has/LICENSE-MIT | 22 + node_modules/has/README.md | 18 + node_modules/has/package.json | 52 + node_modules/has/src/index.js | 5 + node_modules/has/test/index.js | 10 + node_modules/is-callable/.editorconfig | 20 + node_modules/is-callable/.istanbul.yml | 47 + node_modules/is-callable/.jscs.json | 176 ++ node_modules/is-callable/.travis.yml | 225 +++ node_modules/is-callable/CHANGELOG.md | 56 + node_modules/is-callable/LICENSE | 22 + node_modules/is-callable/Makefile | 61 + node_modules/is-callable/README.md | 59 + node_modules/is-callable/index.js | 37 + node_modules/is-callable/package.json | 98 + node_modules/is-callable/test.js | 158 ++ node_modules/is-date-object/.jscs.json | 122 ++ node_modules/is-date-object/.npmignore | 28 + node_modules/is-date-object/.travis.yml | 58 + node_modules/is-date-object/CHANGELOG.md | 10 + node_modules/is-date-object/LICENSE | 22 + node_modules/is-date-object/Makefile | 61 + node_modules/is-date-object/README.md | 53 + node_modules/is-date-object/index.js | 20 + node_modules/is-date-object/package.json | 66 + node_modules/is-date-object/test.js | 33 + node_modules/is-regex/.jscs.json | 176 ++ node_modules/is-regex/.npmignore | 15 + node_modules/is-regex/.travis.yml | 165 ++ node_modules/is-regex/CHANGELOG.md | 27 + node_modules/is-regex/LICENSE | 20 + node_modules/is-regex/Makefile | 61 + node_modules/is-regex/README.md | 54 + node_modules/is-regex/index.js | 39 + node_modules/is-regex/package.json | 77 + node_modules/is-regex/test.js | 58 + node_modules/is-symbol/.editorconfig | 13 + node_modules/is-symbol/.jscs.json | 176 ++ node_modules/is-symbol/.nvmrc | 1 + node_modules/is-symbol/.travis.yml | 241 +++ node_modules/is-symbol/CHANGELOG.md | 12 + node_modules/is-symbol/LICENSE | 22 + node_modules/is-symbol/Makefile | 61 + node_modules/is-symbol/README.md | 46 + node_modules/is-symbol/index.js | 35 + node_modules/is-symbol/package.json | 72 + node_modules/is-symbol/test/index.js | 92 + node_modules/object-keys/.editorconfig | 13 + node_modules/object-keys/.jscs.json | 175 ++ node_modules/object-keys/.travis.yml | 225 +++ node_modules/object-keys/CHANGELOG.md | 220 +++ node_modules/object-keys/LICENSE | 21 + node_modules/object-keys/README.md | 76 + node_modules/object-keys/index.js | 141 ++ node_modules/object-keys/isArguments.js | 17 + node_modules/object-keys/package.json | 94 + node_modules/object-keys/test/index.js | 5 + .../.editorconfig | 13 + .../.jscs.json | 176 ++ .../.npmignore | 28 + .../.travis.yml | 96 + .../CHANGELOG.md | 51 + .../object.getownpropertydescriptors/LICENSE | 22 + .../object.getownpropertydescriptors/Makefile | 61 + .../README.md | 99 + .../implementation.js | 44 + .../object.getownpropertydescriptors/index.js | 15 + .../package.json | 107 ++ .../polyfill.js | 7 + .../object.getownpropertydescriptors/shim.js | 14 + .../test/index.js | 17 + .../test/shimmed.js | 35 + .../test/tests.js | 127 ++ node_modules/read-package-tree/README.md | 3 + node_modules/read-package-tree/package.json | 32 +- node_modules/read-package-tree/realpath.js | 94 + node_modules/read-package-tree/rpt.js | 380 ++-- node_modules/util-promisify/.npmignore | 1 + node_modules/util-promisify/.travis.yml | 8 + node_modules/util-promisify/LICENSE | 1072 +++++++++++ node_modules/util-promisify/README.md | 42 + node_modules/util-promisify/index.js | 91 + node_modules/util-promisify/package.json | 45 + node_modules/util-promisify/test/common.js | 56 + node_modules/util-promisify/test/index.js | 194 ++ node_modules/util-promisify/test/timers.js | 38 + package-lock.json | 50 +- package.json | 2 +- test/tap/no-scan-full-global-dir.js | 11 +- 176 files changed, 14714 insertions(+), 282 deletions(-) create mode 100644 node_modules/define-properties/.editorconfig create mode 100644 node_modules/define-properties/.jscs.json create mode 100644 node_modules/define-properties/.travis.yml create mode 100644 node_modules/define-properties/CHANGELOG.md create mode 100644 node_modules/define-properties/LICENSE create mode 100644 node_modules/define-properties/README.md create mode 100644 node_modules/define-properties/index.js create mode 100644 node_modules/define-properties/package.json create mode 100644 node_modules/define-properties/test/index.js create mode 100644 node_modules/es-abstract/.editorconfig create mode 100644 node_modules/es-abstract/.jscs.json create mode 100644 node_modules/es-abstract/.nycrc create mode 100644 node_modules/es-abstract/.travis.yml create mode 100644 node_modules/es-abstract/CHANGELOG.md create mode 100644 node_modules/es-abstract/GetIntrinsic.js create mode 100644 node_modules/es-abstract/LICENSE create mode 100644 node_modules/es-abstract/Makefile create mode 100644 node_modules/es-abstract/README.md create mode 100644 node_modules/es-abstract/es2015.js create mode 100644 node_modules/es-abstract/es2016.js create mode 100644 node_modules/es-abstract/es2017.js create mode 100644 node_modules/es-abstract/es5.js create mode 100644 node_modules/es-abstract/es6.js create mode 100644 node_modules/es-abstract/es7.js create mode 100644 node_modules/es-abstract/helpers/assign.js create mode 100644 node_modules/es-abstract/helpers/isFinite.js create mode 100644 node_modules/es-abstract/helpers/isNaN.js create mode 100644 node_modules/es-abstract/helpers/isPrimitive.js create mode 100644 node_modules/es-abstract/helpers/mod.js create mode 100644 node_modules/es-abstract/helpers/sign.js create mode 100644 node_modules/es-abstract/index.js create mode 100644 node_modules/es-abstract/operations/2015.js create mode 100644 node_modules/es-abstract/operations/2016.js create mode 100644 node_modules/es-abstract/operations/2017.js create mode 100644 node_modules/es-abstract/operations/es5.js create mode 100644 node_modules/es-abstract/package.json create mode 100644 node_modules/es-abstract/test/GetIntrinsic.js create mode 100644 node_modules/es-abstract/test/diffOps.js create mode 100644 node_modules/es-abstract/test/es2015.js create mode 100644 node_modules/es-abstract/test/es2016.js create mode 100644 node_modules/es-abstract/test/es2017.js create mode 100644 node_modules/es-abstract/test/es5.js create mode 100644 node_modules/es-abstract/test/es6.js create mode 100644 node_modules/es-abstract/test/es7.js create mode 100644 node_modules/es-abstract/test/helpers/values.js create mode 100644 node_modules/es-abstract/test/index.js create mode 100644 node_modules/es-abstract/test/tests.js create mode 100644 node_modules/es-to-primitive/.editorconfig create mode 100644 node_modules/es-to-primitive/.jscs.json create mode 100644 node_modules/es-to-primitive/.travis.yml create mode 100644 node_modules/es-to-primitive/CHANGELOG.md create mode 100644 node_modules/es-to-primitive/LICENSE create mode 100644 node_modules/es-to-primitive/Makefile create mode 100644 node_modules/es-to-primitive/README.md create mode 100644 node_modules/es-to-primitive/es2015.js create mode 100644 node_modules/es-to-primitive/es5.js create mode 100644 node_modules/es-to-primitive/es6.js create mode 100644 node_modules/es-to-primitive/helpers/isPrimitive.js create mode 100644 node_modules/es-to-primitive/index.js create mode 100644 node_modules/es-to-primitive/package.json create mode 100644 node_modules/es-to-primitive/test/es2015.js create mode 100644 node_modules/es-to-primitive/test/es5.js create mode 100644 node_modules/es-to-primitive/test/es6.js create mode 100644 node_modules/es-to-primitive/test/index.js create mode 100644 node_modules/function-bind/.editorconfig create mode 100644 node_modules/function-bind/.jscs.json create mode 100644 node_modules/function-bind/.npmignore create mode 100644 node_modules/function-bind/.travis.yml create mode 100644 node_modules/function-bind/LICENSE create mode 100644 node_modules/function-bind/README.md create mode 100644 node_modules/function-bind/implementation.js create mode 100644 node_modules/function-bind/index.js create mode 100644 node_modules/function-bind/package.json create mode 100644 node_modules/function-bind/test/index.js create mode 100644 node_modules/has-symbols/.npmignore create mode 100644 node_modules/has-symbols/.travis.yml create mode 100644 node_modules/has-symbols/CHANGELOG.md create mode 100644 node_modules/has-symbols/LICENSE create mode 100644 node_modules/has-symbols/README.md create mode 100644 node_modules/has-symbols/index.js create mode 100644 node_modules/has-symbols/package.json create mode 100644 node_modules/has-symbols/shams.js create mode 100644 node_modules/has-symbols/test/index.js create mode 100644 node_modules/has-symbols/test/shams/core-js.js create mode 100644 node_modules/has-symbols/test/shams/get-own-property-symbols.js create mode 100644 node_modules/has-symbols/test/tests.js create mode 100644 node_modules/has/LICENSE-MIT create mode 100644 node_modules/has/README.md create mode 100644 node_modules/has/package.json create mode 100644 node_modules/has/src/index.js create mode 100644 node_modules/has/test/index.js create mode 100644 node_modules/is-callable/.editorconfig create mode 100644 node_modules/is-callable/.istanbul.yml create mode 100644 node_modules/is-callable/.jscs.json create mode 100644 node_modules/is-callable/.travis.yml create mode 100644 node_modules/is-callable/CHANGELOG.md create mode 100644 node_modules/is-callable/LICENSE create mode 100644 node_modules/is-callable/Makefile create mode 100644 node_modules/is-callable/README.md create mode 100644 node_modules/is-callable/index.js create mode 100644 node_modules/is-callable/package.json create mode 100644 node_modules/is-callable/test.js create mode 100644 node_modules/is-date-object/.jscs.json create mode 100644 node_modules/is-date-object/.npmignore create mode 100644 node_modules/is-date-object/.travis.yml create mode 100644 node_modules/is-date-object/CHANGELOG.md create mode 100644 node_modules/is-date-object/LICENSE create mode 100644 node_modules/is-date-object/Makefile create mode 100644 node_modules/is-date-object/README.md create mode 100644 node_modules/is-date-object/index.js create mode 100644 node_modules/is-date-object/package.json create mode 100644 node_modules/is-date-object/test.js create mode 100644 node_modules/is-regex/.jscs.json create mode 100644 node_modules/is-regex/.npmignore create mode 100644 node_modules/is-regex/.travis.yml create mode 100644 node_modules/is-regex/CHANGELOG.md create mode 100644 node_modules/is-regex/LICENSE create mode 100644 node_modules/is-regex/Makefile create mode 100644 node_modules/is-regex/README.md create mode 100644 node_modules/is-regex/index.js create mode 100644 node_modules/is-regex/package.json create mode 100644 node_modules/is-regex/test.js create mode 100644 node_modules/is-symbol/.editorconfig create mode 100644 node_modules/is-symbol/.jscs.json create mode 100644 node_modules/is-symbol/.nvmrc create mode 100644 node_modules/is-symbol/.travis.yml create mode 100644 node_modules/is-symbol/CHANGELOG.md create mode 100644 node_modules/is-symbol/LICENSE create mode 100644 node_modules/is-symbol/Makefile create mode 100644 node_modules/is-symbol/README.md create mode 100644 node_modules/is-symbol/index.js create mode 100644 node_modules/is-symbol/package.json create mode 100644 node_modules/is-symbol/test/index.js create mode 100644 node_modules/object-keys/.editorconfig create mode 100644 node_modules/object-keys/.jscs.json create mode 100644 node_modules/object-keys/.travis.yml create mode 100644 node_modules/object-keys/CHANGELOG.md create mode 100644 node_modules/object-keys/LICENSE create mode 100644 node_modules/object-keys/README.md create mode 100644 node_modules/object-keys/index.js create mode 100644 node_modules/object-keys/isArguments.js create mode 100644 node_modules/object-keys/package.json create mode 100644 node_modules/object-keys/test/index.js create mode 100644 node_modules/object.getownpropertydescriptors/.editorconfig create mode 100644 node_modules/object.getownpropertydescriptors/.jscs.json create mode 100644 node_modules/object.getownpropertydescriptors/.npmignore create mode 100644 node_modules/object.getownpropertydescriptors/.travis.yml create mode 100644 node_modules/object.getownpropertydescriptors/CHANGELOG.md create mode 100644 node_modules/object.getownpropertydescriptors/LICENSE create mode 100644 node_modules/object.getownpropertydescriptors/Makefile create mode 100644 node_modules/object.getownpropertydescriptors/README.md create mode 100644 node_modules/object.getownpropertydescriptors/implementation.js create mode 100644 node_modules/object.getownpropertydescriptors/index.js create mode 100644 node_modules/object.getownpropertydescriptors/package.json create mode 100644 node_modules/object.getownpropertydescriptors/polyfill.js create mode 100644 node_modules/object.getownpropertydescriptors/shim.js create mode 100644 node_modules/object.getownpropertydescriptors/test/index.js create mode 100644 node_modules/object.getownpropertydescriptors/test/shimmed.js create mode 100644 node_modules/object.getownpropertydescriptors/test/tests.js create mode 100644 node_modules/read-package-tree/realpath.js create mode 100644 node_modules/util-promisify/.npmignore create mode 100644 node_modules/util-promisify/.travis.yml create mode 100644 node_modules/util-promisify/LICENSE create mode 100644 node_modules/util-promisify/README.md create mode 100644 node_modules/util-promisify/index.js create mode 100644 node_modules/util-promisify/package.json create mode 100644 node_modules/util-promisify/test/common.js create mode 100644 node_modules/util-promisify/test/index.js create mode 100644 node_modules/util-promisify/test/timers.js diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 9c546797fd120..6fc6080041e4b 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -9,6 +9,7 @@ /@babel/template /@babel/traverse /@babel/types +/@blueoak/list /@types/caseless /@types/form-data /@types/node @@ -18,6 +19,7 @@ /acorn-jsx /ajv-keywords /ansi-escapes +/append-transform /arg /argparse /array-find-index @@ -28,6 +30,7 @@ /browser-process-hrtime /browser-request /builtin-modules +/caching-transform /caller /caller-path /callsites @@ -39,26 +42,30 @@ /cloudant-follow /coffee-script /color-support +/commander +/commondir /connect /contains-path +/convert-source-map /correct-license-metadata /couchapp /coveralls +/cp-file /debug-log /deep-equal /deep-is -/define-properties +/default-require-extensions /deglob /diff /docopt /doctrine /domain-browser /ee-first +/emoji-regex /encodeurl /error-ex /errs -/es-abstract -/es-to-primitive +/es6-error /escape-html /eslint /eslint-config-standard @@ -85,34 +92,34 @@ /figures /file-entry-cache /finalhandler +/find-cache-dir /find-root /flat-cache /foreground-child /fs-access /fs-constants /fs-exists-cached -/function-bind /function-loop /functional-red-black-tree /get-stdin /globals /growl -/has +/handlebars /has-ansi -/has-symbols +/hasha /hock /http-proxy /ignore /inquirer /is-arrayish -/is-callable -/is-date-object /is-promise -/is-regex /is-resolvable -/is-symbol /istanbul-lib-coverage +/istanbul-lib-hook /istanbul-lib-instrument +/istanbul-lib-report +/istanbul-lib-source-maps +/istanbul-reports /js-tokens /js-yaml /jsesc @@ -125,26 +132,33 @@ /licensee /load-json-file /lodash -/lodash.isempty +/lodash.flattendeep /log-driver /loose-envify /make-error +/map-age-cleaner /marked /marked-man +/merge-source-map /nano /natural-compare +/neo-async +/nested-error-stacks +/nice-try /npm-license-corrections /npm-registry-couchapp /npm-registry-mock /null-check /nyc -/object-keys /on-finished /onetime /optimist /optionator /own-or /own-or-env +/p-defer +/p-is-promise +/package-hash /parse-json /parseurl /path-type @@ -161,6 +175,7 @@ /querystring /read-pkg /read-pkg-up +/release-zalgo /require-inject /require-uncached /resolve @@ -173,10 +188,12 @@ /slice-ansi /source-map /source-map-support +/spawn-wrap /spdx-compare /spdx-expression-validate +/spdx-osi /spdx-ranges -/spdx-satisfies +/spdx-whitelisted /sprintf-js /stack-utils /standard @@ -189,6 +206,7 @@ /tap-mocha-reporter /tap-parser /tar-stream +/test-exclude /tmatch /tmp /to-fast-properties @@ -198,6 +216,7 @@ /tsame /type-check /typescript +/uglify-js /unicode-length /uniq /url diff --git a/node_modules/define-properties/.editorconfig b/node_modules/define-properties/.editorconfig new file mode 100644 index 0000000000000..eaa214161f5cd --- /dev/null +++ b/node_modules/define-properties/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/define-properties/.jscs.json b/node_modules/define-properties/.jscs.json new file mode 100644 index 0000000000000..6f2d7f9ff9b1f --- /dev/null +++ b/node_modules/define-properties/.jscs.json @@ -0,0 +1,175 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 3 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/define-properties/.travis.yml b/node_modules/define-properties/.travis.yml new file mode 100644 index 0000000000000..ec72d5f3d36b7 --- /dev/null +++ b/node_modules/define-properties/.travis.yml @@ -0,0 +1,233 @@ +language: node_js +os: + - linux +node_js: + - "10.8" + - "9.11" + - "8.11" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "10.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - env: COVERAGE=true diff --git a/node_modules/define-properties/CHANGELOG.md b/node_modules/define-properties/CHANGELOG.md new file mode 100644 index 0000000000000..5cad1e26a0194 --- /dev/null +++ b/node_modules/define-properties/CHANGELOG.md @@ -0,0 +1,44 @@ +1.1.3 / 2018-08-14 +================= + * [Refactor] use a for loop instead of `foreach` to make for smaller bundle sizes + * [Robustness] cache `Array.prototype.concat` and `Object.defineProperty` + * [Deps] update `object-keys` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape`, `jscs`; remove unused eccheck script + dep + * [Tests] use pretest/posttest for linting/security + * [Tests] fix npm upgrades on older nodes + +1.1.2 / 2015-10-14 +================= + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Deps] Update `object-keys` + * [Dev Deps] update `jscs`, `tape`, `eslint`, `@ljharb/eslint-config`, `nsp` + * [Tests] up to `io.js` `v3.3`, `node` `v4.2` + +1.1.1 / 2015-07-21 +================= + * [Deps] Update `object-keys` + * [Dev Deps] Update `tape`, `eslint` + * [Tests] Test on `io.js` `v2.4` + +1.1.0 / 2015-07-01 +================= + * [New] Add support for symbol-valued properties. + * [Dev Deps] Update `nsp`, `eslint` + * [Tests] Test up to `io.js` `v2.3` + +1.0.3 / 2015-05-30 +================= + * Using a more reliable check for supported property descriptors. + +1.0.2 / 2015-05-23 +================= + * Test up to `io.js` `v2.0` + * Update `tape`, `jscs`, `nsp`, `eslint`, `object-keys`, `editorconfig-tools`, `covert` + +1.0.1 / 2015-01-06 +================= + * Update `object-keys` to fix ES3 support + +1.0.0 / 2015-01-04 +================= + * v1.0.0 diff --git a/node_modules/define-properties/LICENSE b/node_modules/define-properties/LICENSE new file mode 100644 index 0000000000000..8c271c14b62fa --- /dev/null +++ b/node_modules/define-properties/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2015 Jordan Harband + +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. \ No newline at end of file diff --git a/node_modules/define-properties/README.md b/node_modules/define-properties/README.md new file mode 100644 index 0000000000000..33b6111f16185 --- /dev/null +++ b/node_modules/define-properties/README.md @@ -0,0 +1,86 @@ +#define-properties [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines. +Existing properties are not overridden. Accepts a map of property names to a predicate that, when true, force-overrides. + +## Example + +```js +var define = require('define-properties'); +var assert = require('assert'); + +var obj = define({ a: 1, b: 2 }, { + a: 10, + b: 20, + c: 30 +}); +assert(obj.a === 1); +assert(obj.b === 2); +assert(obj.c === 30); +if (define.supportsDescriptors) { + assert.deepEqual(Object.keys(obj), ['a', 'b']); + assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'c'), { + configurable: true, + enumerable: false, + value: 30, + writable: false + }); +} +``` + +Then, with predicates: +```js +var define = require('define-properties'); +var assert = require('assert'); + +var obj = define({ a: 1, b: 2, c: 3 }, { + a: 10, + b: 20, + c: 30 +}, { + a: function () { return false; }, + b: function () { return true; } +}); +assert(obj.a === 1); +assert(obj.b === 20); +assert(obj.c === 3); +if (define.supportsDescriptors) { + assert.deepEqual(Object.keys(obj), ['a', 'c']); + assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'b'), { + configurable: true, + enumerable: false, + value: 20, + writable: false + }); +} +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/define-properties +[npm-version-svg]: http://versionbadg.es/ljharb/define-properties.svg +[travis-svg]: https://travis-ci.org/ljharb/define-properties.svg +[travis-url]: https://travis-ci.org/ljharb/define-properties +[deps-svg]: https://david-dm.org/ljharb/define-properties.svg +[deps-url]: https://david-dm.org/ljharb/define-properties +[dev-deps-svg]: https://david-dm.org/ljharb/define-properties/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/define-properties#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/define-properties.png +[testling-url]: https://ci.testling.com/ljharb/define-properties +[npm-badge-png]: https://nodei.co/npm/define-properties.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/define-properties.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/define-properties.svg +[downloads-url]: http://npm-stat.com/charts.html?package=define-properties + diff --git a/node_modules/define-properties/index.js b/node_modules/define-properties/index.js new file mode 100644 index 0000000000000..cb3ae1c7cb398 --- /dev/null +++ b/node_modules/define-properties/index.js @@ -0,0 +1,58 @@ +'use strict'; + +var keys = require('object-keys'); +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; + +var toStr = Object.prototype.toString; +var concat = Array.prototype.concat; +var origDefineProperty = Object.defineProperty; + +var isFunction = function (fn) { + return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; +}; + +var arePropertyDescriptorsSupported = function () { + var obj = {}; + try { + origDefineProperty(obj, 'x', { enumerable: false, value: obj }); + // eslint-disable-next-line no-unused-vars, no-restricted-syntax + for (var _ in obj) { // jscs:ignore disallowUnusedVariables + return false; + } + return obj.x === obj; + } catch (e) { /* this is IE 8. */ + return false; + } +}; +var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported(); + +var defineProperty = function (object, name, value, predicate) { + if (name in object && (!isFunction(predicate) || !predicate())) { + return; + } + if (supportsDescriptors) { + origDefineProperty(object, name, { + configurable: true, + enumerable: false, + value: value, + writable: true + }); + } else { + object[name] = value; + } +}; + +var defineProperties = function (object, map) { + var predicates = arguments.length > 2 ? arguments[2] : {}; + var props = keys(map); + if (hasSymbols) { + props = concat.call(props, Object.getOwnPropertySymbols(map)); + } + for (var i = 0; i < props.length; i += 1) { + defineProperty(object, props[i], map[props[i]], predicates[props[i]]); + } +}; + +defineProperties.supportsDescriptors = !!supportsDescriptors; + +module.exports = defineProperties; diff --git a/node_modules/define-properties/package.json b/node_modules/define-properties/package.json new file mode 100644 index 0000000000000..c6b2f975b775e --- /dev/null +++ b/node_modules/define-properties/package.json @@ -0,0 +1,69 @@ +{ + "name": "define-properties", + "version": "1.1.3", + "author": "Jordan Harband", + "description": "Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent security", + "tests-only": "node test/index.js", + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "lint": "npm run --silent jscs && npm run --silent eslint", + "jscs": "jscs test/*.js *.js", + "eslint": "eslint test/*.js *.js", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/define-properties.git" + }, + "keywords": [ + "Object.defineProperty", + "Object.defineProperties", + "object", + "property descriptor", + "descriptor", + "define", + "ES5" + ], + "dependencies": { + "object-keys": "^1.0.12" + }, + "devDependencies": { + "@ljharb/eslint-config": "^13.0.0", + "covert": "^1.1.0", + "eslint": "^5.3.0", + "jscs": "^3.0.7", + "nsp": "^3.2.1", + "tape": "^4.9.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz" +,"_integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==" +,"_from": "define-properties@1.1.3" +} \ No newline at end of file diff --git a/node_modules/define-properties/test/index.js b/node_modules/define-properties/test/index.js new file mode 100644 index 0000000000000..3387f6bc7bbe9 --- /dev/null +++ b/node_modules/define-properties/test/index.js @@ -0,0 +1,125 @@ +'use strict'; + +var define = require('../'); +var test = require('tape'); +var keys = require('object-keys'); + +var arePropertyDescriptorsSupported = function () { + var obj = { a: 1 }; + try { + Object.defineProperty(obj, 'x', { value: obj }); + return obj.x === obj; + } catch (e) { /* this is IE 8. */ + return false; + } +}; +var descriptorsSupported = !!Object.defineProperty && arePropertyDescriptorsSupported(); + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; + +test('defineProperties', function (dt) { + dt.test('with descriptor support', { skip: !descriptorsSupported }, function (t) { + var getDescriptor = function (value) { + return { + configurable: true, + enumerable: false, + value: value, + writable: true + }; + }; + + var obj = { + a: 1, + b: 2, + c: 3 + }; + t.deepEqual(keys(obj), ['a', 'b', 'c'], 'all literal-set keys start enumerable'); + define(obj, { + b: 3, + c: 4, + d: 5 + }); + t.deepEqual(obj, { + a: 1, + b: 2, + c: 3 + }, 'existing properties were not overridden'); + t.deepEqual(Object.getOwnPropertyDescriptor(obj, 'd'), getDescriptor(5), 'new property "d" was added and is not enumerable'); + t.deepEqual(['a', 'b', 'c'], keys(obj), 'new keys are not enumerable'); + + define(obj, { + a: 2, + b: 3, + c: 4 + }, { + a: function () { return true; }, + b: function () { return false; } + }); + t.deepEqual(obj, { + b: 2, + c: 3 + }, 'properties only overriden when predicate exists and returns true'); + t.deepEqual(Object.getOwnPropertyDescriptor(obj, 'd'), getDescriptor(5), 'existing property "d" remained and is not enumerable'); + t.deepEqual(Object.getOwnPropertyDescriptor(obj, 'a'), getDescriptor(2), 'existing property "a" was overridden and is not enumerable'); + t.deepEqual(['b', 'c'], keys(obj), 'overridden keys are not enumerable'); + + t.end(); + }); + + dt.test('without descriptor support', { skip: descriptorsSupported }, function (t) { + var obj = { + a: 1, + b: 2, + c: 3 + }; + define(obj, { + b: 3, + c: 4, + d: 5 + }); + t.deepEqual(obj, { + a: 1, + b: 2, + c: 3, + d: 5 + }, 'existing properties were not overridden, new properties were added'); + + define(obj, { + a: 2, + b: 3, + c: 4 + }, { + a: function () { return true; }, + b: function () { return false; } + }); + t.deepEqual(obj, { + a: 2, + b: 2, + c: 3, + d: 5 + }, 'properties only overriden when predicate exists and returns true'); + + t.end(); + }); + + dt.end(); +}); + +test('symbols', { skip: !hasSymbols }, function (t) { + var sym = Symbol('foo'); + var obj = {}; + var aValue = {}; + var bValue = {}; + var properties = { a: aValue }; + properties[sym] = bValue; + + define(obj, properties); + + t.deepEqual(Object.keys(obj), [], 'object has no enumerable keys'); + t.deepEqual(Object.getOwnPropertyNames(obj), ['a'], 'object has non-enumerable "a" key'); + t.deepEqual(Object.getOwnPropertySymbols(obj), [sym], 'object has non-enumerable symbol key'); + t.equal(obj.a, aValue, 'string keyed value is defined'); + t.equal(obj[sym], bValue, 'symbol keyed value is defined'); + + t.end(); +}); diff --git a/node_modules/es-abstract/.editorconfig b/node_modules/es-abstract/.editorconfig new file mode 100644 index 0000000000000..eaa214161f5cd --- /dev/null +++ b/node_modules/es-abstract/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/es-abstract/.jscs.json b/node_modules/es-abstract/.jscs.json new file mode 100644 index 0000000000000..857f88f1d5f8e --- /dev/null +++ b/node_modules/es-abstract/.jscs.json @@ -0,0 +1,174 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 9 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": false, + + "validateOrderInObjectKeys": false, + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": false, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/es-abstract/.nycrc b/node_modules/es-abstract/.nycrc new file mode 100644 index 0000000000000..1b02cf1848d84 --- /dev/null +++ b/node_modules/es-abstract/.nycrc @@ -0,0 +1,14 @@ +{ + "all": true, + "check-coverage": true, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 87.03, + "statements": 86.87, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "operations", + "test" + ] +} diff --git a/node_modules/es-abstract/.travis.yml b/node_modules/es-abstract/.travis.yml new file mode 100644 index 0000000000000..ce65a2f98159a --- /dev/null +++ b/node_modules/es-abstract/.travis.yml @@ -0,0 +1,232 @@ +language: node_js +os: + - linux +node_js: + - "10.2" + - "9.11" + - "8.11" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" + - "0.6" +cache: + directories: + - "$HOME/.npm" + - "$(nvm cache dir)" + - "$(nvm_version_path $(nvm_version_remote 0.4))" + - "$(nvm_version_path $(nvm_version_remote 0.6))" + - "$(nvm_version_path $(nvm_version_remote 0.10))" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage && bash <(curl -s https://codecov.io/bash) -f coverage/*.json; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "0.8" + env: COVERAGE=true + - node_js: "0.12" + env: COVERAGE=true + - node_js: "4" + env: COVERAGE=true + - node_js: "8" + env: COVERAGE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/es-abstract/CHANGELOG.md b/node_modules/es-abstract/CHANGELOG.md new file mode 100644 index 0000000000000..daa7b660a8cfc --- /dev/null +++ b/node_modules/es-abstract/CHANGELOG.md @@ -0,0 +1,175 @@ +1.12.0 / 2018-05-31 +================= + * [New] add `GetIntrinsic` entry point + * [New] `ES2015`+: add `ObjectCreate` + * [Robustness]: `ES2015+`: ensure `Math.{abs,floor}` and `Function.call` are cached + +1.11.0 / 2018-03-21 +================= + * [New] `ES2015+`: add iterator abstract ops + * [Dev Deps] update `eslint`, `nsp`, `object.assign`, `semver`, `tape` + * [Tests] up to `node` `v9.8`, `v8.10`, `v6.13` + +1.10.0 / 2017-11-24 +================= + * [New] ES2015+: `AdvanceStringIndex` + * [Dev Deps] update `eslint`, `nsp` + * [Tests] require node 0.6 to pass again + * [Tests] up to `node` `v9.2`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS + +1.9.0 / 2017-09-30 +================= + * [New] `es2015+`: add `ArraySpeciesCreate` + * [New] ES2015+: add `CreateDataProperty` and `CreateDataPropertyOrThrow` + * [Tests] consolidate duplicated tests + * [Tests] increase coverage + * [Dev Deps] update `nsp`, `eslint` + +1.8.2 / 2017-09-03 +================= + * [Fix] `es2015`+: `ToNumber`: provide the proper hint for Date objects (#27) + * [Dev Deps] update `eslint` + +1.8.1 / 2017-08-30 +================= + * [Fix] ES2015+: `ToPropertyKey`: should return a symbol for Symbols (#26) + * [Deps] update `function-bind` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config` + * [Docs] github broke markdown parsing + +1.8.0 / 2017-08-04 +================= + * [New] add ES2017 + * [New] move es6+ to es2015+; leave es6/es7 as aliases + * [New] ES5+: add `IsPropertyDescriptor`, `IsAccessorDescriptor`, `IsDataDescriptor`, `IsGenericDescriptor`, `FromPropertyDescriptor`, `ToPropertyDescriptor` + * [New] ES2015+: add `CompletePropertyDescriptor`, `Set`, `HasOwnProperty`, `HasProperty`, `IsConcatSpreadable`, `Invoke`, `CreateIterResultObject`, `RegExpExec` + * [Fix] es7/es2016: do not mutate ES6 + * [Fix] assign helper only supports one source + * [Deps] update `is-regex` + * [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `semver`, `tape` + * [Tests] add tests for missing and excess operations + * [Tests] add codecov for coverage + * [Tests] up to `node` `v8.2`, `v7.10`, `v6.11`, `v4.8`; newer npm breaks on older node + * [Tests] use same lists of value types across tests; ensure tests are the same when ops are the same + * [Tests] ES2015: add ToNumber symbol tests + * [Tests] switch to `nyc` for code coverage + * [Tests] make IsRegExp tests consistent across editions + +1.7.0 / 2017-01-22 +================= + * [New] ES6: Add `GetMethod` (#16) + * [New] ES6: Add `GetV` (#16) + * [New] ES6: Add `Get` (#17) + * [Tests] up to `node` `v7.4`, `v6.9`, `v4.6`; improve test matrix + * [Dev Deps] update `tape`, `nsp`, `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` + +1.6.1 / 2016-08-21 +================= + * [Fix] ES6: IsConstructor should return true for `class` constructors. + +1.6.0 / 2016-08-20 +================= + * [New] ES5 / ES6: add `Type` + * [New] ES6: `SpeciesConstructor` + * [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`; add `safe-publish-latest` + * [Tests] up to `node` `v6.4`, `v5.12`, `v4.5` + +1.5.1 / 2016-05-30 +================= + * [Fix] `ES.IsRegExp`: actually look up `Symbol.match` on the argument + * [Refactor] create `isNaN` helper + * [Deps] update `is-callable`, `function-bind` + * [Deps] update `es-to-primitive`, fix ES5 tests + * [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `tape`, `nsp` + * [Tests] up to `node` `v6.2`, `v5.11`, `v4.4` + * [Tests] use pretest/posttest for linting/security + +1.5.0 / 2015-12-27 +================= + * [New] adds `Symbol.toPrimitive` support via `es-to-primitive` + * [Deps] update `is-callable`, `es-to-primitive` + * [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `tape` + * [Tests] up to `node` `v5.3` + +1.4.3 / 2015-11-04 +================= + * [Fix] `ES6.ToNumber`: should give `NaN` for explicitly signed hex strings (#4) + * [Refactor] `ES6.ToNumber`: No need to double-trim + * [Refactor] group tests better + * [Tests] should still pass on `node` `v0.8` + +1.4.2 / 2015-11-02 +================= + * [Fix] ensure `ES.ToNumber` trims whitespace, and does not trim non-whitespace (#3) + +1.4.1 / 2015-10-31 +================= + * [Fix] ensure only 0-1 are valid binary and 0-7 are valid octal digits (#2) + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` + * [Tests] on `node` `v5.0` + * [Tests] fix npm upgrades for older node versions + * package.json: use object form of "authors", add "contributors" + +1.4.0 / 2015-09-26 +================= + * [Deps] update `is-callable` + * [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` + * [Tests] on `node` `v4.2` + * [New] Add `SameValueNonNumber` to ES7 + +1.3.2 / 2015-09-26 +================= + * [Fix] Fix `ES6.IsRegExp` to properly handle `Symbol.match`, per spec. + * [Tests] up to `io.js` `v3.3`, `node` `v4.1` + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` + +1.3.1 / 2015-08-15 +================= + * [Fix] Ensure that objects that `toString` to a binary or octal literal also convert properly + +1.3.0 / 2015-08-15 +================= + * [New] ES6’s ToNumber now supports binary and octal literals. + * [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `tape` + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Tests] up to `io.js` `v3.0` + +1.2.2 / 2015-07-28 +================= + * [Fix] Both `ES5.CheckObjectCoercible` and `ES6.RequireObjectCoercible` return the value if they don't throw. + * [Tests] Test on latest `io.js` versions. + * [Dev Deps] Update `eslint`, `jscs`, `tape`, `semver`, `covert`, `nsp` + +1.2.1 / 2015-03-20 +================= + * Fix `isFinite` helper. + +1.2.0 / 2015-03-19 +================= + * Use `es-to-primitive` for ToPrimitive methods. + * Test on latest `io.js` versions; allow failures on all but 2 latest `node`/`io.js` versions. + +1.1.2 / 2015-03-20 +================= + * Fix isFinite helper. + +1.1.1 / 2015-03-19 +================= + * Fix isPrimitive check for functions + * Update `eslint`, `editorconfig-tools`, `semver`, `nsp` + +1.1.0 / 2015-02-17 +================= + * Add ES7 export (non-default). + * All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. + * Test on `iojs-v1.2`. + +1.0.1 / 2015-01-30 +================= + * Use `is-callable` instead of an internal function. + * Update `tape`, `jscs`, `nsp`, `eslint` + +1.0.0 / 2015-01-10 +================= + * v1.0.0 diff --git a/node_modules/es-abstract/GetIntrinsic.js b/node_modules/es-abstract/GetIntrinsic.js new file mode 100644 index 0000000000000..62dbf05d6379a --- /dev/null +++ b/node_modules/es-abstract/GetIntrinsic.js @@ -0,0 +1,177 @@ +'use strict'; + +/* globals + Set, + Map, + WeakSet, + WeakMap, + + Promise, + + Symbol, + Proxy, + + Atomics, + SharedArrayBuffer, + + ArrayBuffer, + DataView, + Uint8Array, + Float32Array, + Float64Array, + Int8Array, + Int16Array, + Int32Array, + Uint8ClampedArray, + Uint16Array, + Uint32Array, +*/ + +var undefined; // eslint-disable-line no-shadow-restricted-names + +var ThrowTypeError = Object.getOwnPropertyDescriptor + ? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }()) + : function () { throw new TypeError(); }; + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; + +var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto + +var generator; // = function * () {}; +var generatorFunction = generator ? getProto(generator) : undefined; +var asyncFn; // async function() {}; +var asyncFunction = asyncFn ? asyncFn.constructor : undefined; +var asyncGen; // async function * () {}; +var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined; +var asyncGenIterator = asyncGen ? asyncGen() : undefined; + +var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + '$ %Array%': Array, + '$ %ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '$ %ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype, + '$ %ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '$ %ArrayPrototype%': Array.prototype, + '$ %ArrayProto_entries%': Array.prototype.entries, + '$ %ArrayProto_forEach%': Array.prototype.forEach, + '$ %ArrayProto_keys%': Array.prototype.keys, + '$ %ArrayProto_values%': Array.prototype.values, + '$ %AsyncFromSyncIteratorPrototype%': undefined, + '$ %AsyncFunction%': asyncFunction, + '$ %AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined, + '$ %AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined, + '$ %AsyncGeneratorFunction%': asyncGenFunction, + '$ %AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined, + '$ %AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined, + '$ %Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '$ %Boolean%': Boolean, + '$ %BooleanPrototype%': Boolean.prototype, + '$ %DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '$ %DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype, + '$ %Date%': Date, + '$ %DatePrototype%': Date.prototype, + '$ %decodeURI%': decodeURI, + '$ %decodeURIComponent%': decodeURIComponent, + '$ %encodeURI%': encodeURI, + '$ %encodeURIComponent%': encodeURIComponent, + '$ %Error%': Error, + '$ %ErrorPrototype%': Error.prototype, + '$ %eval%': eval, // eslint-disable-line no-eval + '$ %EvalError%': EvalError, + '$ %EvalErrorPrototype%': EvalError.prototype, + '$ %Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '$ %Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype, + '$ %Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '$ %Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype, + '$ %Function%': Function, + '$ %FunctionPrototype%': Function.prototype, + '$ %Generator%': generator ? getProto(generator()) : undefined, + '$ %GeneratorFunction%': generatorFunction, + '$ %GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined, + '$ %Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '$ %Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype, + '$ %Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '$ %Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype, + '$ %Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '$ %Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype, + '$ %isFinite%': isFinite, + '$ %isNaN%': isNaN, + '$ %IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '$ %JSON%': JSON, + '$ %JSONParse%': JSON.parse, + '$ %Map%': typeof Map === 'undefined' ? undefined : Map, + '$ %MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '$ %MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype, + '$ %Math%': Math, + '$ %Number%': Number, + '$ %NumberPrototype%': Number.prototype, + '$ %Object%': Object, + '$ %ObjectPrototype%': Object.prototype, + '$ %ObjProto_toString%': Object.prototype.toString, + '$ %ObjProto_valueOf%': Object.prototype.valueOf, + '$ %parseFloat%': parseFloat, + '$ %parseInt%': parseInt, + '$ %Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '$ %PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype, + '$ %PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then, + '$ %Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all, + '$ %Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject, + '$ %Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve, + '$ %Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '$ %RangeError%': RangeError, + '$ %RangeErrorPrototype%': RangeError.prototype, + '$ %ReferenceError%': ReferenceError, + '$ %ReferenceErrorPrototype%': ReferenceError.prototype, + '$ %Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '$ %RegExp%': RegExp, + '$ %RegExpPrototype%': RegExp.prototype, + '$ %Set%': typeof Set === 'undefined' ? undefined : Set, + '$ %SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '$ %SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype, + '$ %SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '$ %SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype, + '$ %String%': String, + '$ %StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '$ %StringPrototype%': String.prototype, + '$ %Symbol%': hasSymbols ? Symbol : undefined, + '$ %SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined, + '$ %SyntaxError%': SyntaxError, + '$ %SyntaxErrorPrototype%': SyntaxError.prototype, + '$ %ThrowTypeError%': ThrowTypeError, + '$ %TypedArray%': TypedArray, + '$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined, + '$ %TypeError%': TypeError, + '$ %TypeErrorPrototype%': TypeError.prototype, + '$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype, + '$ %Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '$ %Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype, + '$ %Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '$ %Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype, + '$ %Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '$ %Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype, + '$ %URIError%': URIError, + '$ %URIErrorPrototype%': URIError.prototype, + '$ %WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '$ %WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype, + '$ %WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet, + '$ %WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new TypeError('"allowMissing" argument must be a boolean'); + } + + var key = '$ ' + name; + if (!(key in INTRINSICS)) { + throw new SyntaxError('intrinsic ' + name + ' does not exist!'); + } + + // istanbul ignore if // hopefully this is impossible to test :-) + if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) { + throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + return INTRINSICS[key]; +}; diff --git a/node_modules/es-abstract/LICENSE b/node_modules/es-abstract/LICENSE new file mode 100644 index 0000000000000..8c271c14b62fa --- /dev/null +++ b/node_modules/es-abstract/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2015 Jordan Harband + +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. \ No newline at end of file diff --git a/node_modules/es-abstract/Makefile b/node_modules/es-abstract/Makefile new file mode 100644 index 0000000000000..959bbd49c1def --- /dev/null +++ b/node_modules/es-abstract/Makefile @@ -0,0 +1,61 @@ +# Since we rely on paths relative to the makefile location, abort if make isn't being run from there. +$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) + + # The files that need updating when incrementing the version number. +VERSIONED_FILES := *.js */*.js *.json README* + + +# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. +# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment +# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. +export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") +UTILS := semver +# Make sure that all required utilities can be located. +UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) + +# Default target (by virtue of being the first non '.'-prefixed in the file). +.PHONY: _no-target-specified +_no-target-specified: + $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) + +# Lists all targets defined in this makefile. +.PHONY: list +list: + @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort + +# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). +.PHONY: test +test: + @npm test + +.PHONY: _ensure-tag +_ensure-tag: +ifndef TAG + $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) +endif + +CHANGELOG_ERROR = $(error No CHANGELOG specified) +.PHONY: _ensure-changelog +_ensure-changelog: + @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) + +# Ensures that the git workspace is clean. +.PHONY: _ensure-clean +_ensure-clean: + @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } + +# Makes a release; invoke with `make TAG= release`. +.PHONY: release +release: _ensure-tag _ensure-changelog _ensure-clean + @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ + new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ + if printf "$$new_ver" | command grep -q '^[0-9]'; then \ + semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ + semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ + else \ + new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ + fi; \ + printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ + replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ + git tag -a -m "v$$new_ver" "v$$new_ver" diff --git a/node_modules/es-abstract/README.md b/node_modules/es-abstract/README.md new file mode 100644 index 0000000000000..0fbf079ccb97d --- /dev/null +++ b/node_modules/es-abstract/README.md @@ -0,0 +1,44 @@ +# es-abstract [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +ECMAScript spec abstract operations. +When different versions of the spec conflict, the default export will be the latest version of the abstract operation. +All abstract operations will also be available under an `es5`/`es2015`/`es2016` entry point, and exported property, if you require a specific version. + +## Example + +```js +var ES = require('es-abstract'); +var assert = require('assert'); + +assert(ES.isCallable(function () {})); +assert(!ES.isCallable(/a/g)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/es-abstract +[npm-version-svg]: http://versionbadg.es/ljharb/es-abstract.svg +[travis-svg]: https://travis-ci.org/ljharb/es-abstract.svg +[travis-url]: https://travis-ci.org/ljharb/es-abstract +[deps-svg]: https://david-dm.org/ljharb/es-abstract.svg +[deps-url]: https://david-dm.org/ljharb/es-abstract +[dev-deps-svg]: https://david-dm.org/ljharb/es-abstract/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-abstract#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/es-abstract.png +[testling-url]: https://ci.testling.com/ljharb/es-abstract +[npm-badge-png]: https://nodei.co/npm/es-abstract.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/es-abstract.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/es-abstract.svg +[downloads-url]: https://npm-stat.com/charts.html?package=es-abstract diff --git a/node_modules/es-abstract/es2015.js b/node_modules/es-abstract/es2015.js new file mode 100644 index 0000000000000..1a4d7de5608db --- /dev/null +++ b/node_modules/es-abstract/es2015.js @@ -0,0 +1,693 @@ +'use strict'; + +var has = require('has'); +var toPrimitive = require('es-to-primitive/es6'); + +var GetIntrinsic = require('./GetIntrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var $Array = GetIntrinsic('%Array%'); +var $String = GetIntrinsic('%String%'); +var $Object = GetIntrinsic('%Object%'); +var $Number = GetIntrinsic('%Number%'); +var $Symbol = GetIntrinsic('%Symbol%', true); +var $RegExp = GetIntrinsic('%RegExp%'); + +var hasSymbols = !!$Symbol; + +var $isNaN = require('./helpers/isNaN'); +var $isFinite = require('./helpers/isFinite'); +var MAX_SAFE_INTEGER = $Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; + +var assign = require('./helpers/assign'); +var sign = require('./helpers/sign'); +var mod = require('./helpers/mod'); +var isPrimitive = require('./helpers/isPrimitive'); +var parseInteger = parseInt; +var bind = require('function-bind'); +var arraySlice = bind.call(Function.call, $Array.prototype.slice); +var strSlice = bind.call(Function.call, $String.prototype.slice); +var isBinary = bind.call(Function.call, $RegExp.prototype.test, /^0b[01]+$/i); +var isOctal = bind.call(Function.call, $RegExp.prototype.test, /^0o[0-7]+$/i); +var regexExec = bind.call(Function.call, $RegExp.prototype.exec); +var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); +var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); +var hasNonWS = bind.call(Function.call, $RegExp.prototype.test, nonWSregex); +var invalidHexLiteral = /^[-+]0x[0-9a-f]+$/i; +var isInvalidHexLiteral = bind.call(Function.call, $RegExp.prototype.test, invalidHexLiteral); +var $charCodeAt = bind.call(Function.call, $String.prototype.charCodeAt); + +var toStr = bind.call(Function.call, Object.prototype.toString); + +var $floor = Math.floor; +var $abs = Math.abs; + +var $ObjectCreate = Object.create; +var $gOPD = $Object.getOwnPropertyDescriptor; + +var $isExtensible = $Object.isExtensible; + +// whitespace from: http://es5.github.io/#x15.5.4.20 +// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 +var ws = [ + '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', + '\u2029\uFEFF' +].join(''); +var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); +var replace = bind.call(Function.call, $String.prototype.replace); +var trim = function (value) { + return replace(value, trimRegex, ''); +}; + +var ES5 = require('./es5'); + +var hasRegExpMatcher = require('is-regex'); + +// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations +var ES6 = assign(assign({}, ES5), { + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args + Call: function Call(F, V) { + var args = arguments.length > 2 ? arguments[2] : []; + if (!this.IsCallable(F)) { + throw new $TypeError(F + ' is not a function'); + } + return F.apply(V, args); + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive + ToPrimitive: toPrimitive, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean + // ToBoolean: ES5.ToBoolean, + + // https://ecma-international.org/ecma-262/6.0/#sec-tonumber + ToNumber: function ToNumber(argument) { + var value = isPrimitive(argument) ? argument : toPrimitive(argument, $Number); + if (typeof value === 'symbol') { + throw new $TypeError('Cannot convert a Symbol value to a number'); + } + if (typeof value === 'string') { + if (isBinary(value)) { + return this.ToNumber(parseInteger(strSlice(value, 2), 2)); + } else if (isOctal(value)) { + return this.ToNumber(parseInteger(strSlice(value, 2), 8)); + } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { + return NaN; + } else { + var trimmed = trim(value); + if (trimmed !== value) { + return this.ToNumber(trimmed); + } + } + } + return $Number(value); + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger + // ToInteger: ES5.ToNumber, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32 + // ToInt32: ES5.ToInt32, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32 + // ToUint32: ES5.ToUint32, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint16 + ToInt16: function ToInt16(argument) { + var int16bit = this.ToUint16(argument); + return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint16 + // ToUint16: ES5.ToUint16, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint8 + ToInt8: function ToInt8(argument) { + var int8bit = this.ToUint8(argument); + return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8 + ToUint8: function ToUint8(argument) { + var number = this.ToNumber(argument); + if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } + var posInt = sign(number) * $floor($abs(number)); + return mod(posInt, 0x100); + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8clamp + ToUint8Clamp: function ToUint8Clamp(argument) { + var number = this.ToNumber(argument); + if ($isNaN(number) || number <= 0) { return 0; } + if (number >= 0xFF) { return 0xFF; } + var f = $floor(argument); + if (f + 0.5 < number) { return f + 1; } + if (number < f + 0.5) { return f; } + if (f % 2 !== 0) { return f + 1; } + return f; + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring + ToString: function ToString(argument) { + if (typeof argument === 'symbol') { + throw new $TypeError('Cannot convert a Symbol value to a string'); + } + return $String(argument); + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject + ToObject: function ToObject(value) { + this.RequireObjectCoercible(value); + return $Object(value); + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + ToPropertyKey: function ToPropertyKey(argument) { + var key = this.ToPrimitive(argument, $String); + return typeof key === 'symbol' ? key : this.ToString(key); + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength + ToLength: function ToLength(argument) { + var len = this.ToInteger(argument); + if (len <= 0) { return 0; } // includes converting -0 to +0 + if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } + return len; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring + CanonicalNumericIndexString: function CanonicalNumericIndexString(argument) { + if (toStr(argument) !== '[object String]') { + throw new $TypeError('must be a string'); + } + if (argument === '-0') { return -0; } + var n = this.ToNumber(argument); + if (this.SameValue(this.ToString(n), argument)) { return n; } + return void 0; + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-requireobjectcoercible + RequireObjectCoercible: ES5.CheckObjectCoercible, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + IsArray: $Array.isArray || function IsArray(argument) { + return toStr(argument) === '[object Array]'; + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable + // IsCallable: ES5.IsCallable, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + IsConstructor: function IsConstructor(argument) { + return typeof argument === 'function' && !!argument.prototype; // unfortunately there's no way to truly check this without try/catch `new argument` + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o + IsExtensible: Object.preventExtensions + ? function IsExtensible(obj) { + if (isPrimitive(obj)) { + return false; + } + return $isExtensible(obj); + } + : function isExtensible(obj) { return true; }, // eslint-disable-line no-unused-vars + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger + IsInteger: function IsInteger(argument) { + if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) { + return false; + } + var abs = $abs(argument); + return $floor(abs) === abs; + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey + IsPropertyKey: function IsPropertyKey(argument) { + return typeof argument === 'string' || typeof argument === 'symbol'; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-isregexp + IsRegExp: function IsRegExp(argument) { + if (!argument || typeof argument !== 'object') { + return false; + } + if (hasSymbols) { + var isRegExp = argument[$Symbol.match]; + if (typeof isRegExp !== 'undefined') { + return ES5.ToBoolean(isRegExp); + } + } + return hasRegExpMatcher(argument); + }, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue + // SameValue: ES5.SameValue, + + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero + SameValueZero: function SameValueZero(x, y) { + return (x === y) || ($isNaN(x) && $isNaN(y)); + }, + + /** + * 7.3.2 GetV (V, P) + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let O be ToObject(V). + * 3. ReturnIfAbrupt(O). + * 4. Return O.[[Get]](P, V). + */ + GetV: function GetV(V, P) { + // 7.3.2.1 + if (!this.IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + + // 7.3.2.2-3 + var O = this.ToObject(V); + + // 7.3.2.4 + return O[P]; + }, + + /** + * 7.3.9 - https://ecma-international.org/ecma-262/6.0/#sec-getmethod + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let func be GetV(O, P). + * 3. ReturnIfAbrupt(func). + * 4. If func is either undefined or null, return undefined. + * 5. If IsCallable(func) is false, throw a TypeError exception. + * 6. Return func. + */ + GetMethod: function GetMethod(O, P) { + // 7.3.9.1 + if (!this.IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + + // 7.3.9.2 + var func = this.GetV(O, P); + + // 7.3.9.4 + if (func == null) { + return void 0; + } + + // 7.3.9.5 + if (!this.IsCallable(func)) { + throw new $TypeError(P + 'is not a function'); + } + + // 7.3.9.6 + return func; + }, + + /** + * 7.3.1 Get (O, P) - https://ecma-international.org/ecma-262/6.0/#sec-get-o-p + * 1. Assert: Type(O) is Object. + * 2. Assert: IsPropertyKey(P) is true. + * 3. Return O.[[Get]](P, O). + */ + Get: function Get(O, P) { + // 7.3.1.1 + if (this.Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + // 7.3.1.2 + if (!this.IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + // 7.3.1.3 + return O[P]; + }, + + Type: function Type(x) { + if (typeof x === 'symbol') { + return 'Symbol'; + } + return ES5.Type(x); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor + SpeciesConstructor: function SpeciesConstructor(O, defaultConstructor) { + if (this.Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + var C = O.constructor; + if (typeof C === 'undefined') { + return defaultConstructor; + } + if (this.Type(C) !== 'Object') { + throw new $TypeError('O.constructor is not an Object'); + } + var S = hasSymbols && $Symbol.species ? C[$Symbol.species] : void 0; + if (S == null) { + return defaultConstructor; + } + if (this.IsConstructor(S)) { + return S; + } + throw new $TypeError('no constructor found'); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor + CompletePropertyDescriptor: function CompletePropertyDescriptor(Desc) { + if (!this.IsPropertyDescriptor(Desc)) { + throw new $TypeError('Desc must be a Property Descriptor'); + } + + if (this.IsGenericDescriptor(Desc) || this.IsDataDescriptor(Desc)) { + if (!has(Desc, '[[Value]]')) { + Desc['[[Value]]'] = void 0; + } + if (!has(Desc, '[[Writable]]')) { + Desc['[[Writable]]'] = false; + } + } else { + if (!has(Desc, '[[Get]]')) { + Desc['[[Get]]'] = void 0; + } + if (!has(Desc, '[[Set]]')) { + Desc['[[Set]]'] = void 0; + } + } + if (!has(Desc, '[[Enumerable]]')) { + Desc['[[Enumerable]]'] = false; + } + if (!has(Desc, '[[Configurable]]')) { + Desc['[[Configurable]]'] = false; + } + return Desc; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw + Set: function Set(O, P, V, Throw) { + if (this.Type(O) !== 'Object') { + throw new $TypeError('O must be an Object'); + } + if (!this.IsPropertyKey(P)) { + throw new $TypeError('P must be a Property Key'); + } + if (this.Type(Throw) !== 'Boolean') { + throw new $TypeError('Throw must be a Boolean'); + } + if (Throw) { + O[P] = V; + return true; + } else { + try { + O[P] = V; + } catch (e) { + return false; + } + } + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty + HasOwnProperty: function HasOwnProperty(O, P) { + if (this.Type(O) !== 'Object') { + throw new $TypeError('O must be an Object'); + } + if (!this.IsPropertyKey(P)) { + throw new $TypeError('P must be a Property Key'); + } + return has(O, P); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty + HasProperty: function HasProperty(O, P) { + if (this.Type(O) !== 'Object') { + throw new $TypeError('O must be an Object'); + } + if (!this.IsPropertyKey(P)) { + throw new $TypeError('P must be a Property Key'); + } + return P in O; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable + IsConcatSpreadable: function IsConcatSpreadable(O) { + if (this.Type(O) !== 'Object') { + return false; + } + if (hasSymbols && typeof $Symbol.isConcatSpreadable === 'symbol') { + var spreadable = this.Get(O, Symbol.isConcatSpreadable); + if (typeof spreadable !== 'undefined') { + return this.ToBoolean(spreadable); + } + } + return this.IsArray(O); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-invoke + Invoke: function Invoke(O, P) { + if (!this.IsPropertyKey(P)) { + throw new $TypeError('P must be a Property Key'); + } + var argumentsList = arraySlice(arguments, 2); + var func = this.GetV(O, P); + return this.Call(func, O, argumentsList); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-getiterator + GetIterator: function GetIterator(obj, method) { + if (!hasSymbols) { + throw new SyntaxError('ES.GetIterator depends on native iterator support.'); + } + + var actualMethod = method; + if (arguments.length < 2) { + actualMethod = this.GetMethod(obj, $Symbol.iterator); + } + var iterator = this.Call(actualMethod, obj); + if (this.Type(iterator) !== 'Object') { + throw new $TypeError('iterator must return an object'); + } + + return iterator; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext + IteratorNext: function IteratorNext(iterator, value) { + var result = this.Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); + if (this.Type(result) !== 'Object') { + throw new $TypeError('iterator next must return an object'); + } + return result; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete + IteratorComplete: function IteratorComplete(iterResult) { + if (this.Type(iterResult) !== 'Object') { + throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); + } + return this.ToBoolean(this.Get(iterResult, 'done')); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue + IteratorValue: function IteratorValue(iterResult) { + if (this.Type(iterResult) !== 'Object') { + throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); + } + return this.Get(iterResult, 'value'); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep + IteratorStep: function IteratorStep(iterator) { + var result = this.IteratorNext(iterator); + var done = this.IteratorComplete(result); + return done === true ? false : result; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose + IteratorClose: function IteratorClose(iterator, completion) { + if (this.Type(iterator) !== 'Object') { + throw new $TypeError('Assertion failed: Type(iterator) is not Object'); + } + if (!this.IsCallable(completion)) { + throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); + } + var completionThunk = completion; + + var iteratorReturn = this.GetMethod(iterator, 'return'); + + if (typeof iteratorReturn === 'undefined') { + return completionThunk(); + } + + var completionRecord; + try { + var innerResult = this.Call(iteratorReturn, iterator, []); + } catch (e) { + // if we hit here, then "e" is the innerResult completion that needs re-throwing + + // if the completion is of type "throw", this will throw. + completionRecord = completionThunk(); + completionThunk = null; // ensure it's not called twice. + + // if not, then return the innerResult completion + throw e; + } + completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does + completionThunk = null; // ensure it's not called twice. + + if (this.Type(innerResult) !== 'Object') { + throw new $TypeError('iterator .return must return an object'); + } + + return completionRecord; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject + CreateIterResultObject: function CreateIterResultObject(value, done) { + if (this.Type(done) !== 'Boolean') { + throw new $TypeError('Assertion failed: Type(done) is not Boolean'); + } + return { + value: value, + done: done + }; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec + RegExpExec: function RegExpExec(R, S) { + if (this.Type(R) !== 'Object') { + throw new $TypeError('R must be an Object'); + } + if (this.Type(S) !== 'String') { + throw new $TypeError('S must be a String'); + } + var exec = this.Get(R, 'exec'); + if (this.IsCallable(exec)) { + var result = this.Call(exec, R, [S]); + if (result === null || this.Type(result) === 'Object') { + return result; + } + throw new $TypeError('"exec" method must return `null` or an Object'); + } + return regexExec(R, S); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate + ArraySpeciesCreate: function ArraySpeciesCreate(originalArray, length) { + if (!this.IsInteger(length) || length < 0) { + throw new $TypeError('Assertion failed: length must be an integer >= 0'); + } + var len = length === 0 ? 0 : length; + var C; + var isArray = this.IsArray(originalArray); + if (isArray) { + C = this.Get(originalArray, 'constructor'); + // TODO: figure out how to make a cross-realm normal Array, a same-realm Array + // if (this.IsConstructor(C)) { + // if C is another realm's Array, C = undefined + // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? + // } + if (this.Type(C) === 'Object' && hasSymbols && $Symbol.species) { + C = this.Get(C, $Symbol.species); + if (C === null) { + C = void 0; + } + } + } + if (typeof C === 'undefined') { + return $Array(len); + } + if (!this.IsConstructor(C)) { + throw new $TypeError('C must be a constructor'); + } + return new C(len); // this.Construct(C, len); + }, + + CreateDataProperty: function CreateDataProperty(O, P, V) { + if (this.Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (!this.IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + var oldDesc = $gOPD(O, P); + var extensible = oldDesc || (typeof $isExtensible !== 'function' || $isExtensible(O)); + var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable); + if (immutable || !extensible) { + return false; + } + var newDesc = { + configurable: true, + enumerable: true, + value: V, + writable: true + }; + Object.defineProperty(O, P, newDesc); + return true; + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow + CreateDataPropertyOrThrow: function CreateDataPropertyOrThrow(O, P, V) { + if (this.Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (!this.IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + var success = this.CreateDataProperty(O, P, V); + if (!success) { + throw new $TypeError('unable to create data property'); + } + return success; + }, + + // https://www.ecma-international.org/ecma-262/6.0/#sec-objectcreate + ObjectCreate: function ObjectCreate(proto, internalSlotsList) { + if (proto !== null && this.Type(proto) !== 'Object') { + throw new $TypeError('Assertion failed: proto must be null or an object'); + } + var slots = arguments.length < 2 ? [] : internalSlotsList; + if (slots.length > 0) { + throw new $SyntaxError('es-abstract does not yet support internal slots'); + } + + if (proto === null && !$ObjectCreate) { + throw new $SyntaxError('native Object.create support is required to create null objects'); + } + + return $ObjectCreate(proto); + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex + AdvanceStringIndex: function AdvanceStringIndex(S, index, unicode) { + if (this.Type(S) !== 'String') { + throw new $TypeError('S must be a String'); + } + if (!this.IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) { + throw new $TypeError('Assertion failed: length must be an integer >= 0 and <= 2**53'); + } + if (this.Type(unicode) !== 'Boolean') { + throw new $TypeError('Assertion failed: unicode must be a Boolean'); + } + if (!unicode) { + return index + 1; + } + var length = S.length; + if ((index + 1) >= length) { + return index + 1; + } + + var first = $charCodeAt(S, index); + if (first < 0xD800 || first > 0xDBFF) { + return index + 1; + } + + var second = $charCodeAt(S, index + 1); + if (second < 0xDC00 || second > 0xDFFF) { + return index + 1; + } + + return index + 2; + } +}); + +delete ES6.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible + +module.exports = ES6; diff --git a/node_modules/es-abstract/es2016.js b/node_modules/es-abstract/es2016.js new file mode 100644 index 0000000000000..c9166cea7f842 --- /dev/null +++ b/node_modules/es-abstract/es2016.js @@ -0,0 +1,16 @@ +'use strict'; + +var ES2015 = require('./es2015'); +var assign = require('./helpers/assign'); + +var ES2016 = assign(assign({}, ES2015), { + // https://github.com/tc39/ecma262/pull/60 + SameValueNonNumber: function SameValueNonNumber(x, y) { + if (typeof x === 'number' || typeof x !== typeof y) { + throw new TypeError('SameValueNonNumber requires two non-number values of the same type.'); + } + return this.SameValue(x, y); + } +}); + +module.exports = ES2016; diff --git a/node_modules/es-abstract/es2017.js b/node_modules/es-abstract/es2017.js new file mode 100644 index 0000000000000..af3ff480663bb --- /dev/null +++ b/node_modules/es-abstract/es2017.js @@ -0,0 +1,25 @@ +'use strict'; + +var ES2016 = require('./es2016'); +var assign = require('./helpers/assign'); + +var ES2017 = assign(assign({}, ES2016), { + ToIndex: function ToIndex(value) { + if (typeof value === 'undefined') { + return 0; + } + var integerIndex = this.ToInteger(value); + if (integerIndex < 0) { + throw new RangeError('index must be >= 0'); + } + var index = this.ToLength(integerIndex); + if (!this.SameValueZero(integerIndex, index)) { + throw new RangeError('index must be >= 0 and < 2 ** 53 - 1'); + } + return index; + } +}); + +delete ES2017.EnumerableOwnNames; // replaced with EnumerableOwnProperties + +module.exports = ES2017; diff --git a/node_modules/es-abstract/es5.js b/node_modules/es-abstract/es5.js new file mode 100644 index 0000000000000..3af7e7ea3d5cf --- /dev/null +++ b/node_modules/es-abstract/es5.js @@ -0,0 +1,242 @@ +'use strict'; + +var GetIntrinsic = require('./GetIntrinsic'); + +var $Object = GetIntrinsic('%Object%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $String = GetIntrinsic('%String%'); + +var $isNaN = require('./helpers/isNaN'); +var $isFinite = require('./helpers/isFinite'); + +var sign = require('./helpers/sign'); +var mod = require('./helpers/mod'); + +var IsCallable = require('is-callable'); +var toPrimitive = require('es-to-primitive/es5'); + +var has = require('has'); + +// https://es5.github.io/#x9 +var ES5 = { + ToPrimitive: toPrimitive, + + ToBoolean: function ToBoolean(value) { + return !!value; + }, + ToNumber: function ToNumber(value) { + return +value; // eslint-disable-line no-implicit-coercion + }, + ToInteger: function ToInteger(value) { + var number = this.ToNumber(value); + if ($isNaN(number)) { return 0; } + if (number === 0 || !$isFinite(number)) { return number; } + return sign(number) * Math.floor(Math.abs(number)); + }, + ToInt32: function ToInt32(x) { + return this.ToNumber(x) >> 0; + }, + ToUint32: function ToUint32(x) { + return this.ToNumber(x) >>> 0; + }, + ToUint16: function ToUint16(value) { + var number = this.ToNumber(value); + if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } + var posInt = sign(number) * Math.floor(Math.abs(number)); + return mod(posInt, 0x10000); + }, + ToString: function ToString(value) { + return $String(value); + }, + ToObject: function ToObject(value) { + this.CheckObjectCoercible(value); + return $Object(value); + }, + CheckObjectCoercible: function CheckObjectCoercible(value, optMessage) { + /* jshint eqnull:true */ + if (value == null) { + throw new $TypeError(optMessage || 'Cannot call method on ' + value); + } + return value; + }, + IsCallable: IsCallable, + SameValue: function SameValue(x, y) { + if (x === y) { // 0 === -0, but they are not identical. + if (x === 0) { return 1 / x === 1 / y; } + return true; + } + return $isNaN(x) && $isNaN(y); + }, + + // https://www.ecma-international.org/ecma-262/5.1/#sec-8 + Type: function Type(x) { + if (x === null) { + return 'Null'; + } + if (typeof x === 'undefined') { + return 'Undefined'; + } + if (typeof x === 'function' || typeof x === 'object') { + return 'Object'; + } + if (typeof x === 'number') { + return 'Number'; + } + if (typeof x === 'boolean') { + return 'Boolean'; + } + if (typeof x === 'string') { + return 'String'; + } + }, + + // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type + IsPropertyDescriptor: function IsPropertyDescriptor(Desc) { + if (this.Type(Desc) !== 'Object') { + return false; + } + var allowed = { + '[[Configurable]]': true, + '[[Enumerable]]': true, + '[[Get]]': true, + '[[Set]]': true, + '[[Value]]': true, + '[[Writable]]': true + }; + // jscs:disable + for (var key in Desc) { // eslint-disable-line + if (has(Desc, key) && !allowed[key]) { + return false; + } + } + // jscs:enable + var isData = has(Desc, '[[Value]]'); + var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]'); + if (isData && IsAccessor) { + throw new $TypeError('Property Descriptors may not be both accessor and data descriptors'); + } + return true; + }, + + // https://ecma-international.org/ecma-262/5.1/#sec-8.10.1 + IsAccessorDescriptor: function IsAccessorDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return false; + } + + if (!this.IsPropertyDescriptor(Desc)) { + throw new $TypeError('Desc must be a Property Descriptor'); + } + + if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { + return false; + } + + return true; + }, + + // https://ecma-international.org/ecma-262/5.1/#sec-8.10.2 + IsDataDescriptor: function IsDataDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return false; + } + + if (!this.IsPropertyDescriptor(Desc)) { + throw new $TypeError('Desc must be a Property Descriptor'); + } + + if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { + return false; + } + + return true; + }, + + // https://ecma-international.org/ecma-262/5.1/#sec-8.10.3 + IsGenericDescriptor: function IsGenericDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return false; + } + + if (!this.IsPropertyDescriptor(Desc)) { + throw new $TypeError('Desc must be a Property Descriptor'); + } + + if (!this.IsAccessorDescriptor(Desc) && !this.IsDataDescriptor(Desc)) { + return true; + } + + return false; + }, + + // https://ecma-international.org/ecma-262/5.1/#sec-8.10.4 + FromPropertyDescriptor: function FromPropertyDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return Desc; + } + + if (!this.IsPropertyDescriptor(Desc)) { + throw new $TypeError('Desc must be a Property Descriptor'); + } + + if (this.IsDataDescriptor(Desc)) { + return { + value: Desc['[[Value]]'], + writable: !!Desc['[[Writable]]'], + enumerable: !!Desc['[[Enumerable]]'], + configurable: !!Desc['[[Configurable]]'] + }; + } else if (this.IsAccessorDescriptor(Desc)) { + return { + get: Desc['[[Get]]'], + set: Desc['[[Set]]'], + enumerable: !!Desc['[[Enumerable]]'], + configurable: !!Desc['[[Configurable]]'] + }; + } else { + throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor'); + } + }, + + // https://ecma-international.org/ecma-262/5.1/#sec-8.10.5 + ToPropertyDescriptor: function ToPropertyDescriptor(Obj) { + if (this.Type(Obj) !== 'Object') { + throw new $TypeError('ToPropertyDescriptor requires an object'); + } + + var desc = {}; + if (has(Obj, 'enumerable')) { + desc['[[Enumerable]]'] = this.ToBoolean(Obj.enumerable); + } + if (has(Obj, 'configurable')) { + desc['[[Configurable]]'] = this.ToBoolean(Obj.configurable); + } + if (has(Obj, 'value')) { + desc['[[Value]]'] = Obj.value; + } + if (has(Obj, 'writable')) { + desc['[[Writable]]'] = this.ToBoolean(Obj.writable); + } + if (has(Obj, 'get')) { + var getter = Obj.get; + if (typeof getter !== 'undefined' && !this.IsCallable(getter)) { + throw new TypeError('getter must be a function'); + } + desc['[[Get]]'] = getter; + } + if (has(Obj, 'set')) { + var setter = Obj.set; + if (typeof setter !== 'undefined' && !this.IsCallable(setter)) { + throw new $TypeError('setter must be a function'); + } + desc['[[Set]]'] = setter; + } + + if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { + throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); + } + return desc; + } +}; + +module.exports = ES5; diff --git a/node_modules/es-abstract/es6.js b/node_modules/es-abstract/es6.js new file mode 100644 index 0000000000000..2d1f4dc927a90 --- /dev/null +++ b/node_modules/es-abstract/es6.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./es2015'); diff --git a/node_modules/es-abstract/es7.js b/node_modules/es-abstract/es7.js new file mode 100644 index 0000000000000..f2f15c0a88712 --- /dev/null +++ b/node_modules/es-abstract/es7.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./es2016'); diff --git a/node_modules/es-abstract/helpers/assign.js b/node_modules/es-abstract/helpers/assign.js new file mode 100644 index 0000000000000..2533d20a36195 --- /dev/null +++ b/node_modules/es-abstract/helpers/assign.js @@ -0,0 +1,17 @@ +var bind = require('function-bind'); +var has = bind.call(Function.call, Object.prototype.hasOwnProperty); + +var $assign = Object.assign; + +module.exports = function assign(target, source) { + if ($assign) { + return $assign(target, source); + } + + for (var key in source) { + if (has(source, key)) { + target[key] = source[key]; + } + } + return target; +}; diff --git a/node_modules/es-abstract/helpers/isFinite.js b/node_modules/es-abstract/helpers/isFinite.js new file mode 100644 index 0000000000000..46585376bbee5 --- /dev/null +++ b/node_modules/es-abstract/helpers/isFinite.js @@ -0,0 +1,3 @@ +var $isNaN = Number.isNaN || function (a) { return a !== a; }; + +module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; }; diff --git a/node_modules/es-abstract/helpers/isNaN.js b/node_modules/es-abstract/helpers/isNaN.js new file mode 100644 index 0000000000000..e4d4f95f316dd --- /dev/null +++ b/node_modules/es-abstract/helpers/isNaN.js @@ -0,0 +1,3 @@ +module.exports = Number.isNaN || function isNaN(a) { + return a !== a; +}; diff --git a/node_modules/es-abstract/helpers/isPrimitive.js b/node_modules/es-abstract/helpers/isPrimitive.js new file mode 100644 index 0000000000000..3669156452759 --- /dev/null +++ b/node_modules/es-abstract/helpers/isPrimitive.js @@ -0,0 +1,3 @@ +module.exports = function isPrimitive(value) { + return value === null || (typeof value !== 'function' && typeof value !== 'object'); +}; diff --git a/node_modules/es-abstract/helpers/mod.js b/node_modules/es-abstract/helpers/mod.js new file mode 100644 index 0000000000000..5867fd979c0ab --- /dev/null +++ b/node_modules/es-abstract/helpers/mod.js @@ -0,0 +1,4 @@ +module.exports = function mod(number, modulo) { + var remain = number % modulo; + return Math.floor(remain >= 0 ? remain : remain + modulo); +}; diff --git a/node_modules/es-abstract/helpers/sign.js b/node_modules/es-abstract/helpers/sign.js new file mode 100644 index 0000000000000..2ac0bf1b1a0e9 --- /dev/null +++ b/node_modules/es-abstract/helpers/sign.js @@ -0,0 +1,3 @@ +module.exports = function sign(number) { + return number >= 0 ? 1 : -1; +}; diff --git a/node_modules/es-abstract/index.js b/node_modules/es-abstract/index.js new file mode 100644 index 0000000000000..cee856bbdeb9f --- /dev/null +++ b/node_modules/es-abstract/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var assign = require('./helpers/assign'); + +var ES5 = require('./es5'); +var ES2015 = require('./es2015'); +var ES2016 = require('./es2016'); +var ES2017 = require('./es2017'); + +var ES = { + ES5: ES5, + ES6: ES2015, + ES2015: ES2015, + ES7: ES2016, + ES2016: ES2016, + ES2017: ES2017 +}; +assign(ES, ES5); +delete ES.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible +assign(ES, ES2015); + +module.exports = ES; diff --git a/node_modules/es-abstract/operations/2015.js b/node_modules/es-abstract/operations/2015.js new file mode 100644 index 0000000000000..1df63c3f4ba8c --- /dev/null +++ b/node_modules/es-abstract/operations/2015.js @@ -0,0 +1,78 @@ +'use strict'; + +module.exports = { + IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type', + IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor', + IsDataDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor', + IsGenericDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor', + FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor', + ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-topropertydescriptor', + CompletePropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor', + ToPrimitive: 'https://ecma-international.org/ecma-262/6.0/#sec-toprimitive', + ToBoolean: 'https://ecma-international.org/ecma-262/6.0/#sec-toboolean', + ToNumber: 'https://ecma-international.org/ecma-262/6.0/#sec-tonumber', + ToInteger: 'https://ecma-international.org/ecma-262/6.0/#sec-tointeger', + ToInt32: 'https://ecma-international.org/ecma-262/6.0/#sec-toint32', + ToUint32: 'https://ecma-international.org/ecma-262/6.0/#sec-touint32', + ToInt16: 'https://ecma-international.org/ecma-262/6.0/#sec-toint16', + ToUint16: 'https://ecma-international.org/ecma-262/6.0/#sec-touint16', + ToInt8: 'https://ecma-international.org/ecma-262/6.0/#sec-toint8', + ToUint8: 'https://ecma-international.org/ecma-262/6.0/#sec-touint8', + ToUint8Clamp: 'https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp', + ToString: 'https://ecma-international.org/ecma-262/6.0/#sec-tostring', + ToObject: 'https://ecma-international.org/ecma-262/6.0/#sec-toobject', + ToPropertyKey: 'https://ecma-international.org/ecma-262/6.0/#sec-topropertykey', + ToLength: 'https://ecma-international.org/ecma-262/6.0/#sec-tolength', + CanonicalNumericIndexString: 'https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring', + RequireObjectCoercible: 'https://ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible', + IsArray: 'https://ecma-international.org/ecma-262/6.0/#sec-isarray', + IsCallable: 'https://ecma-international.org/ecma-262/6.0/#sec-iscallable', + IsConstructor: 'https://ecma-international.org/ecma-262/6.0/#sec-isconstructor', + IsExtensible: 'https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o', + IsInteger: 'https://ecma-international.org/ecma-262/6.0/#sec-isinteger', + IsPropertyKey: 'https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey', + IsRegExp: 'https://ecma-international.org/ecma-262/6.0/#sec-isregexp', + SameValue: 'https://ecma-international.org/ecma-262/6.0/#sec-samevalue', + SameValueZero: 'https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero', + Get: 'https://ecma-international.org/ecma-262/6.0/#sec-get-o-p', + GetV: 'https://ecma-international.org/ecma-262/6.0/#sec-getv', + Set: 'https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw', + CreateDataProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty', + CreateMethodProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty', + CreateDataPropertyOrThrow: 'https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow', + DefinePropertyOrThrow: 'https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow', + DeletePropertyOrThrow: 'https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow', + GetMethod: 'https://ecma-international.org/ecma-262/6.0/#sec-getmethod', + HasProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-hasproperty', + HasOwnProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty', + Call: 'https://ecma-international.org/ecma-262/6.0/#sec-call', + Construct: 'https://ecma-international.org/ecma-262/6.0/#sec-construct', + SetIntegrityLevel: 'https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel', + TestIntegrityLevel: 'https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel', + CreateArrayFromList: 'https://ecma-international.org/ecma-262/6.0/#sec-createarrayfromlist', + CreateListFromArrayLike: 'https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike', + Invoke: 'https://ecma-international.org/ecma-262/6.0/#sec-invoke', + OrdinaryHasInstance: 'https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance', + SpeciesConstructor: 'https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor', + EnumerableOwnNames: 'https://ecma-international.org/ecma-262/6.0/#sec-enumerableownnames', + GetIterator: 'https://ecma-international.org/ecma-262/6.0/#sec-getiterator', + IteratorNext: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratornext', + IteratorComplete: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete', + IteratorValue: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue', + IteratorStep: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep', + IteratorClose: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose', + CreateIterResultObject: 'https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject', + CreateListIterator: 'https://ecma-international.org/ecma-262/6.0/#sec-createlistiterator', + Type: 'https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types', + thisNumberValue: 'https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object', + thisTimeValue: 'https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-date-prototype-object', + thisStringValue: 'https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object', + RegExpExec: 'https://ecma-international.org/ecma-262/6.0/#sec-regexpexec', + RegExpBuiltinExec: 'https://ecma-international.org/ecma-262/6.0/#sec-regexpbuiltinexec', + IsConcatSpreadable: 'https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable', + IsPromise: 'https://ecma-international.org/ecma-262/6.0/#sec-ispromise', + ArraySpeciesCreate: 'https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate', + ObjectCreate: 'https://ecma-international.org/ecma-262/6.0/#sec-objectcreate', + AdvanceStringIndex: 'https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex', + NormalCompletion: 'https://ecma-international.org/ecma-262/6.0/#sec-normalcompletion' +}; diff --git a/node_modules/es-abstract/operations/2016.js b/node_modules/es-abstract/operations/2016.js new file mode 100644 index 0000000000000..6ac8aae77c28a --- /dev/null +++ b/node_modules/es-abstract/operations/2016.js @@ -0,0 +1,80 @@ +'use strict'; + +module.exports = { + IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-property-descriptor-specification-type', + IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-isaccessordescriptor', + IsDataDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-isdatadescriptor', + IsGenericDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-isgenericdescriptor', + FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-frompropertydescriptor', + ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-topropertydescriptor', + CompletePropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-completepropertydescriptor', + ToPrimitive: 'https://ecma-international.org/ecma-262/7.0/#sec-toprimitive', + ToBoolean: 'https://ecma-international.org/ecma-262/7.0/#sec-toboolean', + ToNumber: 'https://ecma-international.org/ecma-262/7.0/#sec-tonumber', + ToInteger: 'https://ecma-international.org/ecma-262/7.0/#sec-tointeger', + ToInt32: 'https://ecma-international.org/ecma-262/7.0/#sec-toint32', + ToUint32: 'https://ecma-international.org/ecma-262/7.0/#sec-touint32', + ToInt16: 'https://ecma-international.org/ecma-262/7.0/#sec-toint16', + ToUint16: 'https://ecma-international.org/ecma-262/7.0/#sec-touint16', + ToInt8: 'https://ecma-international.org/ecma-262/7.0/#sec-toint8', + ToUint8: 'https://ecma-international.org/ecma-262/7.0/#sec-touint8', + ToUint8Clamp: 'https://ecma-international.org/ecma-262/7.0/#sec-touint8clamp', + ToString: 'https://ecma-international.org/ecma-262/7.0/#sec-tostring', + ToObject: 'https://ecma-international.org/ecma-262/7.0/#sec-toobject', + ToPropertyKey: 'https://ecma-international.org/ecma-262/7.0/#sec-topropertykey', + ToLength: 'https://ecma-international.org/ecma-262/7.0/#sec-tolength', + CanonicalNumericIndexString: 'https://ecma-international.org/ecma-262/7.0/#sec-canonicalnumericindexstring', + RequireObjectCoercible: 'https://ecma-international.org/ecma-262/7.0/#sec-requireobjectcoercible', + IsArray: 'https://ecma-international.org/ecma-262/7.0/#sec-isarray', + IsCallable: 'https://ecma-international.org/ecma-262/7.0/#sec-iscallable', + IsConstructor: 'https://ecma-international.org/ecma-262/7.0/#sec-isconstructor', + IsExtensible: 'https://ecma-international.org/ecma-262/7.0/#sec-isextensible-o', + IsInteger: 'https://ecma-international.org/ecma-262/7.0/#sec-isinteger', + IsPropertyKey: 'https://ecma-international.org/ecma-262/7.0/#sec-ispropertykey', + IsRegExp: 'https://ecma-international.org/ecma-262/7.0/#sec-isregexp', + SameValue: 'https://ecma-international.org/ecma-262/7.0/#sec-samevalue', + SameValueZero: 'https://ecma-international.org/ecma-262/7.0/#sec-samevaluezero', + SameValueNonNumber: 'https://ecma-international.org/ecma-262/7.0/#sec-samevaluenonnumber', + Get: 'https://ecma-international.org/ecma-262/7.0/#sec-get-o-p', + GetV: 'https://ecma-international.org/ecma-262/7.0/#sec-getv', + Set: 'https://ecma-international.org/ecma-262/7.0/#sec-set-o-p-v-throw', + CreateDataProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-createdataproperty', + CreateMethodProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-createmethodproperty', + CreateDataPropertyOrThrow: 'https://ecma-international.org/ecma-262/7.0/#sec-createdatapropertyorthrow', + DefinePropertyOrThrow: 'https://ecma-international.org/ecma-262/7.0/#sec-definepropertyorthrow', + DeletePropertyOrThrow: 'https://ecma-international.org/ecma-262/7.0/#sec-deletepropertyorthrow', + GetMethod: 'https://ecma-international.org/ecma-262/7.0/#sec-getmethod', + HasProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-hasproperty', + HasOwnProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-hasownproperty', + Call: 'https://ecma-international.org/ecma-262/7.0/#sec-call', + Construct: 'https://ecma-international.org/ecma-262/7.0/#sec-construct', + SetIntegrityLevel: 'https://ecma-international.org/ecma-262/7.0/#sec-setintegritylevel', + TestIntegrityLevel: 'https://ecma-international.org/ecma-262/7.0/#sec-testintegritylevel', + CreateArrayFromList: 'https://ecma-international.org/ecma-262/7.0/#sec-createarrayfromlist', + CreateListFromArrayLike: 'https://ecma-international.org/ecma-262/7.0/#sec-createlistfromarraylike', + Invoke: 'https://ecma-international.org/ecma-262/7.0/#sec-invoke', + OrdinaryHasInstance: 'https://ecma-international.org/ecma-262/7.0/#sec-ordinaryhasinstance', + SpeciesConstructor: 'https://ecma-international.org/ecma-262/7.0/#sec-speciesconstructor', + EnumerableOwnNames: 'https://ecma-international.org/ecma-262/7.0/#sec-enumerableownnames', + GetIterator: 'https://ecma-international.org/ecma-262/7.0/#sec-getiterator', + IteratorNext: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratornext', + IteratorComplete: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorcomplete', + IteratorValue: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorvalue', + IteratorStep: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorstep', + IteratorClose: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorclose', + CreateIterResultObject: 'https://ecma-international.org/ecma-262/7.0/#sec-createiterresultobject', + CreateListIterator: 'https://ecma-international.org/ecma-262/7.0/#sec-createlistiterator', + Type: 'https://ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types', + thisNumberValue: 'https://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-number-prototype-object', + thisTimeValue: 'https://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-date-prototype-object', + thisStringValue: 'https://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-string-prototype-object', + RegExpExec: 'https://ecma-international.org/ecma-262/7.0/#sec-regexpexec', + RegExpBuiltinExec: 'https://ecma-international.org/ecma-262/7.0/#sec-regexpbuiltinexec', + IsConcatSpreadable: 'https://ecma-international.org/ecma-262/7.0/#sec-isconcatspreadable', + IsPromise: 'https://ecma-international.org/ecma-262/7.0/#sec-ispromise', + ArraySpeciesCreate: 'https://ecma-international.org/ecma-262/7.0/#sec-arrayspeciescreate', + ObjectCreate: 'https://ecma-international.org/ecma-262/7.0/#sec-objectcreate', + AdvanceStringIndex: 'https://ecma-international.org/ecma-262/7.0/#sec-advancestringindex', + OrdinarySet: 'https://ecma-international.org/ecma-262/7.0/#sec-ordinaryset', + NormalCompletion: 'https://ecma-international.org/ecma-262/7.0/#sec-normalcompletion' +}; diff --git a/node_modules/es-abstract/operations/2017.js b/node_modules/es-abstract/operations/2017.js new file mode 100644 index 0000000000000..c8c3aa499cc3f --- /dev/null +++ b/node_modules/es-abstract/operations/2017.js @@ -0,0 +1,82 @@ +'use strict'; + +module.exports = { + IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-property-descriptor-specification-type', + IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-isaccessordescriptor', + IsDataDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-isdatadescriptor', + IsGenericDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-isgenericdescriptor', + FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-frompropertydescriptor', + ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-topropertydescriptor', + CompletePropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-completepropertydescriptor', + ToPrimitive: 'https://ecma-international.org/ecma-262/8.0/#sec-toprimitive', + ToBoolean: 'https://ecma-international.org/ecma-262/8.0/#sec-toboolean', + ToNumber: 'https://ecma-international.org/ecma-262/8.0/#sec-tonumber', + ToInteger: 'https://ecma-international.org/ecma-262/8.0/#sec-tointeger', + ToInt32: 'https://ecma-international.org/ecma-262/8.0/#sec-toint32', + ToUint32: 'https://ecma-international.org/ecma-262/8.0/#sec-touint32', + ToInt16: 'https://ecma-international.org/ecma-262/8.0/#sec-toint16', + ToUint16: 'https://ecma-international.org/ecma-262/8.0/#sec-touint16', + ToInt8: 'https://ecma-international.org/ecma-262/8.0/#sec-toint8', + ToUint8: 'https://ecma-international.org/ecma-262/8.0/#sec-touint8', + ToUint8Clamp: 'https://ecma-international.org/ecma-262/8.0/#sec-touint8clamp', + ToString: 'https://ecma-international.org/ecma-262/8.0/#sec-tostring', + ToObject: 'https://ecma-international.org/ecma-262/8.0/#sec-toobject', + ToPropertyKey: 'https://ecma-international.org/ecma-262/8.0/#sec-topropertykey', + ToLength: 'https://ecma-international.org/ecma-262/8.0/#sec-tolength', + CanonicalNumericIndexString: 'https://ecma-international.org/ecma-262/8.0/#sec-canonicalnumericindexstring', + ToIndex: 'https://ecma-international.org/ecma-262/8.0/#sec-toindex', + RequireObjectCoercible: 'https://ecma-international.org/ecma-262/8.0/#sec-requireobjectcoercible', + IsArray: 'https://ecma-international.org/ecma-262/8.0/#sec-isarray', + IsCallable: 'https://ecma-international.org/ecma-262/8.0/#sec-iscallable', + IsConstructor: 'https://ecma-international.org/ecma-262/8.0/#sec-isconstructor', + IsExtensible: 'https://ecma-international.org/ecma-262/8.0/#sec-isextensible-o', + IsInteger: 'https://ecma-international.org/ecma-262/8.0/#sec-isinteger', + IsPropertyKey: 'https://ecma-international.org/ecma-262/8.0/#sec-ispropertykey', + IsRegExp: 'https://ecma-international.org/ecma-262/8.0/#sec-isregexp', + SameValue: 'https://ecma-international.org/ecma-262/8.0/#sec-samevalue', + SameValueZero: 'https://ecma-international.org/ecma-262/8.0/#sec-samevaluezero', + SameValueNonNumber: 'https://ecma-international.org/ecma-262/8.0/#sec-samevaluenonnumber', + Get: 'https://ecma-international.org/ecma-262/8.0/#sec-get-o-p', + GetV: 'https://ecma-international.org/ecma-262/8.0/#sec-getv', + Set: 'https://ecma-international.org/ecma-262/8.0/#sec-set-o-p-v-throw', + CreateDataProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-createdataproperty', + CreateMethodProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-createmethodproperty', + CreateDataPropertyOrThrow: 'https://ecma-international.org/ecma-262/8.0/#sec-createdatapropertyorthrow', + DefinePropertyOrThrow: 'https://ecma-international.org/ecma-262/8.0/#sec-definepropertyorthrow', + DeletePropertyOrThrow: 'https://ecma-international.org/ecma-262/8.0/#sec-deletepropertyorthrow', + GetMethod: 'https://ecma-international.org/ecma-262/8.0/#sec-getmethod', + HasProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-hasproperty', + HasOwnProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-hasownproperty', + Call: 'https://ecma-international.org/ecma-262/8.0/#sec-call', + Construct: 'https://ecma-international.org/ecma-262/8.0/#sec-construct', + SetIntegrityLevel: 'https://ecma-international.org/ecma-262/8.0/#sec-setintegritylevel', + TestIntegrityLevel: 'https://ecma-international.org/ecma-262/8.0/#sec-testintegritylevel', + CreateArrayFromList: 'https://ecma-international.org/ecma-262/8.0/#sec-createarrayfromlist', + CreateListFromArrayLike: 'https://ecma-international.org/ecma-262/8.0/#sec-createlistfromarraylike', + Invoke: 'https://ecma-international.org/ecma-262/8.0/#sec-invoke', + OrdinaryHasInstance: 'https://ecma-international.org/ecma-262/8.0/#sec-ordinaryhasinstance', + SpeciesConstructor: 'https://ecma-international.org/ecma-262/8.0/#sec-speciesconstructor', + EnumerableOwnProperties: 'https://ecma-international.org/ecma-262/8.0/#sec-enumerableownproperties', + GetIterator: 'https://ecma-international.org/ecma-262/8.0/#sec-getiterator', + IteratorNext: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratornext', + IteratorComplete: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorcomplete', + IteratorValue: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorvalue', + IteratorStep: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorstep', + IteratorClose: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorclose', + CreateIterResultObject: 'https://ecma-international.org/ecma-262/8.0/#sec-createiterresultobject', + CreateListIterator: 'https://ecma-international.org/ecma-262/8.0/#sec-createlistiterator', + Type: 'https://ecma-international.org/ecma-262/8.0/#sec-ecmascript-language-types', + thisNumberValue: 'https://ecma-international.org/ecma-262/8.0/#sec-properties-of-the-number-prototype-object', + thisTimeValue: 'https://ecma-international.org/ecma-262/8.0/#sec-properties-of-the-date-prototype-object', + thisStringValue: 'https://ecma-international.org/ecma-262/8.0/#sec-properties-of-the-string-prototype-object', + RegExpExec: 'https://ecma-international.org/ecma-262/8.0/#sec-regexpexec', + RegExpBuiltinExec: 'https://ecma-international.org/ecma-262/8.0/#sec-regexpbuiltinexec', + IsConcatSpreadable: 'https://ecma-international.org/ecma-262/8.0/#sec-isconcatspreadable', + IsPromise: 'https://ecma-international.org/ecma-262/8.0/#sec-ispromise', + ArraySpeciesCreate: 'https://ecma-international.org/ecma-262/8.0/#sec-arrayspeciescreate', + ObjectCreate: 'https://ecma-international.org/ecma-262/8.0/#sec-objectcreate', + AdvanceStringIndex: 'https://ecma-international.org/ecma-262/8.0/#sec-advancestringindex', + OrdinarySet: 'https://ecma-international.org/ecma-262/8.0/#sec-ordinaryset', + NormalCompletion: 'https://ecma-international.org/ecma-262/8.0/#sec-normalcompletion', + IsSharedArrayBuffer: 'https://ecma-international.org/ecma-262/8.0/#sec-issharedarraybuffer', +}; diff --git a/node_modules/es-abstract/operations/es5.js b/node_modules/es-abstract/operations/es5.js new file mode 100644 index 0000000000000..205d1e681560e --- /dev/null +++ b/node_modules/es-abstract/operations/es5.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10', + IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.1', + IsDataDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.2', + IsGenericDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.3', + FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.4', + ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.5' +}; diff --git a/node_modules/es-abstract/package.json b/node_modules/es-abstract/package.json new file mode 100644 index 0000000000000..9b5378b8afb7e --- /dev/null +++ b/node_modules/es-abstract/package.json @@ -0,0 +1,102 @@ +{ + "name": "es-abstract", + "version": "1.12.0", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "description": "ECMAScript spec abstract operations.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublish": "safe-publish-latest", + "pretest": "npm run --silent lint", + "test": "npm run tests-only", + "posttest": "npm run --silent security", + "tests-only": "node test", + "coverage": "nyc npm run --silent tests-only >/dev/null", + "postcoverage": "nyc report", + "lint": "npm run --silent jscs && npm run --silent eslint", + "jscs": "jscs test/*.js *.js", + "eslint": "eslint test/*.js *.js", + "eccheck": "editorconfig-tools check *.js **/*.js > /dev/null", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/es-abstract.git" + }, + "keywords": [ + "ECMAScript", + "ES", + "abstract", + "operation", + "abstract operation", + "JavaScript", + "ES5", + "ES6", + "ES7" + ], + "dependencies": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + }, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "editorconfig-tools": "^0.1.1", + "eslint": "^4.19.1", + "foreach": "^2.0.5", + "jscs": "^3.0.7", + "nsp": "^3.2.1", + "nyc": "^10.3.2", + "object-inspect": "^1.6.0", + "object-is": "^1.0.1", + "object.assign": "^4.1.0", + "replace": "^1.0.0", + "safe-publish-latest": "^1.1.1", + "semver": "^5.5.0", + "tape": "^4.9.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "greenkeeper": { + "//": "nyc is ignored because it requires node 4+, and we support older than that", + "ignore": [ + "nyc" + ] + } + +,"_resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz" +,"_integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==" +,"_from": "es-abstract@1.12.0" +} \ No newline at end of file diff --git a/node_modules/es-abstract/test/GetIntrinsic.js b/node_modules/es-abstract/test/GetIntrinsic.js new file mode 100644 index 0000000000000..ed8e7ecc636bd --- /dev/null +++ b/node_modules/es-abstract/test/GetIntrinsic.js @@ -0,0 +1,34 @@ +'use strict'; + +var GetIntrinsic = require('../GetIntrinsic'); + +var test = require('tape'); +var forEach = require('foreach'); +var debug = require('object-inspect'); + +var v = require('./helpers/values'); + +test('export', function (t) { + t.equal(typeof GetIntrinsic, 'function', 'it is a function'); + t.equal(GetIntrinsic.length, 2, 'function has length of 2'); + + t.end(); +}); + +test('throws', function (t) { + t['throws']( + function () { GetIntrinsic('not an intrinsic'); }, + SyntaxError, + 'nonexistent intrinsic throws a syntax error' + ); + + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { GetIntrinsic('%', nonBoolean); }, + TypeError, + debug(nonBoolean) + ' is not a Boolean' + ); + }); + + t.end(); +}); diff --git a/node_modules/es-abstract/test/diffOps.js b/node_modules/es-abstract/test/diffOps.js new file mode 100644 index 0000000000000..2d870897c2059 --- /dev/null +++ b/node_modules/es-abstract/test/diffOps.js @@ -0,0 +1,24 @@ +'use strict'; + +var keys = require('object-keys'); +var forEach = require('foreach'); + +module.exports = function diffOperations(actual, expected, expectedMissing) { + var actualKeys = keys(actual); + var expectedKeys = keys(expected); + + var extra = []; + var missing = []; + forEach(actualKeys, function (op) { + if (!(op in expected)) { + extra.push(op); + } + }); + forEach(expectedKeys, function (op) { + if (!(op in actual) && expectedMissing.indexOf(op) === -1) { + missing.push(op); + } + }); + + return { missing: missing, extra: extra }; +}; diff --git a/node_modules/es-abstract/test/es2015.js b/node_modules/es-abstract/test/es2015.js new file mode 100644 index 0000000000000..51b94d2e3eeb0 --- /dev/null +++ b/node_modules/es-abstract/test/es2015.js @@ -0,0 +1,11 @@ +'use strict'; + +var ES = require('../').ES2015; + +var ops = require('../operations/2015'); + +// jscs:disable +var expectedMissing = ['CreateMethodProperty', 'DefinePropertyOrThrow', 'DeletePropertyOrThrow', 'Construct', 'SetIntegrityLevel', 'TestIntegrityLevel', 'CreateArrayFromList', 'CreateListFromArrayLike', 'OrdinaryHasInstance', 'EnumerableOwnNames', 'GetIterator', 'IteratorNext', 'IteratorComplete', 'IteratorValue', 'IteratorStep', 'IteratorClose', 'CreateListIterator', 'thisNumberValue', 'thisTimeValue', 'thisStringValue', 'RegExpBuiltinExec', 'IsPromise', 'NormalCompletion']; +// jscs:enable + +require('./tests').es2015(ES, ops, expectedMissing); diff --git a/node_modules/es-abstract/test/es2016.js b/node_modules/es-abstract/test/es2016.js new file mode 100644 index 0000000000000..4e9dd2af2e8c4 --- /dev/null +++ b/node_modules/es-abstract/test/es2016.js @@ -0,0 +1,11 @@ +'use strict'; + +var ES = require('../').ES2016; + +var ops = require('../operations/2016'); + +// jscs:disable +var expectedMissing = ['CreateMethodProperty', 'DefinePropertyOrThrow', 'DeletePropertyOrThrow', 'Construct', 'SetIntegrityLevel', 'TestIntegrityLevel', 'CreateArrayFromList', 'CreateListFromArrayLike', 'OrdinaryHasInstance', 'EnumerableOwnNames', 'GetIterator', 'IteratorNext', 'IteratorComplete', 'IteratorValue', 'IteratorStep', 'IteratorClose', 'CreateListIterator', 'thisNumberValue', 'thisTimeValue', 'thisStringValue', 'RegExpBuiltinExec', 'IsPromise', 'OrdinarySet', 'NormalCompletion']; +// jscs:enable + +require('./tests').es2016(ES, ops, expectedMissing); diff --git a/node_modules/es-abstract/test/es2017.js b/node_modules/es-abstract/test/es2017.js new file mode 100644 index 0000000000000..82533049a56c5 --- /dev/null +++ b/node_modules/es-abstract/test/es2017.js @@ -0,0 +1,11 @@ +'use strict'; + +var ES = require('../').ES2017; + +var ops = require('../operations/2017'); + +// jscs:disable +var expectedMissing = ['CreateMethodProperty', 'DefinePropertyOrThrow', 'DeletePropertyOrThrow', 'Construct', 'SetIntegrityLevel', 'TestIntegrityLevel', 'CreateArrayFromList', 'CreateListFromArrayLike', 'OrdinaryHasInstance', 'EnumerableOwnProperties', 'GetIterator', 'IteratorNext', 'IteratorComplete', 'IteratorValue', 'IteratorStep', 'IteratorClose', 'CreateListIterator', 'thisNumberValue', 'thisTimeValue', 'thisStringValue', 'RegExpBuiltinExec', 'IsPromise', 'OrdinarySet', 'NormalCompletion', 'IsSharedArrayBuffer']; +// jscs:enable + +require('./tests').es2017(ES, ops, expectedMissing); diff --git a/node_modules/es-abstract/test/es5.js b/node_modules/es-abstract/test/es5.js new file mode 100644 index 0000000000000..cca3030407d88 --- /dev/null +++ b/node_modules/es-abstract/test/es5.js @@ -0,0 +1,415 @@ +'use strict'; + +var ES = require('../').ES5; +var test = require('tape'); + +var forEach = require('foreach'); +var is = require('object-is'); + +var coercibleObject = { valueOf: function () { return '3'; }, toString: function () { return 42; } }; +var coercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return 42; } +}; +var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } }; +var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } }; +var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } }; +var uncoercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return function toStrFn() {}; } +}; +var objects = [{}, coercibleObject, toStringOnlyObject, valueOfOnlyObject]; +var numbers = [0, -0, Infinity, -Infinity, 42]; +var nonNullPrimitives = [true, false, 'foo', ''].concat(numbers); +var primitives = [undefined, null].concat(nonNullPrimitives); + +test('ToPrimitive', function (t) { + t.test('primitives', function (st) { + var testPrimitive = function (primitive) { + st.ok(is(ES.ToPrimitive(primitive), primitive), primitive + ' is returned correctly'); + }; + forEach(primitives, testPrimitive); + st.end(); + }); + + t.test('objects', function (st) { + st.equal(ES.ToPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject coerces to valueOf'); + st.equal(ES.ToPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf'); + st.equal(ES.ToPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to toString'); + st.equal(ES.ToPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to toString'); + st.equal(ES.ToPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns toString'); + st.equal(ES.ToPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf'); + st.equal(ES.ToPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString'); + st.equal(ES.ToPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString'); + st.equal(ES.ToPrimitive({}, Number), '[object Object]', '{} with hint Number coerces to Object#toString'); + st['throws'](function () { return ES.ToPrimitive(uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); + st['throws'](function () { return ES.ToPrimitive(uncoercibleFnObject); }, TypeError, 'uncoercibleFnObject throws a TypeError'); + st.end(); + }); + + t.end(); +}); + +test('ToBoolean', function (t) { + t.equal(false, ES.ToBoolean(undefined), 'undefined coerces to false'); + t.equal(false, ES.ToBoolean(null), 'null coerces to false'); + t.equal(false, ES.ToBoolean(false), 'false returns false'); + t.equal(true, ES.ToBoolean(true), 'true returns true'); + forEach([0, -0, NaN], function (falsyNumber) { + t.equal(false, ES.ToBoolean(falsyNumber), 'falsy number ' + falsyNumber + ' coerces to false'); + }); + forEach([Infinity, 42, 1, -Infinity], function (truthyNumber) { + t.equal(true, ES.ToBoolean(truthyNumber), 'truthy number ' + truthyNumber + ' coerces to true'); + }); + t.equal(false, ES.ToBoolean(''), 'empty string coerces to false'); + t.equal(true, ES.ToBoolean('foo'), 'nonempty string coerces to true'); + forEach(objects, function (obj) { + t.equal(true, ES.ToBoolean(obj), 'object coerces to true'); + }); + t.equal(true, ES.ToBoolean(uncoercibleObject), 'uncoercibleObject coerces to true'); + t.end(); +}); + +test('ToNumber', function (t) { + t.ok(is(NaN, ES.ToNumber(undefined)), 'undefined coerces to NaN'); + t.ok(is(ES.ToNumber(null), 0), 'null coerces to +0'); + t.ok(is(ES.ToNumber(false), 0), 'false coerces to +0'); + t.equal(1, ES.ToNumber(true), 'true coerces to 1'); + t.ok(is(NaN, ES.ToNumber(NaN)), 'NaN returns itself'); + forEach([0, -0, 42, Infinity, -Infinity], function (num) { + t.equal(num, ES.ToNumber(num), num + ' returns itself'); + }); + forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) { + t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + Number(numString)); + }); + forEach(objects, function (object) { + t.ok(is(ES.ToNumber(object), ES.ToNumber(ES.ToPrimitive(object))), 'object ' + object + ' coerces to same as ToPrimitive of object does'); + }); + t['throws'](function () { return ES.ToNumber(uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.end(); +}); + +test('ToInteger', function (t) { + t.ok(is(0, ES.ToInteger(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity, 42], function (num) { + t.ok(is(num, ES.ToInteger(num)), num + ' returns itself'); + t.ok(is(-num, ES.ToInteger(-num)), '-' + num + ' returns itself'); + }); + t.equal(3, ES.ToInteger(Math.PI), 'pi returns 3'); + t['throws'](function () { return ES.ToInteger(uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.end(); +}); + +test('ToInt32', function (t) { + t.ok(is(0, ES.ToInt32(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToInt32(num)), num + ' returns +0'); + t.ok(is(0, ES.ToInt32(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToInt32(uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToInt32(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToInt32(0x100000000 - 1), -1), '2^32 - 1 returns -1'); + t.ok(is(ES.ToInt32(0x80000000), -0x80000000), '2^31 returns -2^31'); + t.ok(is(ES.ToInt32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1'); + forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { + t.ok(is(ES.ToInt32(num), ES.ToInt32(ES.ToUint32(num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for 0x' + num.toString(16)); + t.ok(is(ES.ToInt32(-num), ES.ToInt32(ES.ToUint32(-num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for -0x' + num.toString(16)); + }); + t.end(); +}); + +test('ToUint32', function (t) { + t.ok(is(0, ES.ToUint32(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToUint32(num)), num + ' returns +0'); + t.ok(is(0, ES.ToUint32(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToUint32(uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToUint32(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToUint32(0x100000000 - 1), 0x100000000 - 1), '2^32 - 1 returns 2^32 - 1'); + t.ok(is(ES.ToUint32(0x80000000), 0x80000000), '2^31 returns 2^31'); + t.ok(is(ES.ToUint32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1'); + forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { + t.ok(is(ES.ToUint32(num), ES.ToUint32(ES.ToInt32(num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for 0x' + num.toString(16)); + t.ok(is(ES.ToUint32(-num), ES.ToUint32(ES.ToInt32(-num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for -0x' + num.toString(16)); + }); + t.end(); +}); + +test('ToUint16', function (t) { + t.ok(is(0, ES.ToUint16(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToUint16(num)), num + ' returns +0'); + t.ok(is(0, ES.ToUint16(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToUint16(uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToUint16(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToUint16(0x100000000 - 1), 0x10000 - 1), '2^32 - 1 returns 2^16 - 1'); + t.ok(is(ES.ToUint16(0x80000000), 0), '2^31 returns +0'); + t.ok(is(ES.ToUint16(0x80000000 - 1), 0x10000 - 1), '2^31 - 1 returns 2^16 - 1'); + t.ok(is(ES.ToUint16(0x10000), 0), '2^16 returns +0'); + t.ok(is(ES.ToUint16(0x10000 - 1), 0x10000 - 1), '2^16 - 1 returns 2^16 - 1'); + t.end(); +}); + +test('ToString', function (t) { + t['throws'](function () { return ES.ToString(uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.end(); +}); + +test('ToObject', function (t) { + t['throws'](function () { return ES.ToObject(undefined); }, TypeError, 'undefined throws'); + t['throws'](function () { return ES.ToObject(null); }, TypeError, 'null throws'); + forEach(numbers, function (number) { + var obj = ES.ToObject(number); + t.equal(typeof obj, 'object', 'number ' + number + ' coerces to object'); + t.equal(true, obj instanceof Number, 'object of ' + number + ' is Number object'); + t.ok(is(obj.valueOf(), number), 'object of ' + number + ' coerces to ' + number); + }); + t.end(); +}); + +test('CheckObjectCoercible', function (t) { + t['throws'](function () { return ES.CheckObjectCoercible(undefined); }, TypeError, 'undefined throws'); + t['throws'](function () { return ES.CheckObjectCoercible(null); }, TypeError, 'null throws'); + var checkCoercible = function (value) { + t.doesNotThrow(function () { return ES.CheckObjectCoercible(value); }, '"' + value + '" does not throw'); + }; + forEach(objects.concat(nonNullPrimitives), checkCoercible); + t.end(); +}); + +test('IsCallable', function (t) { + t.equal(true, ES.IsCallable(function () {}), 'function is callable'); + var nonCallables = [/a/g, {}, Object.prototype, NaN].concat(primitives); + forEach(nonCallables, function (nonCallable) { + t.equal(false, ES.IsCallable(nonCallable), nonCallable + ' is not callable'); + }); + t.end(); +}); + +test('SameValue', function (t) { + t.equal(true, ES.SameValue(NaN, NaN), 'NaN is SameValue as NaN'); + t.equal(false, ES.SameValue(0, -0), '+0 is not SameValue as -0'); + forEach(objects.concat(primitives), function (val) { + t.equal(val === val, ES.SameValue(val, val), '"' + val + '" is SameValue to itself'); + }); + t.end(); +}); + +test('Type', function (t) { + t.equal(ES.Type(), 'Undefined', 'Type() is Undefined'); + t.equal(ES.Type(undefined), 'Undefined', 'Type(undefined) is Undefined'); + t.equal(ES.Type(null), 'Null', 'Type(null) is Null'); + t.equal(ES.Type(true), 'Boolean', 'Type(true) is Boolean'); + t.equal(ES.Type(false), 'Boolean', 'Type(false) is Boolean'); + t.equal(ES.Type(0), 'Number', 'Type(0) is Number'); + t.equal(ES.Type(NaN), 'Number', 'Type(NaN) is Number'); + t.equal(ES.Type('abc'), 'String', 'Type("abc") is String'); + t.equal(ES.Type(function () {}), 'Object', 'Type(function () {}) is Object'); + t.equal(ES.Type({}), 'Object', 'Type({}) is Object'); + t.end(); +}); + +var bothDescriptor = function () { + return { '[[Get]]': function () {}, '[[Value]]': true }; +}; +var accessorDescriptor = function () { + return { + '[[Get]]': function () {}, + '[[Enumerable]]': true, + '[[Configurable]]': true + }; +}; +var mutatorDescriptor = function () { + return { + '[[Set]]': function () {}, + '[[Enumerable]]': true, + '[[Configurable]]': true + }; +}; +var dataDescriptor = function () { + return { + '[[Value]]': 42, + '[[Writable]]': false, + '[[Configurable]]': false + }; +}; +var genericDescriptor = function () { + return { + '[[Configurable]]': true, + '[[Enumerable]]': false + }; +}; + +test('IsPropertyDescriptor', function (t) { + forEach(primitives, function (primitive) { + t.equal(ES.IsPropertyDescriptor(primitive), false, primitive + ' is not a Property Descriptor'); + }); + + t.equal(ES.IsPropertyDescriptor({ invalid: true }), false, 'invalid keys not allowed on a Property Descriptor'); + + t.equal(ES.IsPropertyDescriptor({}), true, 'empty object is an incomplete Property Descriptor'); + + t.equal(ES.IsPropertyDescriptor(accessorDescriptor()), true, 'accessor descriptor is a Property Descriptor'); + t.equal(ES.IsPropertyDescriptor(mutatorDescriptor()), true, 'mutator descriptor is a Property Descriptor'); + t.equal(ES.IsPropertyDescriptor(dataDescriptor()), true, 'data descriptor is a Property Descriptor'); + t.equal(ES.IsPropertyDescriptor(genericDescriptor()), true, 'generic descriptor is a Property Descriptor'); + + t['throws'](function () { + ES.IsPropertyDescriptor(bothDescriptor()); + }, TypeError, 'a Property Descriptor can not be both a Data and an Accessor Descriptor'); + + t.end(); +}); + +test('IsAccessorDescriptor', function (t) { + forEach(nonNullPrimitives.concat(null), function (primitive) { + t['throws'](function () { ES.IsAccessorDescriptor(primitive); }, TypeError, primitive + ' is not a Property Descriptor'); + }); + + t.equal(ES.IsAccessorDescriptor(), false, 'no value is not an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(undefined), false, 'undefined value is not an Accessor Descriptor'); + + t.equal(ES.IsAccessorDescriptor(accessorDescriptor()), true, 'accessor descriptor is an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(mutatorDescriptor()), true, 'mutator descriptor is an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(dataDescriptor()), false, 'data descriptor is not an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(genericDescriptor()), false, 'generic descriptor is not an Accessor Descriptor'); + + t.end(); +}); + +test('IsDataDescriptor', function (t) { + forEach(nonNullPrimitives.concat(null), function (primitive) { + t['throws'](function () { ES.IsDataDescriptor(primitive); }, TypeError, primitive + ' is not a Property Descriptor'); + }); + + t.equal(ES.IsDataDescriptor(), false, 'no value is not a Data Descriptor'); + t.equal(ES.IsDataDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); + + t.equal(ES.IsDataDescriptor(accessorDescriptor()), false, 'accessor descriptor is not a Data Descriptor'); + t.equal(ES.IsDataDescriptor(mutatorDescriptor()), false, 'mutator descriptor is not a Data Descriptor'); + t.equal(ES.IsDataDescriptor(dataDescriptor()), true, 'data descriptor is a Data Descriptor'); + t.equal(ES.IsDataDescriptor(genericDescriptor()), false, 'generic descriptor is not a Data Descriptor'); + + t.end(); +}); + +test('IsGenericDescriptor', function (t) { + forEach(nonNullPrimitives.concat(null), function (primitive) { + t['throws']( + function () { ES.IsGenericDescriptor(primitive); }, + TypeError, + primitive + ' is not a Property Descriptor' + ); + }); + + t.equal(ES.IsGenericDescriptor(), false, 'no value is not a Data Descriptor'); + t.equal(ES.IsGenericDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); + + t.equal(ES.IsGenericDescriptor(accessorDescriptor()), false, 'accessor descriptor is not a generic Descriptor'); + t.equal(ES.IsGenericDescriptor(mutatorDescriptor()), false, 'mutator descriptor is not a generic Descriptor'); + t.equal(ES.IsGenericDescriptor(dataDescriptor()), false, 'data descriptor is not a generic Descriptor'); + + t.equal(ES.IsGenericDescriptor(genericDescriptor()), true, 'generic descriptor is a generic Descriptor'); + + t.end(); +}); + +test('FromPropertyDescriptor', function (t) { + t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined'); + t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined'); + + forEach(nonNullPrimitives.concat(null), function (primitive) { + t['throws']( + function () { ES.FromPropertyDescriptor(primitive); }, + TypeError, + primitive + ' is not a Property Descriptor' + ); + }); + + var accessor = accessorDescriptor(); + t.deepEqual(ES.FromPropertyDescriptor(accessor), { + get: accessor['[[Get]]'], + set: accessor['[[Set]]'], + enumerable: !!accessor['[[Enumerable]]'], + configurable: !!accessor['[[Configurable]]'] + }); + + var mutator = mutatorDescriptor(); + t.deepEqual(ES.FromPropertyDescriptor(mutator), { + get: mutator['[[Get]]'], + set: mutator['[[Set]]'], + enumerable: !!mutator['[[Enumerable]]'], + configurable: !!mutator['[[Configurable]]'] + }); + var data = dataDescriptor(); + t.deepEqual(ES.FromPropertyDescriptor(data), { + value: data['[[Value]]'], + writable: data['[[Writable]]'], + enumerable: !!data['[[Enumerable]]'], + configurable: !!data['[[Configurable]]'] + }); + + t['throws']( + function () { ES.FromPropertyDescriptor(genericDescriptor()); }, + TypeError, + 'a complete Property Descriptor is required' + ); + + t.end(); +}); + +test('ToPropertyDescriptor', function (t) { + forEach(nonNullPrimitives.concat(null), function (primitive) { + t['throws']( + function () { ES.ToPropertyDescriptor(primitive); }, + TypeError, + primitive + ' is not an Object' + ); + }); + + var accessor = accessorDescriptor(); + t.deepEqual(ES.ToPropertyDescriptor({ + get: accessor['[[Get]]'], + enumerable: !!accessor['[[Enumerable]]'], + configurable: !!accessor['[[Configurable]]'] + }), accessor); + + var mutator = mutatorDescriptor(); + t.deepEqual(ES.ToPropertyDescriptor({ + set: mutator['[[Set]]'], + enumerable: !!mutator['[[Enumerable]]'], + configurable: !!mutator['[[Configurable]]'] + }), mutator); + + var data = dataDescriptor(); + t.deepEqual(ES.ToPropertyDescriptor({ + value: data['[[Value]]'], + writable: data['[[Writable]]'], + configurable: !!data['[[Configurable]]'] + }), data); + + var both = bothDescriptor(); + t['throws']( + function () { + ES.ToPropertyDescriptor({ get: both['[[Get]]'], value: both['[[Value]]'] }); + }, + TypeError, + 'data and accessor descriptors are mutually exclusive' + ); + + t['throws']( + function () { ES.ToPropertyDescriptor({ get: 'not callable' }); }, + TypeError, + '"get" must be undefined or callable' + ); + + t['throws']( + function () { ES.ToPropertyDescriptor({ set: 'not callable' }); }, + TypeError, + '"set" must be undefined or callable' + ); + + t.end(); +}); diff --git a/node_modules/es-abstract/test/es6.js b/node_modules/es-abstract/test/es6.js new file mode 100644 index 0000000000000..e7c9d98a243fd --- /dev/null +++ b/node_modules/es-abstract/test/es6.js @@ -0,0 +1,18 @@ +'use strict'; + +var test = require('tape'); + +var ES = require('../'); +var ES6 = ES.ES6; +var ES2015 = ES.ES2015; +var ES6entry = require('../es6'); + +test('legacy es6 export', function (t) { + t.equal(ES6, ES2015, 'main ES6 === main ES2015'); + t.end(); +}); + +test('legacy es6 entry point', function (t) { + t.equal(ES6, ES6entry, 'main ES6 === ES6 entry point'); + t.end(); +}); diff --git a/node_modules/es-abstract/test/es7.js b/node_modules/es-abstract/test/es7.js new file mode 100644 index 0000000000000..ee57e153b05b8 --- /dev/null +++ b/node_modules/es-abstract/test/es7.js @@ -0,0 +1,18 @@ +'use strict'; + +var test = require('tape'); + +var ES = require('../'); +var ES7 = ES.ES7; +var ES2016 = ES.ES2016; +var ES7entry = require('../es7'); + +test('legacy es7 export', function (t) { + t.equal(ES7, ES2016, 'main ES7 === main ES2016'); + t.end(); +}); + +test('legacy es7 entry point', function (t) { + t.equal(ES7, ES7entry, 'main ES7 === ES7 entry point'); + t.end(); +}); diff --git a/node_modules/es-abstract/test/helpers/values.js b/node_modules/es-abstract/test/helpers/values.js new file mode 100644 index 0000000000000..02408dd6bde59 --- /dev/null +++ b/node_modules/es-abstract/test/helpers/values.js @@ -0,0 +1,53 @@ +'use strict'; + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; + +var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } }; +var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } }; +var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } }; +var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } }; +var objects = [{}, coercibleObject, toStringOnlyObject, valueOfOnlyObject]; +var nullPrimitives = [undefined, null]; +var nonIntegerNumbers = [-1.3, 0.2, 1.8, 1 / 3]; +var numbers = [0, -0, Infinity, -Infinity, 42]; +var strings = ['', 'foo']; +var booleans = [true, false]; +var symbols = hasSymbols ? [Symbol.iterator, Symbol('foo')] : []; +var nonSymbolPrimitives = [].concat(nullPrimitives, booleans, strings, numbers); +var nonNumberPrimitives = [].concat(nullPrimitives, booleans, strings, symbols); +var nonNullPrimitives = [].concat(booleans, strings, numbers, symbols); +var nonUndefinedPrimitives = [].concat(null, nonNullPrimitives); +var nonStrings = [].concat(nullPrimitives, booleans, numbers, symbols, objects); +var primitives = [].concat(nullPrimitives, nonNullPrimitives); +var nonPropertyKeys = [].concat(nullPrimitives, booleans, numbers, objects); +var propertyKeys = [].concat(strings, symbols); +var nonBooleans = [].concat(nullPrimitives, strings, symbols, numbers, objects); +var falsies = [].concat(nullPrimitives, false, '', 0, -0, NaN); +var truthies = [].concat(true, 'foo', 42, symbols, objects); + +module.exports = { + coercibleObject: coercibleObject, + valueOfOnlyObject: valueOfOnlyObject, + toStringOnlyObject: toStringOnlyObject, + uncoercibleObject: uncoercibleObject, + objects: objects, + nullPrimitives: nullPrimitives, + numbers: numbers, + strings: strings, + booleans: booleans, + symbols: symbols, + hasSymbols: hasSymbols, + nonSymbolPrimitives: nonSymbolPrimitives, + nonNumberPrimitives: nonNumberPrimitives, + nonNullPrimitives: nonNullPrimitives, + nonUndefinedPrimitives: nonUndefinedPrimitives, + nonStrings: nonStrings, + nonNumbers: nonNumberPrimitives.concat(objects), + nonIntegerNumbers: nonIntegerNumbers, + primitives: primitives, + nonPropertyKeys: nonPropertyKeys, + propertyKeys: propertyKeys, + nonBooleans: nonBooleans, + falsies: falsies, + truthies: truthies +}; diff --git a/node_modules/es-abstract/test/index.js b/node_modules/es-abstract/test/index.js new file mode 100644 index 0000000000000..63271ac2006c6 --- /dev/null +++ b/node_modules/es-abstract/test/index.js @@ -0,0 +1,28 @@ +'use strict'; + +var ES = require('../'); +var test = require('tape'); + +var ESkeys = Object.keys(ES).sort(); +var ES6keys = Object.keys(ES.ES6).sort(); + +test('exposed properties', function (t) { + t.deepEqual(ESkeys, ES6keys.concat(['ES2017', 'ES7', 'ES2016', 'ES6', 'ES2015', 'ES5']).sort(), 'main ES object keys match ES6 keys'); + t.end(); +}); + +test('methods match', function (t) { + ES6keys.forEach(function (key) { + t.equal(ES.ES6[key], ES[key], 'method ' + key + ' on main ES object is ES6 method'); + }); + t.end(); +}); + +require('./GetIntrinsic'); + +require('./es5'); +require('./es6'); +require('./es2015'); +require('./es7'); +require('./es2016'); +require('./es2017'); diff --git a/node_modules/es-abstract/test/tests.js b/node_modules/es-abstract/test/tests.js new file mode 100644 index 0000000000000..df52c82c7aafd --- /dev/null +++ b/node_modules/es-abstract/test/tests.js @@ -0,0 +1,1610 @@ +'use strict'; + +var test = require('tape'); + +var forEach = require('foreach'); +var is = require('object-is'); +var debug = require('object-inspect'); +var assign = require('object.assign'); + +var v = require('./helpers/values'); +var diffOps = require('./diffOps'); + +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; + +var getArraySubclassWithSpeciesConstructor = function getArraySubclass(speciesConstructor) { + var Bar = function Bar() { + var inst = []; + Object.setPrototypeOf(inst, Bar.prototype); + Object.defineProperty(inst, 'constructor', { value: Bar }); + return inst; + }; + Bar.prototype = Object.create(Array.prototype); + Object.setPrototypeOf(Bar, Array); + Object.defineProperty(Bar, Symbol.species, { value: speciesConstructor }); + + return Bar; +}; + +var hasSpecies = v.hasSymbols && Symbol.species; + +var hasGroups = 'groups' in (/a/).exec('a'); +var groups = function groups(matchObject) { + return hasGroups ? assign(matchObject, { groups: matchObject.groups }) : matchObject; +}; + +var es2015 = function ES2015(ES, ops, expectedMissing) { + test('has expected operations', function (t) { + var diff = diffOps(ES, ops, expectedMissing); + + t.deepEqual(diff.extra, [], 'no extra ops'); + + t.deepEqual(diff.missing, [], 'no unexpected missing ops'); + + t.end(); + }); + + test('ToPrimitive', function (t) { + t.test('primitives', function (st) { + var testPrimitive = function (primitive) { + st.ok(is(ES.ToPrimitive(primitive), primitive), debug(primitive) + ' is returned correctly'); + }; + forEach(v.primitives, testPrimitive); + st.end(); + }); + + t.test('objects', function (st) { + st.equal(ES.ToPrimitive(v.coercibleObject), 3, 'coercibleObject with no hint coerces to valueOf'); + st.ok(is(ES.ToPrimitive({}), '[object Object]'), '{} with no hint coerces to Object#toString'); + st.equal(ES.ToPrimitive(v.coercibleObject, Number), 3, 'coercibleObject with hint Number coerces to valueOf'); + st.ok(is(ES.ToPrimitive({}, Number), '[object Object]'), '{} with hint Number coerces to NaN'); + st.equal(ES.ToPrimitive(v.coercibleObject, String), 42, 'coercibleObject with hint String coerces to nonstringified toString'); + st.equal(ES.ToPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString'); + st.equal(ES.ToPrimitive(v.toStringOnlyObject), 7, 'toStringOnlyObject returns non-stringified toString'); + st.equal(ES.ToPrimitive(v.valueOfOnlyObject), 4, 'valueOfOnlyObject returns valueOf'); + st['throws'](function () { return ES.ToPrimitive(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); + st.end(); + }); + + t.test('dates', function (st) { + var invalid = new Date(NaN); + st.equal(ES.ToPrimitive(invalid), Date.prototype.toString.call(invalid), 'invalid Date coerces to Date#toString'); + var now = new Date(); + st.equal(ES.ToPrimitive(now), Date.prototype.toString.call(now), 'Date coerces to Date#toString'); + st.end(); + }); + + t.end(); + }); + + test('ToBoolean', function (t) { + t.equal(false, ES.ToBoolean(undefined), 'undefined coerces to false'); + t.equal(false, ES.ToBoolean(null), 'null coerces to false'); + t.equal(false, ES.ToBoolean(false), 'false returns false'); + t.equal(true, ES.ToBoolean(true), 'true returns true'); + + t.test('numbers', function (st) { + forEach([0, -0, NaN], function (falsyNumber) { + st.equal(false, ES.ToBoolean(falsyNumber), 'falsy number ' + falsyNumber + ' coerces to false'); + }); + forEach([Infinity, 42, 1, -Infinity], function (truthyNumber) { + st.equal(true, ES.ToBoolean(truthyNumber), 'truthy number ' + truthyNumber + ' coerces to true'); + }); + + st.end(); + }); + + t.equal(false, ES.ToBoolean(''), 'empty string coerces to false'); + t.equal(true, ES.ToBoolean('foo'), 'nonempty string coerces to true'); + + t.test('objects', function (st) { + forEach(v.objects, function (obj) { + st.equal(true, ES.ToBoolean(obj), 'object coerces to true'); + }); + st.equal(true, ES.ToBoolean(v.uncoercibleObject), 'uncoercibleObject coerces to true'); + + st.end(); + }); + + t.end(); + }); + + test('ToNumber', function (t) { + t.ok(is(NaN, ES.ToNumber(undefined)), 'undefined coerces to NaN'); + t.ok(is(ES.ToNumber(null), 0), 'null coerces to +0'); + t.ok(is(ES.ToNumber(false), 0), 'false coerces to +0'); + t.equal(1, ES.ToNumber(true), 'true coerces to 1'); + + t.test('numbers', function (st) { + st.ok(is(NaN, ES.ToNumber(NaN)), 'NaN returns itself'); + forEach([0, -0, 42, Infinity, -Infinity], function (num) { + st.equal(num, ES.ToNumber(num), num + ' returns itself'); + }); + forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) { + st.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + Number(numString)); + }); + st.end(); + }); + + t.test('objects', function (st) { + forEach(v.objects, function (object) { + st.ok(is(ES.ToNumber(object), ES.ToNumber(ES.ToPrimitive(object))), 'object ' + object + ' coerces to same as ToPrimitive of object does'); + }); + st['throws'](function () { return ES.ToNumber(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + st.end(); + }); + + t.test('binary literals', function (st) { + st.equal(ES.ToNumber('0b10'), 2, '0b10 is 2'); + st.equal(ES.ToNumber({ toString: function () { return '0b11'; } }), 3, 'Object that toStrings to 0b11 is 3'); + + st.equal(true, is(ES.ToNumber('0b12'), NaN), '0b12 is NaN'); + st.equal(true, is(ES.ToNumber({ toString: function () { return '0b112'; } }), NaN), 'Object that toStrings to 0b112 is NaN'); + st.end(); + }); + + t.test('octal literals', function (st) { + st.equal(ES.ToNumber('0o10'), 8, '0o10 is 8'); + st.equal(ES.ToNumber({ toString: function () { return '0o11'; } }), 9, 'Object that toStrings to 0o11 is 9'); + + st.equal(true, is(ES.ToNumber('0o18'), NaN), '0o18 is NaN'); + st.equal(true, is(ES.ToNumber({ toString: function () { return '0o118'; } }), NaN), 'Object that toStrings to 0o118 is NaN'); + st.end(); + }); + + t.test('signed hex numbers', function (st) { + st.equal(true, is(ES.ToNumber('-0xF'), NaN), '-0xF is NaN'); + st.equal(true, is(ES.ToNumber(' -0xF '), NaN), 'space-padded -0xF is NaN'); + st.equal(true, is(ES.ToNumber('+0xF'), NaN), '+0xF is NaN'); + st.equal(true, is(ES.ToNumber(' +0xF '), NaN), 'space-padded +0xF is NaN'); + + st.end(); + }); + + t.test('trimming of whitespace and non-whitespace characters', function (st) { + var whitespace = ' \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'; + st.equal(0, ES.ToNumber(whitespace + 0 + whitespace), 'whitespace is trimmed'); + + // Zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace. + var nonWhitespaces = { + '\\u0085': '\u0085', + '\\u200b': '\u200b', + '\\ufffe': '\ufffe' + }; + + forEach(nonWhitespaces, function (desc, nonWS) { + st.equal(true, is(ES.ToNumber(nonWS + 0 + nonWS), NaN), 'non-whitespace ' + desc + ' not trimmed'); + }); + + st.end(); + }); + + forEach(v.symbols, function (symbol) { + t['throws']( + function () { ES.ToNumber(symbol); }, + TypeError, + 'Symbols can’t be converted to a Number: ' + debug(symbol) + ); + }); + + t.test('dates', function (st) { + var invalid = new Date(NaN); + st.ok(is(ES.ToNumber(invalid), NaN), 'invalid Date coerces to NaN'); + var now = Date.now(); + st.equal(ES.ToNumber(new Date(now)), now, 'Date coerces to timestamp'); + st.end(); + }); + + t.end(); + }); + + test('ToInteger', function (t) { + t.ok(is(0, ES.ToInteger(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity, 42], function (num) { + t.ok(is(num, ES.ToInteger(num)), num + ' returns itself'); + t.ok(is(-num, ES.ToInteger(-num)), '-' + num + ' returns itself'); + }); + t.equal(3, ES.ToInteger(Math.PI), 'pi returns 3'); + t['throws'](function () { return ES.ToInteger(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.end(); + }); + + test('ToInt32', function (t) { + t.ok(is(0, ES.ToInt32(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToInt32(num)), num + ' returns +0'); + t.ok(is(0, ES.ToInt32(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToInt32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToInt32(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToInt32(0x100000000 - 1), -1), '2^32 - 1 returns -1'); + t.ok(is(ES.ToInt32(0x80000000), -0x80000000), '2^31 returns -2^31'); + t.ok(is(ES.ToInt32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1'); + forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { + t.ok(is(ES.ToInt32(num), ES.ToInt32(ES.ToUint32(num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for 0x' + num.toString(16)); + t.ok(is(ES.ToInt32(-num), ES.ToInt32(ES.ToUint32(-num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for -0x' + num.toString(16)); + }); + t.end(); + }); + + test('ToUint32', function (t) { + t.ok(is(0, ES.ToUint32(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToUint32(num)), num + ' returns +0'); + t.ok(is(0, ES.ToUint32(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToUint32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToUint32(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToUint32(0x100000000 - 1), 0x100000000 - 1), '2^32 - 1 returns 2^32 - 1'); + t.ok(is(ES.ToUint32(0x80000000), 0x80000000), '2^31 returns 2^31'); + t.ok(is(ES.ToUint32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1'); + forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { + t.ok(is(ES.ToUint32(num), ES.ToUint32(ES.ToInt32(num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for 0x' + num.toString(16)); + t.ok(is(ES.ToUint32(-num), ES.ToUint32(ES.ToInt32(-num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for -0x' + num.toString(16)); + }); + t.end(); + }); + + test('ToInt16', function (t) { + t.ok(is(0, ES.ToInt16(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToInt16(num)), num + ' returns +0'); + t.ok(is(0, ES.ToInt16(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToInt16(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToInt16(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToInt16(0x100000000 - 1), -1), '2^32 - 1 returns -1'); + t.ok(is(ES.ToInt16(0x80000000), 0), '2^31 returns +0'); + t.ok(is(ES.ToInt16(0x80000000 - 1), -1), '2^31 - 1 returns -1'); + t.ok(is(ES.ToInt16(0x10000), 0), '2^16 returns +0'); + t.ok(is(ES.ToInt16(0x10000 - 1), -1), '2^16 - 1 returns -1'); + t.end(); + }); + + test('ToUint16', function (t) { + t.ok(is(0, ES.ToUint16(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToUint16(num)), num + ' returns +0'); + t.ok(is(0, ES.ToUint16(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToUint16(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToUint16(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToUint16(0x100000000 - 1), 0x10000 - 1), '2^32 - 1 returns 2^16 - 1'); + t.ok(is(ES.ToUint16(0x80000000), 0), '2^31 returns +0'); + t.ok(is(ES.ToUint16(0x80000000 - 1), 0x10000 - 1), '2^31 - 1 returns 2^16 - 1'); + t.ok(is(ES.ToUint16(0x10000), 0), '2^16 returns +0'); + t.ok(is(ES.ToUint16(0x10000 - 1), 0x10000 - 1), '2^16 - 1 returns 2^16 - 1'); + t.end(); + }); + + test('ToInt8', function (t) { + t.ok(is(0, ES.ToInt8(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToInt8(num)), num + ' returns +0'); + t.ok(is(0, ES.ToInt8(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToInt8(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToInt8(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToInt8(0x100000000 - 1), -1), '2^32 - 1 returns -1'); + t.ok(is(ES.ToInt8(0x80000000), 0), '2^31 returns +0'); + t.ok(is(ES.ToInt8(0x80000000 - 1), -1), '2^31 - 1 returns -1'); + t.ok(is(ES.ToInt8(0x10000), 0), '2^16 returns +0'); + t.ok(is(ES.ToInt8(0x10000 - 1), -1), '2^16 - 1 returns -1'); + t.ok(is(ES.ToInt8(0x100), 0), '2^8 returns +0'); + t.ok(is(ES.ToInt8(0x100 - 1), -1), '2^8 - 1 returns -1'); + t.ok(is(ES.ToInt8(0x10), 0x10), '2^4 returns 2^4'); + t.end(); + }); + + test('ToUint8', function (t) { + t.ok(is(0, ES.ToUint8(NaN)), 'NaN coerces to +0'); + forEach([0, Infinity], function (num) { + t.ok(is(0, ES.ToUint8(num)), num + ' returns +0'); + t.ok(is(0, ES.ToUint8(-num)), '-' + num + ' returns +0'); + }); + t['throws'](function () { return ES.ToUint8(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + t.ok(is(ES.ToUint8(0x100000000), 0), '2^32 returns +0'); + t.ok(is(ES.ToUint8(0x100000000 - 1), 0x100 - 1), '2^32 - 1 returns 2^8 - 1'); + t.ok(is(ES.ToUint8(0x80000000), 0), '2^31 returns +0'); + t.ok(is(ES.ToUint8(0x80000000 - 1), 0x100 - 1), '2^31 - 1 returns 2^8 - 1'); + t.ok(is(ES.ToUint8(0x10000), 0), '2^16 returns +0'); + t.ok(is(ES.ToUint8(0x10000 - 1), 0x100 - 1), '2^16 - 1 returns 2^8 - 1'); + t.ok(is(ES.ToUint8(0x100), 0), '2^8 returns +0'); + t.ok(is(ES.ToUint8(0x100 - 1), 0x100 - 1), '2^8 - 1 returns 2^16 - 1'); + t.ok(is(ES.ToUint8(0x10), 0x10), '2^4 returns 2^4'); + t.ok(is(ES.ToUint8(0x10 - 1), 0x10 - 1), '2^4 - 1 returns 2^4 - 1'); + t.end(); + }); + + test('ToUint8Clamp', function (t) { + t.ok(is(0, ES.ToUint8Clamp(NaN)), 'NaN coerces to +0'); + t.ok(is(0, ES.ToUint8Clamp(0)), '+0 returns +0'); + t.ok(is(0, ES.ToUint8Clamp(-0)), '-0 returns +0'); + t.ok(is(0, ES.ToUint8Clamp(-Infinity)), '-Infinity returns +0'); + t['throws'](function () { return ES.ToUint8Clamp(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + forEach([255, 256, 0x100000, Infinity], function (number) { + t.ok(is(255, ES.ToUint8Clamp(number)), number + ' coerces to 255'); + }); + t.equal(1, ES.ToUint8Clamp(1.49), '1.49 coerces to 1'); + t.equal(2, ES.ToUint8Clamp(1.5), '1.5 coerces to 2, because 2 is even'); + t.equal(2, ES.ToUint8Clamp(1.51), '1.51 coerces to 2'); + + t.equal(2, ES.ToUint8Clamp(2.49), '2.49 coerces to 2'); + t.equal(2, ES.ToUint8Clamp(2.5), '2.5 coerces to 2, because 2 is even'); + t.equal(3, ES.ToUint8Clamp(2.51), '2.51 coerces to 3'); + t.end(); + }); + + test('ToString', function (t) { + forEach(v.objects.concat(v.nonSymbolPrimitives), function (item) { + t.equal(ES.ToString(item), String(item), 'ES.ToString(' + debug(item) + ') ToStrings to String(' + debug(item) + ')'); + }); + + t['throws'](function () { return ES.ToString(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); + + forEach(v.symbols, function (symbol) { + t['throws'](function () { return ES.ToString(symbol); }, TypeError, debug(symbol) + ' throws'); + }); + t.end(); + }); + + test('ToObject', function (t) { + t['throws'](function () { return ES.ToObject(undefined); }, TypeError, 'undefined throws'); + t['throws'](function () { return ES.ToObject(null); }, TypeError, 'null throws'); + forEach(v.numbers, function (number) { + var obj = ES.ToObject(number); + t.equal(typeof obj, 'object', 'number ' + number + ' coerces to object'); + t.equal(true, obj instanceof Number, 'object of ' + number + ' is Number object'); + t.ok(is(obj.valueOf(), number), 'object of ' + number + ' coerces to ' + number); + }); + t.end(); + }); + + test('RequireObjectCoercible', function (t) { + t.equal(false, 'CheckObjectCoercible' in ES, 'CheckObjectCoercible -> RequireObjectCoercible in ES6'); + t['throws'](function () { return ES.RequireObjectCoercible(undefined); }, TypeError, 'undefined throws'); + t['throws'](function () { return ES.RequireObjectCoercible(null); }, TypeError, 'null throws'); + var isCoercible = function (value) { + t.doesNotThrow(function () { return ES.RequireObjectCoercible(value); }, debug(value) + ' does not throw'); + }; + forEach(v.objects.concat(v.nonNullPrimitives), isCoercible); + t.end(); + }); + + test('IsCallable', function (t) { + t.equal(true, ES.IsCallable(function () {}), 'function is callable'); + var nonCallables = [/a/g, {}, Object.prototype, NaN].concat(v.primitives); + forEach(nonCallables, function (nonCallable) { + t.equal(false, ES.IsCallable(nonCallable), debug(nonCallable) + ' is not callable'); + }); + t.end(); + }); + + test('SameValue', function (t) { + t.equal(true, ES.SameValue(NaN, NaN), 'NaN is SameValue as NaN'); + t.equal(false, ES.SameValue(0, -0), '+0 is not SameValue as -0'); + forEach(v.objects.concat(v.primitives), function (val) { + t.equal(val === val, ES.SameValue(val, val), debug(val) + ' is SameValue to itself'); + }); + t.end(); + }); + + test('SameValueZero', function (t) { + t.equal(true, ES.SameValueZero(NaN, NaN), 'NaN is SameValueZero as NaN'); + t.equal(true, ES.SameValueZero(0, -0), '+0 is SameValueZero as -0'); + forEach(v.objects.concat(v.primitives), function (val) { + t.equal(val === val, ES.SameValueZero(val, val), debug(val) + ' is SameValueZero to itself'); + }); + t.end(); + }); + + test('ToPropertyKey', function (t) { + forEach(v.objects.concat(v.nonSymbolPrimitives), function (value) { + t.equal(ES.ToPropertyKey(value), String(value), 'ToPropertyKey(value) === String(value) for non-Symbols'); + }); + + forEach(v.symbols, function (symbol) { + t.equal( + ES.ToPropertyKey(symbol), + symbol, + 'ToPropertyKey(' + debug(symbol) + ') === ' + debug(symbol) + ); + t.equal( + ES.ToPropertyKey(Object(symbol)), + symbol, + 'ToPropertyKey(' + debug(Object(symbol)) + ') === ' + debug(symbol) + ); + }); + + t.end(); + }); + + test('ToLength', function (t) { + t['throws'](function () { return ES.ToLength(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); + t.equal(3, ES.ToLength(v.coercibleObject), 'coercibleObject coerces to 3'); + t.equal(42, ES.ToLength('42.5'), '"42.5" coerces to 42'); + t.equal(7, ES.ToLength(7.3), '7.3 coerces to 7'); + forEach([-0, -1, -42, -Infinity], function (negative) { + t.ok(is(0, ES.ToLength(negative)), negative + ' coerces to +0'); + }); + t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 1), '2^53 coerces to 2^53 - 1'); + t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 3), '2^53 + 2 coerces to 2^53 - 1'); + t.end(); + }); + + test('IsArray', function (t) { + t.equal(true, ES.IsArray([]), '[] is array'); + t.equal(false, ES.IsArray({}), '{} is not array'); + t.equal(false, ES.IsArray({ length: 1, 0: true }), 'arraylike object is not array'); + forEach(v.objects.concat(v.primitives), function (value) { + t.equal(false, ES.IsArray(value), debug(value) + ' is not array'); + }); + t.end(); + }); + + test('IsRegExp', function (t) { + forEach([/a/g, new RegExp('a', 'g')], function (regex) { + t.equal(true, ES.IsRegExp(regex), regex + ' is regex'); + }); + + forEach(v.objects.concat(v.primitives), function (nonRegex) { + t.equal(false, ES.IsRegExp(nonRegex), debug(nonRegex) + ' is not regex'); + }); + + t.test('Symbol.match', { skip: !v.hasSymbols || !Symbol.match }, function (st) { + var obj = {}; + obj[Symbol.match] = true; + st.equal(true, ES.IsRegExp(obj), 'object with truthy Symbol.match is regex'); + + var regex = /a/; + regex[Symbol.match] = false; + st.equal(false, ES.IsRegExp(regex), 'regex with falsy Symbol.match is not regex'); + + st.end(); + }); + + t.end(); + }); + + test('IsPropertyKey', function (t) { + forEach(v.numbers.concat(v.objects), function (notKey) { + t.equal(false, ES.IsPropertyKey(notKey), debug(notKey) + ' is not property key'); + }); + + t.equal(true, ES.IsPropertyKey('foo'), 'string is property key'); + + forEach(v.symbols, function (symbol) { + t.equal(true, ES.IsPropertyKey(symbol), debug(symbol) + ' is property key'); + }); + t.end(); + }); + + test('IsInteger', function (t) { + for (var i = -100; i < 100; i += 10) { + t.equal(true, ES.IsInteger(i), i + ' is integer'); + t.equal(false, ES.IsInteger(i + 0.2), (i + 0.2) + ' is not integer'); + } + t.equal(true, ES.IsInteger(-0), '-0 is integer'); + var notInts = v.nonNumbers.concat(v.nonIntegerNumbers, [Infinity, -Infinity, NaN, [], new Date()]); + forEach(notInts, function (notInt) { + t.equal(false, ES.IsInteger(notInt), debug(notInt) + ' is not integer'); + }); + t.equal(false, ES.IsInteger(v.uncoercibleObject), 'uncoercibleObject is not integer'); + t.end(); + }); + + test('IsExtensible', function (t) { + forEach(v.objects, function (object) { + t.equal(true, ES.IsExtensible(object), debug(object) + ' object is extensible'); + }); + forEach(v.primitives, function (primitive) { + t.equal(false, ES.IsExtensible(primitive), debug(primitive) + ' is not extensible'); + }); + if (Object.preventExtensions) { + t.equal(false, ES.IsExtensible(Object.preventExtensions({})), 'object with extensions prevented is not extensible'); + } + t.end(); + }); + + test('CanonicalNumericIndexString', function (t) { + var throwsOnNonString = function (notString) { + t['throws']( + function () { return ES.CanonicalNumericIndexString(notString); }, + TypeError, + debug(notString) + ' is not a string' + ); + }; + forEach(v.objects.concat(v.numbers), throwsOnNonString); + t.ok(is(-0, ES.CanonicalNumericIndexString('-0')), '"-0" returns -0'); + for (var i = -50; i < 50; i += 10) { + t.equal(i, ES.CanonicalNumericIndexString(String(i)), '"' + i + '" returns ' + i); + t.equal(undefined, ES.CanonicalNumericIndexString(String(i) + 'a'), '"' + i + 'a" returns undefined'); + } + t.end(); + }); + + test('IsConstructor', function (t) { + t.equal(true, ES.IsConstructor(function () {}), 'function is constructor'); + t.equal(false, ES.IsConstructor(/a/g), 'regex is not constructor'); + forEach(v.objects, function (object) { + t.equal(false, ES.IsConstructor(object), object + ' object is not constructor'); + }); + + try { + var foo = Function('return class Foo {}')(); // eslint-disable-line no-new-func + t.equal(ES.IsConstructor(foo), true, 'class is constructor'); + } catch (e) { + t.comment('SKIP: class syntax not supported.'); + } + t.end(); + }); + + test('Call', function (t) { + var receiver = {}; + var notFuncs = v.objects.concat(v.primitives).concat([/a/g, new RegExp('a', 'g')]); + t.plan(notFuncs.length + 4); + var throwsIfNotCallable = function (notFunc) { + t['throws']( + function () { return ES.Call(notFunc, receiver); }, + TypeError, + debug(notFunc) + ' (' + typeof notFunc + ') is not callable' + ); + }; + forEach(notFuncs, throwsIfNotCallable); + ES.Call(function (a, b) { + t.equal(this, receiver, 'context matches expected'); + t.deepEqual([a, b], [1, 2], 'named args are correct'); + t.equal(arguments.length, 3, 'extra argument was passed'); + t.equal(arguments[2], 3, 'extra argument was correct'); + }, receiver, [1, 2, 3]); + t.end(); + }); + + test('GetV', function (t) { + t['throws'](function () { return ES.GetV({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); + var obj = { a: function () {} }; + t.equal(ES.GetV(obj, 'a'), obj.a, 'returns property if it exists'); + t.equal(ES.GetV(obj, 'b'), undefined, 'returns undefiend if property does not exist'); + t.end(); + }); + + test('GetMethod', function (t) { + t['throws'](function () { return ES.GetMethod({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); + t.equal(ES.GetMethod({}, 'a'), undefined, 'returns undefined in property is undefined'); + t.equal(ES.GetMethod({ a: null }, 'a'), undefined, 'returns undefined if property is null'); + t.equal(ES.GetMethod({ a: undefined }, 'a'), undefined, 'returns undefined if property is undefined'); + var obj = { a: function () {} }; + t['throws'](function () { ES.GetMethod({ a: 'b' }, 'a'); }, TypeError, 'throws TypeError if property exists and is not callable'); + t.equal(ES.GetMethod(obj, 'a'), obj.a, 'returns property if it is callable'); + t.end(); + }); + + test('Get', function (t) { + t['throws'](function () { return ES.Get('a', 'a'); }, TypeError, 'Throws a TypeError if `O` is not an Object'); + t['throws'](function () { return ES.Get({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); + + var value = {}; + t.test('Symbols', { skip: !v.hasSymbols }, function (st) { + var sym = Symbol('sym'); + var obj = {}; + obj[sym] = value; + st.equal(ES.Get(obj, sym), value, 'returns property `P` if it exists on object `O`'); + st.end(); + }); + t.equal(ES.Get({ a: value }, 'a'), value, 'returns property `P` if it exists on object `O`'); + t.end(); + }); + + test('Type', { skip: !v.hasSymbols }, function (t) { + t.equal(ES.Type(Symbol.iterator), 'Symbol', 'Type(Symbol.iterator) is Symbol'); + t.end(); + }); + + test('SpeciesConstructor', function (t) { + t['throws'](function () { ES.SpeciesConstructor(null); }, TypeError); + t['throws'](function () { ES.SpeciesConstructor(undefined); }, TypeError); + + var defaultConstructor = function Foo() {}; + + t.equal( + ES.SpeciesConstructor({ constructor: undefined }, defaultConstructor), + defaultConstructor, + 'undefined constructor returns defaultConstructor' + ); + + t['throws']( + function () { return ES.SpeciesConstructor({ constructor: null }, defaultConstructor); }, + TypeError, + 'non-undefined non-object constructor throws' + ); + + t.test('with Symbol.species', { skip: !hasSpecies }, function (st) { + var Bar = function Bar() {}; + Bar[Symbol.species] = null; + + st.equal( + ES.SpeciesConstructor(new Bar(), defaultConstructor), + defaultConstructor, + 'undefined/null Symbol.species returns default constructor' + ); + + var Baz = function Baz() {}; + Baz[Symbol.species] = Bar; + st.equal( + ES.SpeciesConstructor(new Baz(), defaultConstructor), + Bar, + 'returns Symbol.species constructor value' + ); + + Baz[Symbol.species] = {}; + st['throws']( + function () { ES.SpeciesConstructor(new Baz(), defaultConstructor); }, + TypeError, + 'throws when non-constructor non-null non-undefined species value found' + ); + + st.end(); + }); + + t.end(); + }); + + var bothDescriptor = function () { + return { '[[Get]]': function () {}, '[[Value]]': true }; + }; + var accessorDescriptor = function () { + return { + '[[Get]]': function () {}, + '[[Enumerable]]': true, + '[[Configurable]]': true + }; + }; + var mutatorDescriptor = function () { + return { + '[[Set]]': function () {}, + '[[Enumerable]]': true, + '[[Configurable]]': true + }; + }; + var dataDescriptor = function () { + return { + '[[Value]]': 42, + '[[Writable]]': false + }; + }; + var genericDescriptor = function () { + return { + '[[Configurable]]': true, + '[[Enumerable]]': false + }; + }; + + test('IsPropertyDescriptor', function (t) { + forEach(v.nonUndefinedPrimitives, function (primitive) { + t.equal( + ES.IsPropertyDescriptor(primitive), + false, + debug(primitive) + ' is not a Property Descriptor' + ); + }); + + t.equal(ES.IsPropertyDescriptor({ invalid: true }), false, 'invalid keys not allowed on a Property Descriptor'); + + t.equal(ES.IsPropertyDescriptor({}), true, 'empty object is an incomplete Property Descriptor'); + + t.equal(ES.IsPropertyDescriptor(accessorDescriptor()), true, 'accessor descriptor is a Property Descriptor'); + t.equal(ES.IsPropertyDescriptor(mutatorDescriptor()), true, 'mutator descriptor is a Property Descriptor'); + t.equal(ES.IsPropertyDescriptor(dataDescriptor()), true, 'data descriptor is a Property Descriptor'); + t.equal(ES.IsPropertyDescriptor(genericDescriptor()), true, 'generic descriptor is a Property Descriptor'); + + t['throws'](function () { + ES.IsPropertyDescriptor(bothDescriptor()); + }, TypeError, 'a Property Descriptor can not be both a Data and an Accessor Descriptor'); + + t.end(); + }); + + test('IsAccessorDescriptor', function (t) { + forEach(v.nonUndefinedPrimitives, function (primitive) { + t['throws']( + function () { ES.IsAccessorDescriptor(primitive); }, + TypeError, + debug(primitive) + ' is not a Property Descriptor' + ); + }); + + t.equal(ES.IsAccessorDescriptor(), false, 'no value is not an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(undefined), false, 'undefined value is not an Accessor Descriptor'); + + t.equal(ES.IsAccessorDescriptor(accessorDescriptor()), true, 'accessor descriptor is an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(mutatorDescriptor()), true, 'mutator descriptor is an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(dataDescriptor()), false, 'data descriptor is not an Accessor Descriptor'); + t.equal(ES.IsAccessorDescriptor(genericDescriptor()), false, 'generic descriptor is not an Accessor Descriptor'); + + t.end(); + }); + + test('IsDataDescriptor', function (t) { + forEach(v.nonUndefinedPrimitives, function (primitive) { + t['throws']( + function () { ES.IsDataDescriptor(primitive); }, + TypeError, + debug(primitive) + ' is not a Property Descriptor' + ); + }); + + t.equal(ES.IsDataDescriptor(), false, 'no value is not a Data Descriptor'); + t.equal(ES.IsDataDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); + + t.equal(ES.IsDataDescriptor(accessorDescriptor()), false, 'accessor descriptor is not a Data Descriptor'); + t.equal(ES.IsDataDescriptor(mutatorDescriptor()), false, 'mutator descriptor is not a Data Descriptor'); + t.equal(ES.IsDataDescriptor(dataDescriptor()), true, 'data descriptor is a Data Descriptor'); + t.equal(ES.IsDataDescriptor(genericDescriptor()), false, 'generic descriptor is not a Data Descriptor'); + + t.end(); + }); + + test('IsGenericDescriptor', function (t) { + forEach(v.nonUndefinedPrimitives, function (primitive) { + t['throws']( + function () { ES.IsGenericDescriptor(primitive); }, + TypeError, + debug(primitive) + ' is not a Property Descriptor' + ); + }); + + t.equal(ES.IsGenericDescriptor(), false, 'no value is not a Data Descriptor'); + t.equal(ES.IsGenericDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); + + t.equal(ES.IsGenericDescriptor(accessorDescriptor()), false, 'accessor descriptor is not a generic Descriptor'); + t.equal(ES.IsGenericDescriptor(mutatorDescriptor()), false, 'mutator descriptor is not a generic Descriptor'); + t.equal(ES.IsGenericDescriptor(dataDescriptor()), false, 'data descriptor is not a generic Descriptor'); + + t.equal(ES.IsGenericDescriptor(genericDescriptor()), true, 'generic descriptor is a generic Descriptor'); + + t.end(); + }); + + test('FromPropertyDescriptor', function (t) { + t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined'); + t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined'); + + forEach(v.nonUndefinedPrimitives, function (primitive) { + t['throws']( + function () { ES.FromPropertyDescriptor(primitive); }, + TypeError, + debug(primitive) + ' is not a Property Descriptor' + ); + }); + + var accessor = accessorDescriptor(); + t.deepEqual(ES.FromPropertyDescriptor(accessor), { + get: accessor['[[Get]]'], + set: accessor['[[Set]]'], + enumerable: !!accessor['[[Enumerable]]'], + configurable: !!accessor['[[Configurable]]'] + }); + + var mutator = mutatorDescriptor(); + t.deepEqual(ES.FromPropertyDescriptor(mutator), { + get: mutator['[[Get]]'], + set: mutator['[[Set]]'], + enumerable: !!mutator['[[Enumerable]]'], + configurable: !!mutator['[[Configurable]]'] + }); + var data = dataDescriptor(); + t.deepEqual(ES.FromPropertyDescriptor(data), { + value: data['[[Value]]'], + writable: data['[[Writable]]'], + enumerable: !!data['[[Enumerable]]'], + configurable: !!data['[[Configurable]]'] + }); + + t['throws']( + function () { ES.FromPropertyDescriptor(genericDescriptor()); }, + TypeError, + 'a complete Property Descriptor is required' + ); + + t.end(); + }); + + test('ToPropertyDescriptor', function (t) { + forEach(v.nonUndefinedPrimitives, function (primitive) { + t['throws']( + function () { ES.ToPropertyDescriptor(primitive); }, + TypeError, + debug(primitive) + ' is not an Object' + ); + }); + + var accessor = accessorDescriptor(); + t.deepEqual(ES.ToPropertyDescriptor({ + get: accessor['[[Get]]'], + enumerable: !!accessor['[[Enumerable]]'], + configurable: !!accessor['[[Configurable]]'] + }), accessor); + + var mutator = mutatorDescriptor(); + t.deepEqual(ES.ToPropertyDescriptor({ + set: mutator['[[Set]]'], + enumerable: !!mutator['[[Enumerable]]'], + configurable: !!mutator['[[Configurable]]'] + }), mutator); + + var data = dataDescriptor(); + t.deepEqual(ES.ToPropertyDescriptor({ + value: data['[[Value]]'], + writable: data['[[Writable]]'], + configurable: !!data['[[Configurable]]'] + }), assign(data, { '[[Configurable]]': false })); + + var both = bothDescriptor(); + t['throws']( + function () { + ES.FromPropertyDescriptor({ get: both['[[Get]]'], value: both['[[Value]]'] }); + }, + TypeError, + 'data and accessor descriptors are mutually exclusive' + ); + + t.end(); + }); + + test('CompletePropertyDescriptor', function (t) { + forEach(v.nonUndefinedPrimitives, function (primitive) { + t['throws']( + function () { ES.CompletePropertyDescriptor(primitive); }, + TypeError, + debug(primitive) + ' is not a Property Descriptor' + ); + }); + + var generic = genericDescriptor(); + t.deepEqual(ES.CompletePropertyDescriptor(generic), { + '[[Configurable]]': !!generic['[[Configurable]]'], + '[[Enumerable]]': !!generic['[[Enumerable]]'], + '[[Value]]': undefined, + '[[Writable]]': false + }, 'completes a Generic Descriptor'); + + var data = dataDescriptor(); + t.deepEqual(ES.CompletePropertyDescriptor(data), { + '[[Configurable]]': !!data['[[Configurable]]'], + '[[Enumerable]]': false, + '[[Value]]': data['[[Value]]'], + '[[Writable]]': !!data['[[Writable]]'] + }, 'completes a Data Descriptor'); + + var accessor = accessorDescriptor(); + t.deepEqual(ES.CompletePropertyDescriptor(accessor), { + '[[Get]]': accessor['[[Get]]'], + '[[Enumerable]]': !!accessor['[[Enumerable]]'], + '[[Configurable]]': !!accessor['[[Configurable]]'], + '[[Set]]': undefined + }, 'completes an Accessor Descriptor'); + + var mutator = mutatorDescriptor(); + t.deepEqual(ES.CompletePropertyDescriptor(mutator), { + '[[Set]]': mutator['[[Set]]'], + '[[Enumerable]]': !!mutator['[[Enumerable]]'], + '[[Configurable]]': !!mutator['[[Configurable]]'], + '[[Get]]': undefined + }, 'completes a mutator Descriptor'); + + t['throws']( + function () { ES.CompletePropertyDescriptor(bothDescriptor()); }, + TypeError, + 'data and accessor descriptors are mutually exclusive' + ); + + t.end(); + }); + + test('Set', function (t) { + forEach(v.primitives, function (primitive) { + t['throws']( + function () { ES.Set(primitive, '', null, false); }, + TypeError, + debug(primitive) + ' is not an Object' + ); + }); + + forEach(v.nonPropertyKeys, function (nonKey) { + t['throws']( + function () { ES.Set({}, nonKey, null, false); }, + TypeError, + debug(nonKey) + ' is not a Property Key' + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { ES.Set({}, '', null, nonBoolean); }, + TypeError, + debug(nonBoolean) + ' is not a Boolean' + ); + }); + + var o = {}; + var value = {}; + ES.Set(o, 'key', value, true); + t.deepEqual(o, { key: value }, 'key is set'); + + t.test('nonwritable', { skip: !Object.defineProperty }, function (st) { + var obj = { a: value }; + Object.defineProperty(obj, 'a', { writable: false }); + + st['throws']( + function () { ES.Set(obj, 'a', value, true); }, + TypeError, + 'can not Set nonwritable property' + ); + + st.doesNotThrow( + function () { ES.Set(obj, 'a', value, false); }, + 'setting Throw to false prevents an exception' + ); + + st.end(); + }); + + t.test('nonconfigurable', { skip: !Object.defineProperty }, function (st) { + var obj = { a: value }; + Object.defineProperty(obj, 'a', { configurable: false }); + + ES.Set(obj, 'a', value, true); + st.deepEqual(obj, { a: value }, 'key is set'); + + st.end(); + }); + + t.end(); + }); + + test('HasOwnProperty', function (t) { + forEach(v.primitives, function (primitive) { + t['throws']( + function () { ES.HasOwnProperty(primitive, 'key'); }, + TypeError, + debug(primitive) + ' is not an Object' + ); + }); + + forEach(v.nonPropertyKeys, function (nonKey) { + t['throws']( + function () { ES.HasOwnProperty({}, nonKey); }, + TypeError, + debug(nonKey) + ' is not a Property Key' + ); + }); + + t.equal(ES.HasOwnProperty({}, 'toString'), false, 'inherited properties are not own'); + t.equal( + ES.HasOwnProperty({ toString: 1 }, 'toString'), + true, + 'shadowed inherited own properties are own' + ); + t.equal(ES.HasOwnProperty({ a: 1 }, 'a'), true, 'own properties are own'); + + t.end(); + }); + + test('HasProperty', function (t) { + forEach(v.primitives, function (primitive) { + t['throws']( + function () { ES.HasProperty(primitive, 'key'); }, + TypeError, + debug(primitive) + ' is not an Object' + ); + }); + + forEach(v.nonPropertyKeys, function (nonKey) { + t['throws']( + function () { ES.HasProperty({}, nonKey); }, + TypeError, + debug(nonKey) + ' is not a Property Key' + ); + }); + + t.equal(ES.HasProperty({}, 'nope'), false, 'object does not have nonexistent properties'); + t.equal(ES.HasProperty({}, 'toString'), true, 'object has inherited properties'); + t.equal( + ES.HasProperty({ toString: 1 }, 'toString'), + true, + 'object has shadowed inherited own properties' + ); + t.equal(ES.HasProperty({ a: 1 }, 'a'), true, 'object has own properties'); + + t.end(); + }); + + test('IsConcatSpreadable', function (t) { + forEach(v.primitives, function (primitive) { + t.equal(ES.IsConcatSpreadable(primitive), false, debug(primitive) + ' is not an Object'); + }); + + var hasSymbolConcatSpreadable = v.hasSymbols && Symbol.isConcatSpreadable; + t.test('Symbol.isConcatSpreadable', { skip: !hasSymbolConcatSpreadable }, function (st) { + forEach(v.falsies, function (falsy) { + var obj = {}; + obj[Symbol.isConcatSpreadable] = falsy; + st.equal( + ES.IsConcatSpreadable(obj), + false, + 'an object with ' + debug(falsy) + ' as Symbol.isConcatSpreadable is not concat spreadable' + ); + }); + + forEach(v.truthies, function (truthy) { + var obj = {}; + obj[Symbol.isConcatSpreadable] = truthy; + st.equal( + ES.IsConcatSpreadable(obj), + true, + 'an object with ' + debug(truthy) + ' as Symbol.isConcatSpreadable is concat spreadable' + ); + }); + + st.end(); + }); + + forEach(v.objects, function (object) { + t.equal( + ES.IsConcatSpreadable(object), + false, + 'non-array without Symbol.isConcatSpreadable is not concat spreadable' + ); + }); + + t.equal(ES.IsConcatSpreadable([]), true, 'arrays are concat spreadable'); + + t.end(); + }); + + test('Invoke', function (t) { + forEach(v.nonPropertyKeys, function (nonKey) { + t['throws']( + function () { ES.Invoke({}, nonKey); }, + TypeError, + debug(nonKey) + ' is not a Property Key' + ); + }); + + t['throws'](function () { ES.Invoke({ o: false }, 'o'); }, TypeError, 'fails on a non-function'); + + t.test('invoked callback', function (st) { + var aValue = {}; + var bValue = {}; + var obj = { + f: function (a) { + st.equal(arguments.length, 2, '2 args passed'); + st.equal(a, aValue, 'first arg is correct'); + st.equal(arguments[1], bValue, 'second arg is correct'); + } + }; + st.plan(3); + ES.Invoke(obj, 'f', aValue, bValue); + }); + + t.end(); + }); + + test('GetIterator', { skip: true }); + + test('IteratorNext', { skip: true }); + + test('IteratorComplete', { skip: true }); + + test('IteratorValue', { skip: true }); + + test('IteratorStep', { skip: true }); + + test('IteratorClose', { skip: true }); + + test('CreateIterResultObject', function (t) { + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { ES.CreateIterResultObject({}, nonBoolean); }, + TypeError, + '"done" argument must be a boolean; ' + debug(nonBoolean) + ' is not' + ); + }); + + var value = {}; + t.deepEqual(ES.CreateIterResultObject(value, true), { + value: value, + done: true + }, 'creates a "done" iteration result'); + t.deepEqual(ES.CreateIterResultObject(value, false), { + value: value, + done: false + }, 'creates a "not done" iteration result'); + + t.end(); + }); + + test('RegExpExec', function (t) { + forEach(v.primitives, function (primitive) { + t['throws']( + function () { ES.RegExpExec(primitive); }, + TypeError, + '"R" argument must be an object; ' + debug(primitive) + ' is not' + ); + }); + + forEach(v.nonStrings, function (nonString) { + t['throws']( + function () { ES.RegExpExec({}, nonString); }, + TypeError, + '"S" argument must be a String; ' + debug(nonString) + ' is not' + ); + }); + + t.test('gets and calls a callable "exec"', function (st) { + var str = '123'; + var o = { + exec: function (S) { + st.equal(this, o, '"exec" receiver is R'); + st.equal(S, str, '"exec" argument is S'); + + return null; + } + }; + st.plan(2); + ES.RegExpExec(o, str); + st.end(); + }); + + t.test('throws if a callable "exec" returns a non-null non-object', function (st) { + var str = '123'; + st.plan(v.nonNullPrimitives.length); + forEach(v.nonNullPrimitives, function (nonNullPrimitive) { + st['throws']( + function () { ES.RegExpExec({ exec: function () { return nonNullPrimitive; } }, str); }, + TypeError, + '"exec" method must return `null` or an Object; ' + debug(nonNullPrimitive) + ' is not' + ); + }); + st.end(); + }); + + t.test('actual regex that should match against a string', function (st) { + var S = 'aabc'; + var R = /a/g; + var match1 = ES.RegExpExec(R, S); + var match2 = ES.RegExpExec(R, S); + var match3 = ES.RegExpExec(R, S); + st.deepEqual(match1, assign(['a'], groups({ index: 0, input: S })), 'match object 1 is as expected'); + st.deepEqual(match2, assign(['a'], groups({ index: 1, input: S })), 'match object 2 is as expected'); + st.equal(match3, null, 'match 3 is null as expected'); + st.end(); + }); + + t.test('actual regex that should match against a string, with shadowed "exec"', function (st) { + var S = 'aabc'; + var R = /a/g; + R.exec = undefined; + var match1 = ES.RegExpExec(R, S); + var match2 = ES.RegExpExec(R, S); + var match3 = ES.RegExpExec(R, S); + st.deepEqual(match1, assign(['a'], groups({ index: 0, input: S })), 'match object 1 is as expected'); + st.deepEqual(match2, assign(['a'], groups({ index: 1, input: S })), 'match object 2 is as expected'); + st.equal(match3, null, 'match 3 is null as expected'); + st.end(); + }); + t.end(); + }); + + test('ArraySpeciesCreate', function (t) { + t.test('errors', function (st) { + var testNonNumber = function (nonNumber) { + st['throws']( + function () { ES.ArraySpeciesCreate([], nonNumber); }, + TypeError, + debug(nonNumber) + ' is not a number' + ); + }; + forEach(v.nonNumbers, testNonNumber); + + st['throws']( + function () { ES.ArraySpeciesCreate([], -1); }, + TypeError, + '-1 is not >= 0' + ); + st['throws']( + function () { ES.ArraySpeciesCreate([], -Infinity); }, + TypeError, + '-Infinity is not >= 0' + ); + + var testNonIntegers = function (nonInteger) { + st['throws']( + function () { ES.ArraySpeciesCreate([], nonInteger); }, + TypeError, + debug(nonInteger) + ' is not an integer' + ); + }; + forEach(v.nonIntegerNumbers, testNonIntegers); + + st.end(); + }); + + t.test('works with a non-array', function (st) { + forEach(v.objects.concat(v.primitives), function (nonArray) { + var arr = ES.ArraySpeciesCreate(nonArray, 0); + st.ok(ES.IsArray(arr), 'is an array'); + st.equal(arr.length, 0, 'length is correct'); + st.equal(arr.constructor, Array, 'constructor is correct'); + }); + + st.end(); + }); + + t.test('works with a normal array', function (st) { + var len = 2; + var orig = [1, 2, 3]; + var arr = ES.ArraySpeciesCreate(orig, len); + + st.ok(ES.IsArray(arr), 'is an array'); + st.equal(arr.length, len, 'length is correct'); + st.equal(arr.constructor, orig.constructor, 'constructor is correct'); + + st.end(); + }); + + t.test('-0 length produces +0 length', function (st) { + var len = -0; + st.ok(is(len, -0), '-0 is negative zero'); + st.notOk(is(len, 0), '-0 is not positive zero'); + + var orig = [1, 2, 3]; + var arr = ES.ArraySpeciesCreate(orig, len); + + st.equal(ES.IsArray(arr), true); + st.ok(is(arr.length, 0)); + st.equal(arr.constructor, orig.constructor); + + st.end(); + }); + + t.test('works with species construtor', { skip: !hasSpecies }, function (st) { + var sentinel = {}; + var Foo = function Foo(len) { + this.length = len; + this.sentinel = sentinel; + }; + var Bar = getArraySubclassWithSpeciesConstructor(Foo); + var bar = new Bar(); + + t.equal(ES.IsArray(bar), true, 'Bar instance is an array'); + + var arr = ES.ArraySpeciesCreate(bar, 3); + st.equal(arr.constructor, Foo, 'result used species constructor'); + st.equal(arr.length, 3, 'length property is correct'); + st.equal(arr.sentinel, sentinel, 'Foo constructor was exercised'); + + st.end(); + }); + + t.test('works with null species constructor', { skip: !hasSpecies }, function (st) { + var Bar = getArraySubclassWithSpeciesConstructor(null); + var bar = new Bar(); + + t.equal(ES.IsArray(bar), true, 'Bar instance is an array'); + + var arr = ES.ArraySpeciesCreate(bar, 3); + st.equal(arr.constructor, Array, 'result used default constructor'); + st.equal(arr.length, 3, 'length property is correct'); + + st.end(); + }); + + t.test('works with undefined species constructor', { skip: !hasSpecies }, function (st) { + var Bar = getArraySubclassWithSpeciesConstructor(); + var bar = new Bar(); + + t.equal(ES.IsArray(bar), true, 'Bar instance is an array'); + + var arr = ES.ArraySpeciesCreate(bar, 3); + st.equal(arr.constructor, Array, 'result used default constructor'); + st.equal(arr.length, 3, 'length property is correct'); + + st.end(); + }); + + t.test('throws with object non-construtor species constructor', { skip: !hasSpecies }, function (st) { + forEach(v.objects, function (obj) { + var Bar = getArraySubclassWithSpeciesConstructor(obj); + var bar = new Bar(); + + st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); + + st['throws']( + function () { ES.ArraySpeciesCreate(bar, 3); }, + TypeError, + debug(obj) + ' is not a constructor' + ); + }); + + st.end(); + }); + + t.end(); + }); + + test('CreateDataProperty', function (t) { + forEach(v.primitives, function (primitive) { + t['throws']( + function () { ES.CreateDataProperty(primitive); }, + TypeError, + debug(primitive) + ' is not an object' + ); + }); + + forEach(v.nonPropertyKeys, function (nonPropertyKey) { + t['throws']( + function () { ES.CreateDataProperty({}, nonPropertyKey); }, + TypeError, + debug(nonPropertyKey) + ' is not a property key' + ); + }); + + var sentinel = {}; + forEach(v.propertyKeys, function (propertyKey) { + var obj = {}; + var status = ES.CreateDataProperty(obj, propertyKey, sentinel); + t.equal(status, true, 'status is true'); + t.equal( + obj[propertyKey], + sentinel, + debug(sentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' + ); + + if (typeof Object.defineProperty === 'function') { + var nonWritable = Object.defineProperty({}, propertyKey, { configurable: true, writable: false }); + + var nonWritableStatus = ES.CreateDataProperty(nonWritable, propertyKey, sentinel); + t.equal(nonWritableStatus, false, 'create data property failed'); + t.notEqual( + nonWritable[propertyKey], + sentinel, + debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object when key is nonwritable' + ); + + var nonConfigurable = Object.defineProperty({}, propertyKey, { configurable: false, writable: true }); + + var nonConfigurableStatus = ES.CreateDataProperty(nonConfigurable, propertyKey, sentinel); + t.equal(nonConfigurableStatus, false, 'create data property failed'); + t.notEqual( + nonConfigurable[propertyKey], + sentinel, + debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object when key is nonconfigurable' + ); + } + }); + + t.end(); + }); + + test('CreateDataPropertyOrThrow', function (t) { + forEach(v.primitives, function (primitive) { + t['throws']( + function () { ES.CreateDataPropertyOrThrow(primitive); }, + TypeError, + debug(primitive) + ' is not an object' + ); + }); + + forEach(v.nonPropertyKeys, function (nonPropertyKey) { + t['throws']( + function () { ES.CreateDataPropertyOrThrow({}, nonPropertyKey); }, + TypeError, + debug(nonPropertyKey) + ' is not a property key' + ); + }); + + var sentinel = {}; + forEach(v.propertyKeys, function (propertyKey) { + var obj = {}; + var status = ES.CreateDataPropertyOrThrow(obj, propertyKey, sentinel); + t.equal(status, true, 'status is true'); + t.equal( + obj[propertyKey], + sentinel, + debug(sentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' + ); + + if (typeof Object.preventExtensions === 'function') { + var notExtensible = {}; + Object.preventExtensions(notExtensible); + + t['throws']( + function () { ES.CreateDataPropertyOrThrow(notExtensible, propertyKey, sentinel); }, + TypeError, + 'can not install ' + debug(propertyKey) + ' on non-extensible object' + ); + t.notEqual( + notExtensible[propertyKey], + sentinel, + debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object' + ); + } + }); + + t.end(); + }); + + test('ObjectCreate', function (t) { + forEach(v.nonNullPrimitives, function (value) { + t['throws']( + function () { ES.ObjectCreate(value); }, + TypeError, + debug(value) + ' is not null, or an object' + ); + }); + + t.test('proto arg', function (st) { + var Parent = function Parent() {}; + Parent.prototype.foo = {}; + var child = ES.ObjectCreate(Parent.prototype); + st.equal(child instanceof Parent, true, 'child is instanceof Parent'); + st.equal(child.foo, Parent.prototype.foo, 'child inherits properties from Parent.prototype'); + + st.end(); + }); + + t.test('internal slots arg', function (st) { + st.doesNotThrow(function () { ES.ObjectCreate(null, []); }, 'an empty slot list is valid'); + + st['throws']( + function () { ES.ObjectCreate(null, ['a']); }, + SyntaxError, + 'internal slots are not supported' + ); + + st.end(); + }); + + t.test('null proto', { skip: !Object.create }, function (st) { + st.equal('toString' in ({}), true, 'normal objects have toString'); + st.equal('toString' in ES.ObjectCreate(null), false, 'makes a null object'); + + st.end(); + }); + + t.test('null proto when no native Object.create', { skip: Object.create }, function (st) { + st['throws']( + function () { ES.ObjectCreate(null); }, + SyntaxError, + 'without a native Object.create, can not create null objects' + ); + + st.end(); + }); + + t.end(); + }); + + test('AdvanceStringIndex', function (t) { + forEach(v.nonStrings, function (nonString) { + t['throws']( + function () { ES.AdvanceStringIndex(nonString); }, + TypeError, + '"S" argument must be a String; ' + debug(nonString) + ' is not' + ); + }); + + var notInts = v.nonNumbers.concat( + v.nonIntegerNumbers, + [Infinity, -Infinity, NaN, [], new Date(), Math.pow(2, 53), -1] + ); + forEach(notInts, function (nonInt) { + t['throws']( + function () { ES.AdvanceStringIndex('abc', nonInt); }, + TypeError, + '"index" argument must be an integer, ' + debug(nonInt) + ' is not.' + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { ES.AdvanceStringIndex('abc', 0, nonBoolean); }, + TypeError, + debug(nonBoolean) + ' is not a Boolean' + ); + }); + + var str = 'a\uD83D\uDCA9c'; + + t.test('non-unicode mode', function (st) { + for (var i = 0; i < str.length + 2; i += 1) { + st.equal(ES.AdvanceStringIndex(str, i, false), i + 1, i + ' advances to ' + (i + 1)); + } + + st.end(); + }); + + t.test('unicode mode', function (st) { + st.equal(ES.AdvanceStringIndex(str, 0, true), 1, '0 advances to 1'); + st.equal(ES.AdvanceStringIndex(str, 1, true), 3, '1 advances to 3'); + st.equal(ES.AdvanceStringIndex(str, 2, true), 3, '2 advances to 3'); + st.equal(ES.AdvanceStringIndex(str, 3, true), 4, '3 advances to 4'); + st.equal(ES.AdvanceStringIndex(str, 4, true), 5, '4 advances to 5'); + + st.end(); + }); + + t.test('lone surrogates', function (st) { + var halfPoo = 'a\uD83Dc'; + + st.equal(ES.AdvanceStringIndex(halfPoo, 0, true), 1, '0 advances to 1'); + st.equal(ES.AdvanceStringIndex(halfPoo, 1, true), 2, '1 advances to 2'); + st.equal(ES.AdvanceStringIndex(halfPoo, 2, true), 3, '2 advances to 3'); + st.equal(ES.AdvanceStringIndex(halfPoo, 3, true), 4, '3 advances to 4'); + + st.end(); + }); + + t.test('surrogate pairs', function (st) { + var lowestPair = String.fromCharCode('0xD800') + String.fromCharCode('0xDC00'); + var highestPair = String.fromCharCode('0xDBFF') + String.fromCharCode('0xDFFF'); + var poop = String.fromCharCode('0xD83D') + String.fromCharCode('0xDCA9'); + + st.equal(ES.AdvanceStringIndex(lowestPair, 0, true), 2, 'lowest surrogate pair, 0 -> 2'); + st.equal(ES.AdvanceStringIndex(highestPair, 0, true), 2, 'highest surrogate pair, 0 -> 2'); + st.equal(ES.AdvanceStringIndex(poop, 0, true), 2, 'poop, 0 -> 2'); + + st.end(); + }); + + t.end(); + }); +}; + +var es2016 = function ES2016(ES, ops, expectedMissing) { + es2015(ES, ops, expectedMissing); + + test('SameValueNonNumber', function (t) { + var willThrow = [ + [3, 4], + [NaN, 4], + [4, ''], + ['abc', true], + [{}, false] + ]; + forEach(willThrow, function (nums) { + t['throws'](function () { return ES.SameValueNonNumber.apply(ES, nums); }, TypeError, 'value must be same type and non-number'); + }); + + forEach(v.objects.concat(v.nonNumberPrimitives), function (val) { + t.equal(val === val, ES.SameValueNonNumber(val, val), debug(val) + ' is SameValueNonNumber to itself'); + }); + + t.end(); + }); +}; + +var es2017 = function E2017(ES, ops, expectedMissing) { + es2016(ES, ops, expectedMissing); + + test('ToIndex', function (t) { + t.ok(is(ES.ToIndex(), 0), 'no value gives 0'); + t.ok(is(ES.ToIndex(undefined), 0), 'undefined value gives 0'); + + t['throws'](function () { ES.ToIndex(-1); }, RangeError, 'negative numbers throw'); + + t['throws'](function () { ES.ToIndex(MAX_SAFE_INTEGER + 1); }, RangeError, 'too large numbers throw'); + + t.equal(ES.ToIndex(3), 3, 'numbers work'); + t.equal(ES.ToIndex(v.valueOfOnlyObject), 4, 'coercible objects are coerced'); + + t.end(); + }); +}; + +module.exports = { + es2015: es2015, + es2016: es2016, + es2017: es2017 +}; diff --git a/node_modules/es-to-primitive/.editorconfig b/node_modules/es-to-primitive/.editorconfig new file mode 100644 index 0000000000000..bc228f8269443 --- /dev/null +++ b/node_modules/es-to-primitive/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/es-to-primitive/.jscs.json b/node_modules/es-to-primitive/.jscs.json new file mode 100644 index 0000000000000..8666c750db96c --- /dev/null +++ b/node_modules/es-to-primitive/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 12 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": false, + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array", "GetMethod"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/es-to-primitive/.travis.yml b/node_modules/es-to-primitive/.travis.yml new file mode 100644 index 0000000000000..c9ee1ece78cb6 --- /dev/null +++ b/node_modules/es-to-primitive/.travis.yml @@ -0,0 +1,243 @@ +language: node_js +cache: + directories: + - "$(nvm cache dir)" +os: + - linux +node_js: + - "10.11" + - "9.11" + - "8.12" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.11" + - "0.10" + - "0.8" + - "0.6" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "10.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - env: COVERAGE=true + - node_js: "0.6" diff --git a/node_modules/es-to-primitive/CHANGELOG.md b/node_modules/es-to-primitive/CHANGELOG.md new file mode 100644 index 0000000000000..962986969d1f7 --- /dev/null +++ b/node_modules/es-to-primitive/CHANGELOG.md @@ -0,0 +1,38 @@ +1.2.0 / 2018-09-27 +================= + * [New] create ES2015 entry point/property, to replace ES6 + * [Fix] Ensure optional arguments are not part of the length (#29) + * [Deps] update `is-callable` + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `object-inspect`, `replace` + * [Tests] avoid util.inspect bug with `new Date(NaN)` on node v6.0 and v6.1. + * [Tests] up to `node` `v10.11`, `v9.11`, `v8.12`, `v6.14`, `v4.9` + +1.1.1 / 2016-01-03 +================= + * [Fix: ES5] fix coercion logic: ES5’s ToPrimitive does not coerce any primitive value, regardless of hint (#2) + +1.1.0 / 2015-12-27 +================= + * [New] add `Symbol.toPrimitive` support + * [Deps] update `is-callable`, `is-date-object` + * [Dev Deps] update `eslint`, `tape`, `semver`, `jscs`, `covert`, `nsp`, `@ljharb/eslint-config` + * [Dev Deps] remove unused deps + * [Tests] up to `node` `v5.3` + * [Tests] fix npm upgrades on older node versions + * [Tests] fix testling + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + +1.0.1 / 2016-01-03 +================= + * [Fix: ES5] fix coercion logic: ES5’s ToPrimitive does not coerce any primitive value, regardless of hint (#2) + * [Deps] update `is-callable`, `is-date-object` + * [Dev Deps] update `eslint`, `tape`, `semver`, `jscs`, `covert`, `nsp`, `@ljharb/eslint-config` + * [Dev Deps] remove unused deps + * [Tests] up to `node` `v5.3` + * [Tests] fix npm upgrades on older node versions + * [Tests] fix testling + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + +1.0.0 / 2015-03-19 +================= + * Initial release. diff --git a/node_modules/es-to-primitive/LICENSE b/node_modules/es-to-primitive/LICENSE new file mode 100644 index 0000000000000..b43df444e5182 --- /dev/null +++ b/node_modules/es-to-primitive/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/node_modules/es-to-primitive/Makefile b/node_modules/es-to-primitive/Makefile new file mode 100644 index 0000000000000..b9e4fe1aab3dd --- /dev/null +++ b/node_modules/es-to-primitive/Makefile @@ -0,0 +1,61 @@ +# Since we rely on paths relative to the makefile location, abort if make isn't being run from there. +$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) + + # The files that need updating when incrementing the version number. +VERSIONED_FILES := *.js *.json README* + + +# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. +# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment +# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. +export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") +UTILS := semver +# Make sure that all required utilities can be located. +UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) + +# Default target (by virtue of being the first non '.'-prefixed in the file). +.PHONY: _no-target-specified +_no-target-specified: + $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) + +# Lists all targets defined in this makefile. +.PHONY: list +list: + @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort + +# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). +.PHONY: test +test: + @npm test + +.PHONY: _ensure-tag +_ensure-tag: +ifndef TAG + $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) +endif + +CHANGELOG_ERROR = $(error No CHANGELOG specified) +.PHONY: _ensure-changelog +_ensure-changelog: + @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) + +# Ensures that the git workspace is clean. +.PHONY: _ensure-clean +_ensure-clean: + @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } + +# Makes a release; invoke with `make TAG= release`. +.PHONY: release +release: _ensure-tag _ensure-changelog _ensure-clean + @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ + new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ + if printf "$$new_ver" | command grep -q '^[0-9]'; then \ + semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ + semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ + else \ + new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ + fi; \ + printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ + replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ + git tag -a -m "v$$new_ver" "v$$new_ver" diff --git a/node_modules/es-to-primitive/README.md b/node_modules/es-to-primitive/README.md new file mode 100644 index 0000000000000..1831ecf39564f --- /dev/null +++ b/node_modules/es-to-primitive/README.md @@ -0,0 +1,51 @@ +# es-to-primitive [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions. +When different versions of the spec conflict, the default export will be the latest version of the abstract operation. +Alternative versions will also be available under an `es5`/`es2015` exported property if you require a specific version. + +## Example + +```js +var toPrimitive = require('es-to-primitive'); +var assert = require('assert'); + +assert(toPrimitive(function () {}) === String(function () {})); + +var date = new Date(); +assert(toPrimitive(date) === String(date)); + +assert(toPrimitive({ valueOf: function () { return 3; } }) === 3); + +assert(toPrimitive(['a', 'b', 3]) === String(['a', 'b', 3])); + +var sym = Symbol(); +assert(toPrimitive(Object(sym)) === sym); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/es-to-primitive +[npm-version-svg]: http://versionbadg.es/ljharb/es-to-primitive.svg +[travis-svg]: https://travis-ci.org/ljharb/es-to-primitive.svg +[travis-url]: https://travis-ci.org/ljharb/es-to-primitive +[deps-svg]: https://david-dm.org/ljharb/es-to-primitive.svg +[deps-url]: https://david-dm.org/ljharb/es-to-primitive +[dev-deps-svg]: https://david-dm.org/ljharb/es-to-primitive/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-to-primitive#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/es-to-primitive.png +[testling-url]: https://ci.testling.com/ljharb/es-to-primitive +[npm-badge-png]: https://nodei.co/npm/es-to-primitive.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/es-to-primitive.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/es-to-primitive.svg +[downloads-url]: http://npm-stat.com/charts.html?package=es-to-primitive diff --git a/node_modules/es-to-primitive/es2015.js b/node_modules/es-to-primitive/es2015.js new file mode 100644 index 0000000000000..4a11a346c608c --- /dev/null +++ b/node_modules/es-to-primitive/es2015.js @@ -0,0 +1,75 @@ +'use strict'; + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; + +var isPrimitive = require('./helpers/isPrimitive'); +var isCallable = require('is-callable'); +var isDate = require('is-date-object'); +var isSymbol = require('is-symbol'); + +var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) { + if (typeof O === 'undefined' || O === null) { + throw new TypeError('Cannot call method on ' + O); + } + if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) { + throw new TypeError('hint must be "string" or "number"'); + } + var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; + var method, result, i; + for (i = 0; i < methodNames.length; ++i) { + method = O[methodNames[i]]; + if (isCallable(method)) { + result = method.call(O); + if (isPrimitive(result)) { + return result; + } + } + } + throw new TypeError('No default value'); +}; + +var GetMethod = function GetMethod(O, P) { + var func = O[P]; + if (func !== null && typeof func !== 'undefined') { + if (!isCallable(func)) { + throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function'); + } + return func; + } + return void 0; +}; + +// http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive +module.exports = function ToPrimitive(input) { + if (isPrimitive(input)) { + return input; + } + var hint = 'default'; + if (arguments.length > 1) { + if (arguments[1] === String) { + hint = 'string'; + } else if (arguments[1] === Number) { + hint = 'number'; + } + } + + var exoticToPrim; + if (hasSymbols) { + if (Symbol.toPrimitive) { + exoticToPrim = GetMethod(input, Symbol.toPrimitive); + } else if (isSymbol(input)) { + exoticToPrim = Symbol.prototype.valueOf; + } + } + if (typeof exoticToPrim !== 'undefined') { + var result = exoticToPrim.call(input, hint); + if (isPrimitive(result)) { + return result; + } + throw new TypeError('unable to convert exotic object to primitive'); + } + if (hint === 'default' && (isDate(input) || isSymbol(input))) { + hint = 'string'; + } + return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint); +}; diff --git a/node_modules/es-to-primitive/es5.js b/node_modules/es-to-primitive/es5.js new file mode 100644 index 0000000000000..602aa362c7e3e --- /dev/null +++ b/node_modules/es-to-primitive/es5.js @@ -0,0 +1,45 @@ +'use strict'; + +var toStr = Object.prototype.toString; + +var isPrimitive = require('./helpers/isPrimitive'); + +var isCallable = require('is-callable'); + +// http://ecma-international.org/ecma-262/5.1/#sec-8.12.8 +var ES5internalSlots = { + '[[DefaultValue]]': function (O) { + var actualHint; + if (arguments.length > 1) { + actualHint = arguments[1]; + } else { + actualHint = toStr.call(O) === '[object Date]' ? String : Number; + } + + if (actualHint === String || actualHint === Number) { + var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString']; + var value, i; + for (i = 0; i < methods.length; ++i) { + if (isCallable(O[methods[i]])) { + value = O[methods[i]](); + if (isPrimitive(value)) { + return value; + } + } + } + throw new TypeError('No default value'); + } + throw new TypeError('invalid [[DefaultValue]] hint supplied'); + } +}; + +// http://ecma-international.org/ecma-262/5.1/#sec-9.1 +module.exports = function ToPrimitive(input) { + if (isPrimitive(input)) { + return input; + } + if (arguments.length > 1) { + return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]); + } + return ES5internalSlots['[[DefaultValue]]'](input); +}; diff --git a/node_modules/es-to-primitive/es6.js b/node_modules/es-to-primitive/es6.js new file mode 100644 index 0000000000000..2d1f4dc927a90 --- /dev/null +++ b/node_modules/es-to-primitive/es6.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./es2015'); diff --git a/node_modules/es-to-primitive/helpers/isPrimitive.js b/node_modules/es-to-primitive/helpers/isPrimitive.js new file mode 100644 index 0000000000000..3669156452759 --- /dev/null +++ b/node_modules/es-to-primitive/helpers/isPrimitive.js @@ -0,0 +1,3 @@ +module.exports = function isPrimitive(value) { + return value === null || (typeof value !== 'function' && typeof value !== 'object'); +}; diff --git a/node_modules/es-to-primitive/index.js b/node_modules/es-to-primitive/index.js new file mode 100644 index 0000000000000..e60d912e11332 --- /dev/null +++ b/node_modules/es-to-primitive/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var ES5 = require('./es5'); +var ES6 = require('./es6'); +var ES2015 = require('./es2015'); + +if (Object.defineProperty) { + Object.defineProperty(ES2015, 'ES5', { enumerable: false, value: ES5 }); + Object.defineProperty(ES2015, 'ES6', { enumerable: false, value: ES6 }); + Object.defineProperty(ES2015, 'ES2015', { enumerable: false, value: ES2015 }); +} else { + ES6.ES5 = ES5; + ES6.ES6 = ES6; + ES6.ES2015 = ES2015; +} + +module.exports = ES2015; diff --git a/node_modules/es-to-primitive/package.json b/node_modules/es-to-primitive/package.json new file mode 100644 index 0000000000000..c3191f047e29c --- /dev/null +++ b/node_modules/es-to-primitive/package.json @@ -0,0 +1,86 @@ +{ + "name": "es-to-primitive", + "version": "1.2.0", + "author": "Jordan Harband", + "description": "ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent security", + "tests-only": "node --es-staging test", + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "lint": "npm run --silent jscs && npm run --silent eslint", + "jscs": "jscs test/*.js *.js", + "eslint": "eslint test/*.js *.js", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/es-to-primitive.git" + }, + "keywords": [ + "primitive", + "abstract", + "ecmascript", + "es5", + "es6", + "es2015", + "toPrimitive", + "coerce", + "type", + "object", + "string", + "number", + "boolean", + "symbol", + "null", + "undefined" + ], + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "devDependencies": { + "@ljharb/eslint-config": "^13.0.0", + "covert": "^1.1.0", + "eslint": "^5.6.0", + "foreach": "^2.0.5", + "function.prototype.name": "^1.1.0", + "jscs": "^3.0.7", + "nsp": "^3.2.1", + "object-inspect": "^1.6.0", + "object-is": "^1.0.1", + "replace": "^1.0.0", + "semver": "^5.5.1", + "tape": "^4.9.1" + }, + "testling": { + "files": "test", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz" +,"_integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==" +,"_from": "es-to-primitive@1.2.0" +} \ No newline at end of file diff --git a/node_modules/es-to-primitive/test/es2015.js b/node_modules/es-to-primitive/test/es2015.js new file mode 100644 index 0000000000000..80f4083dd9315 --- /dev/null +++ b/node_modules/es-to-primitive/test/es2015.js @@ -0,0 +1,151 @@ +'use strict'; + +var test = require('tape'); +var toPrimitive = require('../es2015'); +var is = require('object-is'); +var forEach = require('foreach'); +var functionName = require('function.prototype.name'); +var debug = require('object-inspect'); + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; +var hasSymbolToPrimitive = hasSymbols && typeof Symbol.toPrimitive === 'symbol'; + +test('function properties', function (t) { + t.equal(toPrimitive.length, 1, 'length is 1'); + t.equal(functionName(toPrimitive), 'ToPrimitive', 'name is ToPrimitive'); + + t.end(); +}); + +var primitives = [null, undefined, true, false, 0, -0, 42, NaN, Infinity, -Infinity, '', 'abc']; + +test('primitives', function (t) { + forEach(primitives, function (i) { + t.ok(is(toPrimitive(i), i), 'toPrimitive(' + debug(i) + ') returns the same value'); + t.ok(is(toPrimitive(i, String), i), 'toPrimitive(' + debug(i) + ', String) returns the same value'); + t.ok(is(toPrimitive(i, Number), i), 'toPrimitive(' + debug(i) + ', Number) returns the same value'); + }); + t.end(); +}); + +test('Symbols', { skip: !hasSymbols }, function (t) { + var symbols = [ + Symbol('foo'), + Symbol.iterator, + Symbol['for']('foo') // eslint-disable-line no-restricted-properties + ]; + forEach(symbols, function (sym) { + t.equal(toPrimitive(sym), sym, 'toPrimitive(' + debug(sym) + ') returns the same value'); + t.equal(toPrimitive(sym, String), sym, 'toPrimitive(' + debug(sym) + ', String) returns the same value'); + t.equal(toPrimitive(sym, Number), sym, 'toPrimitive(' + debug(sym) + ', Number) returns the same value'); + }); + + var primitiveSym = Symbol('primitiveSym'); + var objectSym = Object(primitiveSym); + t.equal(toPrimitive(objectSym), primitiveSym, 'toPrimitive(' + debug(objectSym) + ') returns ' + debug(primitiveSym)); + t.equal(toPrimitive(objectSym, String), primitiveSym, 'toPrimitive(' + debug(objectSym) + ', String) returns ' + debug(primitiveSym)); + t.equal(toPrimitive(objectSym, Number), primitiveSym, 'toPrimitive(' + debug(objectSym) + ', Number) returns ' + debug(primitiveSym)); + t.end(); +}); + +test('Arrays', function (t) { + var arrays = [[], ['a', 'b'], [1, 2]]; + forEach(arrays, function (arr) { + t.equal(toPrimitive(arr), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array'); + t.equal(toPrimitive(arr, String), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array'); + t.equal(toPrimitive(arr, Number), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array'); + }); + t.end(); +}); + +test('Dates', function (t) { + var dates = [new Date(), new Date(0), new Date(NaN)]; + forEach(dates, function (date) { + t.equal(toPrimitive(date), String(date), 'toPrimitive(' + debug(date) + ') returns the string version of the date'); + t.equal(toPrimitive(date, String), String(date), 'toPrimitive(' + debug(date) + ') returns the string version of the date'); + t.ok(is(toPrimitive(date, Number), Number(date)), 'toPrimitive(' + debug(date) + ') returns the number version of the date'); + }); + t.end(); +}); + +var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } }; +var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } }; +var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } }; +var coercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return 42; } +}; +var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } }; +var uncoercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return function toStrFn() {}; } +}; + +test('Objects', function (t) { + t.equal(toPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf'); + t.equal(toPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf'); + t.equal(toPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to non-stringified toString'); + + t.equal(toPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to non-stringified toString'); + t.equal(toPrimitive(coercibleFnObject, Number), coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to non-stringified toString'); + t.equal(toPrimitive(coercibleFnObject, String), coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to non-stringified toString'); + + t.equal(toPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString'); + t.equal(toPrimitive({}, Number), '[object Object]', '{} with hint Number coerces to Object#toString'); + t.equal(toPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString'); + + t.equal(toPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns non-stringified toString'); + t.equal(toPrimitive(toStringOnlyObject, Number), toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns non-stringified toString'); + t.equal(toPrimitive(toStringOnlyObject, String), toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns non-stringified toString'); + + t.equal(toPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf'); + t.equal(toPrimitive(valueOfOnlyObject, Number), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf'); + t.equal(toPrimitive(valueOfOnlyObject, String), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns non-stringified valueOf'); + + t.test('Symbol.toPrimitive', { skip: !hasSymbolToPrimitive }, function (st) { + var overriddenObject = { toString: st.fail, valueOf: st.fail }; + overriddenObject[Symbol.toPrimitive] = function (hint) { return String(hint); }; + + st.equal(toPrimitive(overriddenObject), 'default', 'object with Symbol.toPrimitive + no hint invokes that'); + st.equal(toPrimitive(overriddenObject, Number), 'number', 'object with Symbol.toPrimitive + hint Number invokes that'); + st.equal(toPrimitive(overriddenObject, String), 'string', 'object with Symbol.toPrimitive + hint String invokes that'); + + var nullToPrimitive = { toString: coercibleObject.toString, valueOf: coercibleObject.valueOf }; + nullToPrimitive[Symbol.toPrimitive] = null; + st.equal(toPrimitive(nullToPrimitive), toPrimitive(coercibleObject), 'object with no hint + null Symbol.toPrimitive ignores it'); + st.equal(toPrimitive(nullToPrimitive, Number), toPrimitive(coercibleObject, Number), 'object with hint Number + null Symbol.toPrimitive ignores it'); + st.equal(toPrimitive(nullToPrimitive, String), toPrimitive(coercibleObject, String), 'object with hint String + null Symbol.toPrimitive ignores it'); + + st.test('exceptions', function (sst) { + var nonFunctionToPrimitive = { toString: sst.fail, valueOf: sst.fail }; + nonFunctionToPrimitive[Symbol.toPrimitive] = {}; + sst['throws'](toPrimitive.bind(null, nonFunctionToPrimitive), TypeError, 'Symbol.toPrimitive returning a non-function throws'); + + var uncoercibleToPrimitive = { toString: sst.fail, valueOf: sst.fail }; + uncoercibleToPrimitive[Symbol.toPrimitive] = function (hint) { + return { toString: function () { return hint; } }; + }; + sst['throws'](toPrimitive.bind(null, uncoercibleToPrimitive), TypeError, 'Symbol.toPrimitive returning an object throws'); + + var throwingToPrimitive = { toString: sst.fail, valueOf: sst.fail }; + throwingToPrimitive[Symbol.toPrimitive] = function (hint) { throw new RangeError(hint); }; + sst['throws'](toPrimitive.bind(null, throwingToPrimitive), RangeError, 'Symbol.toPrimitive throwing throws'); + + sst.end(); + }); + + st.end(); + }); + + t.test('exceptions', function (st) { + st['throws'](toPrimitive.bind(null, uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError'); + + st['throws'](toPrimitive.bind(null, uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError'); + st.end(); + }); + t.end(); +}); diff --git a/node_modules/es-to-primitive/test/es5.js b/node_modules/es-to-primitive/test/es5.js new file mode 100644 index 0000000000000..8b80ff5bd968a --- /dev/null +++ b/node_modules/es-to-primitive/test/es5.js @@ -0,0 +1,94 @@ +'use strict'; + +var test = require('tape'); +var toPrimitive = require('../es5'); +var is = require('object-is'); +var forEach = require('foreach'); +var functionName = require('function.prototype.name'); +var debug = require('object-inspect'); + +test('function properties', function (t) { + t.equal(toPrimitive.length, 1, 'length is 1'); + t.equal(functionName(toPrimitive), 'ToPrimitive', 'name is ToPrimitive'); + + t.end(); +}); + +var primitives = [null, undefined, true, false, 0, -0, 42, NaN, Infinity, -Infinity, '', 'abc']; + +test('primitives', function (t) { + forEach(primitives, function (i) { + t.ok(is(toPrimitive(i), i), 'toPrimitive(' + debug(i) + ') returns the same value'); + t.ok(is(toPrimitive(i, String), i), 'toPrimitive(' + debug(i) + ', String) returns the same value'); + t.ok(is(toPrimitive(i, Number), i), 'toPrimitive(' + debug(i) + ', Number) returns the same value'); + }); + t.end(); +}); + +test('Arrays', function (t) { + var arrays = [[], ['a', 'b'], [1, 2]]; + forEach(arrays, function (arr) { + t.ok(is(toPrimitive(arr), arr.toString()), 'toPrimitive(' + debug(arr) + ') returns toString of the array'); + t.equal(toPrimitive(arr, String), arr.toString(), 'toPrimitive(' + debug(arr) + ') returns toString of the array'); + t.ok(is(toPrimitive(arr, Number), arr.toString()), 'toPrimitive(' + debug(arr) + ') returns toString of the array'); + }); + t.end(); +}); + +test('Dates', function (t) { + var dates = [new Date(), new Date(0), new Date(NaN)]; + forEach(dates, function (date) { + t.equal(toPrimitive(date), date.toString(), 'toPrimitive(' + debug(date) + ') returns toString of the date'); + t.equal(toPrimitive(date, String), date.toString(), 'toPrimitive(' + debug(date) + ') returns toString of the date'); + t.ok(is(toPrimitive(date, Number), date.valueOf()), 'toPrimitive(' + debug(date) + ') returns valueOf of the date'); + }); + t.end(); +}); + +var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } }; +var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } }; +var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } }; +var coercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return 42; } +}; +var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } }; +var uncoercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return function toStrFn() {}; } +}; + +test('Objects', function (t) { + t.equal(toPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf'); + t.equal(toPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to toString'); + t.equal(toPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf'); + + t.equal(toPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to toString'); + t.equal(toPrimitive(coercibleFnObject, String), coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to toString'); + t.equal(toPrimitive(coercibleFnObject, Number), coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to toString'); + + t.ok(is(toPrimitive({}), '[object Object]'), '{} with no hint coerces to Object#toString'); + t.equal(toPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString'); + t.ok(is(toPrimitive({}, Number), '[object Object]'), '{} with hint Number coerces to Object#toString'); + + t.equal(toPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns toString'); + t.equal(toPrimitive(toStringOnlyObject, String), toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns toString'); + t.equal(toPrimitive(toStringOnlyObject, Number), toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns toString'); + + t.equal(toPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf'); + t.equal(toPrimitive(valueOfOnlyObject, String), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns valueOf'); + t.equal(toPrimitive(valueOfOnlyObject, Number), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf'); + + t.test('exceptions', function (st) { + st['throws'](toPrimitive.bind(null, uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError'); + + st['throws'](toPrimitive.bind(null, uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError'); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/es-to-primitive/test/es6.js b/node_modules/es-to-primitive/test/es6.js new file mode 100644 index 0000000000000..c6df63fb6dc08 --- /dev/null +++ b/node_modules/es-to-primitive/test/es6.js @@ -0,0 +1,151 @@ +'use strict'; + +var test = require('tape'); +var toPrimitive = require('../es6'); +var is = require('object-is'); +var forEach = require('foreach'); +var functionName = require('function.prototype.name'); +var debug = require('object-inspect'); + +var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; +var hasSymbolToPrimitive = hasSymbols && typeof Symbol.toPrimitive === 'symbol'; + +test('function properties', function (t) { + t.equal(toPrimitive.length, 1, 'length is 1'); + t.equal(functionName(toPrimitive), 'ToPrimitive', 'name is ToPrimitive'); + + t.end(); +}); + +var primitives = [null, undefined, true, false, 0, -0, 42, NaN, Infinity, -Infinity, '', 'abc']; + +test('primitives', function (t) { + forEach(primitives, function (i) { + t.ok(is(toPrimitive(i), i), 'toPrimitive(' + debug(i) + ') returns the same value'); + t.ok(is(toPrimitive(i, String), i), 'toPrimitive(' + debug(i) + ', String) returns the same value'); + t.ok(is(toPrimitive(i, Number), i), 'toPrimitive(' + debug(i) + ', Number) returns the same value'); + }); + t.end(); +}); + +test('Symbols', { skip: !hasSymbols }, function (t) { + var symbols = [ + Symbol('foo'), + Symbol.iterator, + Symbol['for']('foo') // eslint-disable-line no-restricted-properties + ]; + forEach(symbols, function (sym) { + t.equal(toPrimitive(sym), sym, 'toPrimitive(' + debug(sym) + ') returns the same value'); + t.equal(toPrimitive(sym, String), sym, 'toPrimitive(' + debug(sym) + ', String) returns the same value'); + t.equal(toPrimitive(sym, Number), sym, 'toPrimitive(' + debug(sym) + ', Number) returns the same value'); + }); + + var primitiveSym = Symbol('primitiveSym'); + var objectSym = Object(primitiveSym); + t.equal(toPrimitive(objectSym), primitiveSym, 'toPrimitive(' + debug(objectSym) + ') returns ' + debug(primitiveSym)); + t.equal(toPrimitive(objectSym, String), primitiveSym, 'toPrimitive(' + debug(objectSym) + ', String) returns ' + debug(primitiveSym)); + t.equal(toPrimitive(objectSym, Number), primitiveSym, 'toPrimitive(' + debug(objectSym) + ', Number) returns ' + debug(primitiveSym)); + t.end(); +}); + +test('Arrays', function (t) { + var arrays = [[], ['a', 'b'], [1, 2]]; + forEach(arrays, function (arr) { + t.equal(toPrimitive(arr), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array'); + t.equal(toPrimitive(arr, String), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array'); + t.equal(toPrimitive(arr, Number), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array'); + }); + t.end(); +}); + +test('Dates', function (t) { + var dates = [new Date(), new Date(0), new Date(NaN)]; + forEach(dates, function (date) { + t.equal(toPrimitive(date), String(date), 'toPrimitive(' + debug(date) + ') returns the string version of the date'); + t.equal(toPrimitive(date, String), String(date), 'toPrimitive(' + debug(date) + ') returns the string version of the date'); + t.ok(is(toPrimitive(date, Number), Number(date)), 'toPrimitive(' + debug(date) + ') returns the number version of the date'); + }); + t.end(); +}); + +var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } }; +var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } }; +var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } }; +var coercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return 42; } +}; +var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } }; +var uncoercibleFnObject = { + valueOf: function () { return function valueOfFn() {}; }, + toString: function () { return function toStrFn() {}; } +}; + +test('Objects', function (t) { + t.equal(toPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf'); + t.equal(toPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf'); + t.equal(toPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to non-stringified toString'); + + t.equal(toPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to non-stringified toString'); + t.equal(toPrimitive(coercibleFnObject, Number), coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to non-stringified toString'); + t.equal(toPrimitive(coercibleFnObject, String), coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to non-stringified toString'); + + t.equal(toPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString'); + t.equal(toPrimitive({}, Number), '[object Object]', '{} with hint Number coerces to Object#toString'); + t.equal(toPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString'); + + t.equal(toPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns non-stringified toString'); + t.equal(toPrimitive(toStringOnlyObject, Number), toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns non-stringified toString'); + t.equal(toPrimitive(toStringOnlyObject, String), toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns non-stringified toString'); + + t.equal(toPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf'); + t.equal(toPrimitive(valueOfOnlyObject, Number), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf'); + t.equal(toPrimitive(valueOfOnlyObject, String), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns non-stringified valueOf'); + + t.test('Symbol.toPrimitive', { skip: !hasSymbolToPrimitive }, function (st) { + var overriddenObject = { toString: st.fail, valueOf: st.fail }; + overriddenObject[Symbol.toPrimitive] = function (hint) { return String(hint); }; + + st.equal(toPrimitive(overriddenObject), 'default', 'object with Symbol.toPrimitive + no hint invokes that'); + st.equal(toPrimitive(overriddenObject, Number), 'number', 'object with Symbol.toPrimitive + hint Number invokes that'); + st.equal(toPrimitive(overriddenObject, String), 'string', 'object with Symbol.toPrimitive + hint String invokes that'); + + var nullToPrimitive = { toString: coercibleObject.toString, valueOf: coercibleObject.valueOf }; + nullToPrimitive[Symbol.toPrimitive] = null; + st.equal(toPrimitive(nullToPrimitive), toPrimitive(coercibleObject), 'object with no hint + null Symbol.toPrimitive ignores it'); + st.equal(toPrimitive(nullToPrimitive, Number), toPrimitive(coercibleObject, Number), 'object with hint Number + null Symbol.toPrimitive ignores it'); + st.equal(toPrimitive(nullToPrimitive, String), toPrimitive(coercibleObject, String), 'object with hint String + null Symbol.toPrimitive ignores it'); + + st.test('exceptions', function (sst) { + var nonFunctionToPrimitive = { toString: sst.fail, valueOf: sst.fail }; + nonFunctionToPrimitive[Symbol.toPrimitive] = {}; + sst['throws'](toPrimitive.bind(null, nonFunctionToPrimitive), TypeError, 'Symbol.toPrimitive returning a non-function throws'); + + var uncoercibleToPrimitive = { toString: sst.fail, valueOf: sst.fail }; + uncoercibleToPrimitive[Symbol.toPrimitive] = function (hint) { + return { toString: function () { return hint; } }; + }; + sst['throws'](toPrimitive.bind(null, uncoercibleToPrimitive), TypeError, 'Symbol.toPrimitive returning an object throws'); + + var throwingToPrimitive = { toString: sst.fail, valueOf: sst.fail }; + throwingToPrimitive[Symbol.toPrimitive] = function (hint) { throw new RangeError(hint); }; + sst['throws'](toPrimitive.bind(null, throwingToPrimitive), RangeError, 'Symbol.toPrimitive throwing throws'); + + sst.end(); + }); + + st.end(); + }); + + t.test('exceptions', function (st) { + st['throws'](toPrimitive.bind(null, uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError'); + + st['throws'](toPrimitive.bind(null, uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError'); + st['throws'](toPrimitive.bind(null, uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError'); + st.end(); + }); + t.end(); +}); diff --git a/node_modules/es-to-primitive/test/index.js b/node_modules/es-to-primitive/test/index.js new file mode 100644 index 0000000000000..ad71f39e2581e --- /dev/null +++ b/node_modules/es-to-primitive/test/index.js @@ -0,0 +1,20 @@ +'use strict'; + +var toPrimitive = require('../'); +var ES5 = require('../es5'); +var ES6 = require('../es6'); +var ES2015 = require('../es2015'); + +var test = require('tape'); + +test('default export', function (t) { + t.equal(toPrimitive, ES2015, 'default export is ES2015'); + t.equal(toPrimitive.ES5, ES5, 'ES5 property has ES5 method'); + t.equal(toPrimitive.ES6, ES6, 'ES6 property has ES6 method'); + t.equal(toPrimitive.ES2015, ES2015, 'ES2015 property has ES2015 method'); + t.end(); +}); + +require('./es5'); +require('./es6'); +require('./es2015'); diff --git a/node_modules/function-bind/.editorconfig b/node_modules/function-bind/.editorconfig new file mode 100644 index 0000000000000..ac29adef0361c --- /dev/null +++ b/node_modules/function-bind/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 120 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/function-bind/.jscs.json b/node_modules/function-bind/.jscs.json new file mode 100644 index 0000000000000..8c4479480be70 --- /dev/null +++ b/node_modules/function-bind/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 8 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/function-bind/.npmignore b/node_modules/function-bind/.npmignore new file mode 100644 index 0000000000000..dbb555fd1f9f5 --- /dev/null +++ b/node_modules/function-bind/.npmignore @@ -0,0 +1,22 @@ +# gitignore +.DS_Store +.monitor +.*.swp +.nodemonignore +releases +*.log +*.err +fleet.json +public/browserify +bin/*.json +.bin +build +compile +.lock-wscript +coverage +node_modules + +# Only apps should have lockfiles +npm-shrinkwrap.json +package-lock.json +yarn.lock diff --git a/node_modules/function-bind/.travis.yml b/node_modules/function-bind/.travis.yml new file mode 100644 index 0000000000000..85f70d2464f39 --- /dev/null +++ b/node_modules/function-bind/.travis.yml @@ -0,0 +1,168 @@ +language: node_js +os: + - linux +node_js: + - "8.4" + - "7.10" + - "6.11" + - "5.12" + - "4.8" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; else npm install -g npm; fi; fi' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: PRETEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/function-bind/LICENSE b/node_modules/function-bind/LICENSE new file mode 100644 index 0000000000000..62d6d237ff179 --- /dev/null +++ b/node_modules/function-bind/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Raynos. + +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/node_modules/function-bind/README.md b/node_modules/function-bind/README.md new file mode 100644 index 0000000000000..81862a02cb940 --- /dev/null +++ b/node_modules/function-bind/README.md @@ -0,0 +1,48 @@ +# function-bind + + + + + +Implementation of function.prototype.bind + +## Example + +I mainly do this for unit tests I run on phantomjs. +PhantomJS does not have Function.prototype.bind :( + +```js +Function.prototype.bind = require("function-bind") +``` + +## Installation + +`npm install function-bind` + +## Contributors + + - Raynos + +## MIT Licenced + + [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg + [travis-url]: https://travis-ci.org/Raynos/function-bind + [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg + [npm-url]: https://npmjs.org/package/function-bind + [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png + [6]: https://coveralls.io/r/Raynos/function-bind + [7]: https://gemnasium.com/Raynos/function-bind.png + [8]: https://gemnasium.com/Raynos/function-bind + [deps-svg]: https://david-dm.org/Raynos/function-bind.svg + [deps-url]: https://david-dm.org/Raynos/function-bind + [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg + [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies + [11]: https://ci.testling.com/Raynos/function-bind.png + [12]: https://ci.testling.com/Raynos/function-bind diff --git a/node_modules/function-bind/implementation.js b/node_modules/function-bind/implementation.js new file mode 100644 index 0000000000000..cc4daec1b080a --- /dev/null +++ b/node_modules/function-bind/implementation.js @@ -0,0 +1,52 @@ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var slice = Array.prototype.slice; +var toStr = Object.prototype.toString; +var funcType = '[object Function]'; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + } + }; + + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push('$' + i); + } + + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; diff --git a/node_modules/function-bind/index.js b/node_modules/function-bind/index.js new file mode 100644 index 0000000000000..3bb6b9609889f --- /dev/null +++ b/node_modules/function-bind/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; diff --git a/node_modules/function-bind/package.json b/node_modules/function-bind/package.json new file mode 100644 index 0000000000000..426db8c4d8705 --- /dev/null +++ b/node_modules/function-bind/package.json @@ -0,0 +1,67 @@ +{ + "name": "function-bind", + "version": "1.1.1", + "description": "Implementation of Function.prototype.bind", + "keywords": [ + "function", + "bind", + "shim", + "es5" + ], + "author": "Raynos ", + "repository": "git://github.com/Raynos/function-bind.git", + "main": "index", + "homepage": "https://github.com/Raynos/function-bind", + "contributors": [ + { + "name": "Raynos" + }, + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "bugs": { + "url": "https://github.com/Raynos/function-bind/issues", + "email": "raynos2@gmail.com" + }, + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "eslint": "^4.5.0", + "jscs": "^3.0.7", + "tape": "^4.8.0" + }, + "license": "MIT", + "scripts": { + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npm run coverage -- --quiet", + "tests-only": "node test", + "coverage": "covert test/*.js", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js */*.js", + "eslint": "eslint *.js */*.js" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } + +,"_resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" +,"_integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" +,"_from": "function-bind@1.1.1" +} \ No newline at end of file diff --git a/node_modules/function-bind/test/index.js b/node_modules/function-bind/test/index.js new file mode 100644 index 0000000000000..2edecce2f0fa5 --- /dev/null +++ b/node_modules/function-bind/test/index.js @@ -0,0 +1,252 @@ +// jscs:disable requireUseStrict + +var test = require('tape'); + +var functionBind = require('../implementation'); +var getCurrentContext = function () { return this; }; + +test('functionBind is a function', function (t) { + t.equal(typeof functionBind, 'function'); + t.end(); +}); + +test('non-functions', function (t) { + var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; + t.plan(nonFunctions.length); + for (var i = 0; i < nonFunctions.length; ++i) { + try { functionBind.call(nonFunctions[i]); } catch (ex) { + t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); + } + } + t.end(); +}); + +test('without a context', function (t) { + t.test('binds properly', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }) + }; + namespace.func(1, 2, 3); + st.deepEqual(args, [1, 2, 3]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('binds properly, and still supplies bound arguments', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, undefined, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.deepEqual(args, [1, 2, 3, 4, 5, 6]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('returns properly', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('called as a constructor', function (st) { + var thunkify = function (value) { + return function () { return value; }; + }; + st.test('returns object value', function (sst) { + var expectedReturnValue = [1, 2, 3]; + var Constructor = functionBind.call(thunkify(expectedReturnValue), null); + var result = new Constructor(); + sst.equal(result, expectedReturnValue); + sst.end(); + }); + + st.test('does not return primitive value', function (sst) { + var Constructor = functionBind.call(thunkify(42), null); + var result = new Constructor(); + sst.notEqual(result, 42); + sst.end(); + }); + + st.test('object from bound constructor is instance of original and bound constructor', function (sst) { + var A = function (x) { + this.name = x || 'A'; + }; + var B = functionBind.call(A, null, 'B'); + + var result = new B(); + sst.ok(result instanceof B, 'result is instance of bound constructor'); + sst.ok(result instanceof A, 'result is instance of original constructor'); + sst.end(); + }); + + st.end(); + }); + + t.end(); +}); + +test('with a context', function (t) { + t.test('with no bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext) + }; + namespace.func(1, 2, 3); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); + st.end(); + }); + + t.test('with bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); + st.end(); + }); + + t.test('returns properly', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('passes the correct arguments when called as a constructor', function (st) { + var expected = { name: 'Correct' }; + var namespace = { + Func: functionBind.call(function (arg) { + return arg; + }, { name: 'Incorrect' }) + }; + var returned = new namespace.Func(expected); + st.equal(returned, expected, 'returns the right arg when called as a constructor'); + st.end(); + }); + + t.test('has the new instance\'s context when called as a constructor', function (st) { + var actualContext; + var expectedContext = { foo: 'bar' }; + var namespace = { + Func: functionBind.call(function () { + actualContext = this; + }, expectedContext) + }; + var result = new namespace.Func(); + st.equal(result instanceof namespace.Func, true); + st.notEqual(actualContext, expectedContext); + st.end(); + }); + + t.end(); +}); + +test('bound function length', function (t) { + t.test('sets a correct length without thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); +}); diff --git a/node_modules/has-symbols/.npmignore b/node_modules/has-symbols/.npmignore new file mode 100644 index 0000000000000..5148e527a7e28 --- /dev/null +++ b/node_modules/has-symbols/.npmignore @@ -0,0 +1,37 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history diff --git a/node_modules/has-symbols/.travis.yml b/node_modules/has-symbols/.travis.yml new file mode 100644 index 0000000000000..3b3331a3b488a --- /dev/null +++ b/node_modules/has-symbols/.travis.yml @@ -0,0 +1,113 @@ +language: node_js +node_js: + - "6.6" + - "6.5" + - "6.4" + - "6.3" + - "6.2" + - "6.1" + - "6.0" + - "5.12" + - "5.11" + - "5.10" + - "5.9" + - "5.8" + - "5.7" + - "5.6" + - "5.5" + - "5.4" + - "5.3" + - "5.2" + - "5.1" + - "5.0" + - "4.5" + - "4.4" + - "4.3" + - "4.2" + - "4.1" + - "4.0" + - "iojs-v3.3" + - "iojs-v3.2" + - "iojs-v3.1" + - "iojs-v3.0" + - "iojs-v2.5" + - "iojs-v2.4" + - "iojs-v2.3" + - "iojs-v2.2" + - "iojs-v2.1" + - "iojs-v2.0" + - "iojs-v1.8" + - "iojs-v1.7" + - "iojs-v1.6" + - "iojs-v1.5" + - "iojs-v1.4" + - "iojs-v1.3" + - "iojs-v1.2" + - "iojs-v1.1" + - "iojs-v1.0" + - "0.12" + - "0.11" + - "0.10" + - "0.9" + - "0.8" + - "0.6" + - "0.4" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' +script: + - 'if [ -n "${LINT-}" ]; then npm run lint ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: LINT=true + allow_failures: + - node_js: "6.5" + - node_js: "6.4" + - node_js: "6.3" + - node_js: "6.2" + - node_js: "6.1" + - node_js: "6.0" + - node_js: "5.11" + - node_js: "5.10" + - node_js: "5.9" + - node_js: "5.8" + - node_js: "5.7" + - node_js: "5.6" + - node_js: "5.5" + - node_js: "5.4" + - node_js: "5.3" + - node_js: "5.2" + - node_js: "5.1" + - node_js: "5.0" + - node_js: "4.4" + - node_js: "4.3" + - node_js: "4.2" + - node_js: "4.1" + - node_js: "4.0" + - node_js: "iojs-v3.2" + - node_js: "iojs-v3.1" + - node_js: "iojs-v3.0" + - node_js: "iojs-v2.4" + - node_js: "iojs-v2.3" + - node_js: "iojs-v2.2" + - node_js: "iojs-v2.1" + - node_js: "iojs-v2.0" + - node_js: "iojs-v1.7" + - node_js: "iojs-v1.6" + - node_js: "iojs-v1.5" + - node_js: "iojs-v1.4" + - node_js: "iojs-v1.3" + - node_js: "iojs-v1.2" + - node_js: "iojs-v1.1" + - node_js: "iojs-v1.0" + - node_js: "0.11" + - node_js: "0.9" + - node_js: "0.6" + - node_js: "0.4" diff --git a/node_modules/has-symbols/CHANGELOG.md b/node_modules/has-symbols/CHANGELOG.md new file mode 100644 index 0000000000000..da7f9da7ea207 --- /dev/null +++ b/node_modules/has-symbols/CHANGELOG.md @@ -0,0 +1,3 @@ +1.0.0 / 2016-09-19 +================= + * Initial release. diff --git a/node_modules/has-symbols/LICENSE b/node_modules/has-symbols/LICENSE new file mode 100644 index 0000000000000..df31cbf3c064d --- /dev/null +++ b/node_modules/has-symbols/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Jordan Harband + +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/node_modules/has-symbols/README.md b/node_modules/has-symbols/README.md new file mode 100644 index 0000000000000..b27b31acbc71b --- /dev/null +++ b/node_modules/has-symbols/README.md @@ -0,0 +1,45 @@ +# has-symbols [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Determine if the JS environment has Symbol support. Supports spec, or shams. + +## Example + +```js +var hasSymbols = require('has-symbols'); + +hasSymbols() === true; // if the environment has native Symbol support. Not polyfillable, not forgeable. + +var hasSymbolsKinda = require('has-symbols/shams'); +hasSymbolsKinda() === true; // if the environment has a Symbol sham that mostly follows the spec. +``` + +## Supported Symbol shams + - get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols) + - core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js) + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/has-symbols +[2]: http://versionbadg.es/ljharb/has-symbols.svg +[3]: https://travis-ci.org/ljharb/has-symbols.svg +[4]: https://travis-ci.org/ljharb/has-symbols +[5]: https://david-dm.org/ljharb/has-symbols.svg +[6]: https://david-dm.org/ljharb/has-symbols +[7]: https://david-dm.org/ljharb/has-symbols/dev-status.svg +[8]: https://david-dm.org/ljharb/has-symbols#info=devDependencies +[9]: https://ci.testling.com/ljharb/has-symbols.png +[10]: https://ci.testling.com/ljharb/has-symbols +[11]: https://nodei.co/npm/has-symbols.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/has-symbols.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/has-symbols.svg +[downloads-url]: http://npm-stat.com/charts.html?package=has-symbols diff --git a/node_modules/has-symbols/index.js b/node_modules/has-symbols/index.js new file mode 100644 index 0000000000000..f72159e0ac7dc --- /dev/null +++ b/node_modules/has-symbols/index.js @@ -0,0 +1,13 @@ +'use strict'; + +var origSymbol = global.Symbol; +var hasSymbolSham = require('./shams'); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; diff --git a/node_modules/has-symbols/package.json b/node_modules/has-symbols/package.json new file mode 100644 index 0000000000000..0999461218e0d --- /dev/null +++ b/node_modules/has-symbols/package.json @@ -0,0 +1,82 @@ +{ + "name": "has-symbols", + "version": "1.0.0", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "description": "Determine if the JS environment has Symbol support. Supports spec, or shams.", + "license": "MIT", + "main": "index.js", + "scripts": { + "prepublish": "safe-publish-latest", + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent security", + "tests-only": "npm run --silent test:stock && npm run --silent test:staging && npm run --silent test:shams", + "test:stock": "node test", + "test:staging": "node --harmony --es-staging test", + "test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs", + "test:shams:corejs": "node test/shams/core-js.js", + "test:shams:getownpropertysymbols": "node test/shams/get-own-property-symbols.js", + "lint": "eslint *.js", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/has-symbols.git" + }, + "keywords": [ + "Symbol", + "symbols", + "typeof", + "sham", + "polyfill", + "native", + "core-js", + "ES6" + ], + "dependencies": {}, + "devDependencies": { + "tape": "^4.6.0", + "nsp": "^2.6.1", + "safe-publish-latest": "^1.0.1", + "eslint": "^3.5.0", + "@ljharb/eslint-config": "^8.0.0", + "get-own-property-symbols": "^0.9.2", + "core-js": "^2.4.1" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz" +,"_integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" +,"_from": "has-symbols@1.0.0" +} \ No newline at end of file diff --git a/node_modules/has-symbols/shams.js b/node_modules/has-symbols/shams.js new file mode 100644 index 0000000000000..f6c1ff4a23637 --- /dev/null +++ b/node_modules/has-symbols/shams.js @@ -0,0 +1,42 @@ +'use strict'; + +/* eslint complexity: [2, 17], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; diff --git a/node_modules/has-symbols/test/index.js b/node_modules/has-symbols/test/index.js new file mode 100644 index 0000000000000..fc32aff94cbb2 --- /dev/null +++ b/node_modules/has-symbols/test/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var test = require('tape'); +var hasSymbols = require('../'); +var runSymbolTests = require('./tests'); + +test('interface', function (t) { + t.equal(typeof hasSymbols, 'function', 'is a function'); + t.equal(typeof hasSymbols(), 'boolean', 'returns a boolean'); + t.end(); +}); + +test('Symbols are supported', { skip: !hasSymbols() }, function (t) { + runSymbolTests(t); + t.end(); +}); + +test('Symbols are not supported', { skip: hasSymbols() }, function (t) { + t.equal(typeof Symbol, 'undefined', 'global Symbol is undefined'); + t.equal(typeof Object.getOwnPropertySymbols, 'undefined', 'Object.getOwnPropertySymbols does not exist'); + t.end(); +}); diff --git a/node_modules/has-symbols/test/shams/core-js.js b/node_modules/has-symbols/test/shams/core-js.js new file mode 100644 index 0000000000000..df5365c23ed74 --- /dev/null +++ b/node_modules/has-symbols/test/shams/core-js.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbols = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling'); + require('core-js/fn/symbol'); + require('core-js/fn/symbol/to-string-tag'); + + require('../tests')(t); + + var hasSymbolsAfter = hasSymbols(); + t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/node_modules/has-symbols/test/shams/get-own-property-symbols.js b/node_modules/has-symbols/test/shams/get-own-property-symbols.js new file mode 100644 index 0000000000000..9191b248baa14 --- /dev/null +++ b/node_modules/has-symbols/test/shams/get-own-property-symbols.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbols = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling'); + + require('get-own-property-symbols'); + + require('../tests')(t); + + var hasSymbolsAfter = hasSymbols(); + t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/node_modules/has-symbols/test/tests.js b/node_modules/has-symbols/test/tests.js new file mode 100644 index 0000000000000..93ff0eae90f03 --- /dev/null +++ b/node_modules/has-symbols/test/tests.js @@ -0,0 +1,54 @@ +'use strict'; + +module.exports = function runSymbolTests(t) { + t.equal(typeof Symbol, 'function', 'global Symbol is a function'); + + if (typeof Symbol !== 'function') { return false }; + + t.notEqual(Symbol(), Symbol(), 'two symbols are not equal'); + + /* + t.equal( + Symbol.prototype.toString.call(Symbol('foo')), + Symbol.prototype.toString.call(Symbol('foo')), + 'two symbols with the same description stringify the same' + ); + */ + + var foo = Symbol('foo'); + + /* + t.notEqual( + String(foo), + String(Symbol('bar')), + 'two symbols with different descriptions do not stringify the same' + ); + */ + + t.equal(typeof Symbol.prototype.toString, 'function', 'Symbol#toString is a function'); + // t.equal(String(foo), Symbol.prototype.toString.call(foo), 'Symbol#toString equals String of the same symbol'); + + t.equal(typeof Object.getOwnPropertySymbols, 'function', 'Object.getOwnPropertySymbols is a function'); + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + t.notEqual(typeof sym, 'string', 'Symbol is not a string'); + t.equal(Object.prototype.toString.call(sym), '[object Symbol]', 'symbol primitive Object#toStrings properly'); + t.equal(Object.prototype.toString.call(symObj), '[object Symbol]', 'symbol primitive Object#toStrings properly'); + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { t.fail('symbol property key was found in for..in of object'); } + + t.deepEqual(Object.keys(obj), [], 'no enumerable own keys on symbol-valued object'); + t.deepEqual(Object.getOwnPropertyNames(obj), [], 'no own names on symbol-valued object'); + t.deepEqual(Object.getOwnPropertySymbols(obj), [sym], 'one own symbol on symbol-valued object'); + t.equal(Object.prototype.propertyIsEnumerable.call(obj, sym), true, 'symbol is enumerable'); + t.deepEqual(Object.getOwnPropertyDescriptor(obj, sym), { + configurable: true, + enumerable: true, + value: 42, + writable: true + }, 'property descriptor is correct'); +}; diff --git a/node_modules/has/LICENSE-MIT b/node_modules/has/LICENSE-MIT new file mode 100644 index 0000000000000..ae7014d385df3 --- /dev/null +++ b/node_modules/has/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2013 Thiago de Arruda + +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/node_modules/has/README.md b/node_modules/has/README.md new file mode 100644 index 0000000000000..635e3a4baab00 --- /dev/null +++ b/node_modules/has/README.md @@ -0,0 +1,18 @@ +# has + +> Object.prototype.hasOwnProperty.call shortcut + +## Installation + +```sh +npm install --save has +``` + +## Usage + +```js +var has = require('has'); + +has({}, 'hasOwnProperty'); // false +has(Object.prototype, 'hasOwnProperty'); // true +``` diff --git a/node_modules/has/package.json b/node_modules/has/package.json new file mode 100644 index 0000000000000..86203ce165966 --- /dev/null +++ b/node_modules/has/package.json @@ -0,0 +1,52 @@ +{ + "name": "has", + "description": "Object.prototype.hasOwnProperty.call shortcut", + "version": "1.0.3", + "homepage": "https://github.com/tarruda/has", + "author": { + "name": "Thiago de Arruda", + "email": "tpadilha84@gmail.com" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/tarruda/has.git" + }, + "bugs": { + "url": "https://github.com/tarruda/has/issues" + }, + "license": "MIT", + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" + } + ], + "main": "./src", + "dependencies": { + "function-bind": "^1.1.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "eslint": "^4.19.1", + "tape": "^4.9.0" + }, + "engines": { + "node": ">= 0.4.0" + }, + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "tape test" + } + +,"_resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz" +,"_integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==" +,"_from": "has@1.0.3" +} \ No newline at end of file diff --git a/node_modules/has/src/index.js b/node_modules/has/src/index.js new file mode 100644 index 0000000000000..dd92dd9094edb --- /dev/null +++ b/node_modules/has/src/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var bind = require('function-bind'); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/node_modules/has/test/index.js b/node_modules/has/test/index.js new file mode 100644 index 0000000000000..43d480b2c2e76 --- /dev/null +++ b/node_modules/has/test/index.js @@ -0,0 +1,10 @@ +'use strict'; + +var test = require('tape'); +var has = require('../'); + +test('has', function (t) { + t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"'); + t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"'); + t.end(); +}); diff --git a/node_modules/is-callable/.editorconfig b/node_modules/is-callable/.editorconfig new file mode 100644 index 0000000000000..bc228f8269443 --- /dev/null +++ b/node_modules/is-callable/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/is-callable/.istanbul.yml b/node_modules/is-callable/.istanbul.yml new file mode 100644 index 0000000000000..9affe0bc3e67a --- /dev/null +++ b/node_modules/is-callable/.istanbul.yml @@ -0,0 +1,47 @@ +verbose: false +instrumentation: + root: . + extensions: + - .js + - .jsx + default-excludes: true + excludes: [] + variable: __coverage__ + compact: true + preserve-comments: false + complete-copy: false + save-baseline: false + baseline-file: ./coverage/coverage-baseline.raw.json + include-all-sources: false + include-pid: false + es-modules: false + auto-wrap: false +reporting: + print: summary + reports: + - html + dir: ./coverage + summarizer: pkg + report-config: {} + watermarks: + statements: [50, 80] + functions: [50, 80] + branches: [50, 80] + lines: [50, 80] +hooks: + hook-run-in-context: false + post-require-hook: null + handle-sigint: false +check: + global: + statements: 100 + lines: 100 + branches: 100 + functions: 100 + excludes: [] + each: + statements: 100 + lines: 100 + branches: 100 + functions: 100 + excludes: [] diff --git a/node_modules/is-callable/.jscs.json b/node_modules/is-callable/.jscs.json new file mode 100644 index 0000000000000..b4d9b8b40aebf --- /dev/null +++ b/node_modules/is-callable/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 1 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/is-callable/.travis.yml b/node_modules/is-callable/.travis.yml new file mode 100644 index 0000000000000..767256c8dd484 --- /dev/null +++ b/node_modules/is-callable/.travis.yml @@ -0,0 +1,225 @@ +language: node_js +os: + - linux +node_js: + - "10.4" + - "9.11" + - "8.11" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - env: COVERAGE=true diff --git a/node_modules/is-callable/CHANGELOG.md b/node_modules/is-callable/CHANGELOG.md new file mode 100644 index 0000000000000..58286a0535b74 --- /dev/null +++ b/node_modules/is-callable/CHANGELOG.md @@ -0,0 +1,56 @@ +1.1.4 / 2018-07-02 +================= + * [Fix] improve `class` and arrow function detection (#30, #31) + * [Tests] on all latest node minors; improve matrix + * [Dev Deps] update all dev deps + +1.1.3 / 2016-02-27 +================= + * [Fix] ensure “class “ doesn’t screw up “class” detection + * [Tests] up to `node` `v5.7`, `v4.3` + * [Dev Deps] update to `eslint` v2, `@ljharb/eslint-config`, `jscs` + +1.1.2 / 2016-01-15 +================= + * [Fix] Make sure comments don’t screw up “class” detection (#4) + * [Tests] up to `node` `v5.3` + * [Tests] Add `parallelshell`, run both `--es-staging` and stock tests at once + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` + * [Refactor] convert `isNonES6ClassFn` into `isES6ClassFn` + +1.1.1 / 2015-11-30 +================= + * [Fix] do not throw when a non-function has a function in its [[Prototype]] (#2) + * [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `jscs`, `nsp`, `semver` + * [Tests] up to `node` `v5.1` + * [Tests] no longer allow node 0.8 to fail. + * [Tests] fix npm upgrades in older nodes + +1.1.0 / 2015-10-02 +================= + * [Fix] Some browsers report TypedArray constructors as `typeof object` + * [New] return false for "class" constructors, when possible. + * [Tests] up to `io.js` `v3.3`, `node` `v4.1` + * [Dev Deps] update `eslint`, `editorconfig-tools`, `nsp`, `tape`, `semver`, `jscs`, `covert`, `make-arrow-function` + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + +1.0.4 / 2015-01-30 +================= + * If @@toStringTag is not present, use the old-school Object#toString test. + +1.0.3 / 2015-01-29 +================= + * Add tests to ensure arrow functions are callable. + * Refactor to aid optimization of non-try/catch code. + +1.0.2 / 2015-01-29 +================= + * Fix broken package.json + +1.0.1 / 2015-01-29 +================= + * Add early exit for typeof not "function" + +1.0.0 / 2015-01-29 +================= + * Initial release. diff --git a/node_modules/is-callable/LICENSE b/node_modules/is-callable/LICENSE new file mode 100644 index 0000000000000..b43df444e5182 --- /dev/null +++ b/node_modules/is-callable/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/node_modules/is-callable/Makefile b/node_modules/is-callable/Makefile new file mode 100644 index 0000000000000..b9e4fe1aab3dd --- /dev/null +++ b/node_modules/is-callable/Makefile @@ -0,0 +1,61 @@ +# Since we rely on paths relative to the makefile location, abort if make isn't being run from there. +$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) + + # The files that need updating when incrementing the version number. +VERSIONED_FILES := *.js *.json README* + + +# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. +# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment +# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. +export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") +UTILS := semver +# Make sure that all required utilities can be located. +UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) + +# Default target (by virtue of being the first non '.'-prefixed in the file). +.PHONY: _no-target-specified +_no-target-specified: + $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) + +# Lists all targets defined in this makefile. +.PHONY: list +list: + @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort + +# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). +.PHONY: test +test: + @npm test + +.PHONY: _ensure-tag +_ensure-tag: +ifndef TAG + $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) +endif + +CHANGELOG_ERROR = $(error No CHANGELOG specified) +.PHONY: _ensure-changelog +_ensure-changelog: + @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) + +# Ensures that the git workspace is clean. +.PHONY: _ensure-clean +_ensure-clean: + @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } + +# Makes a release; invoke with `make TAG= release`. +.PHONY: release +release: _ensure-tag _ensure-changelog _ensure-clean + @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ + new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ + if printf "$$new_ver" | command grep -q '^[0-9]'; then \ + semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ + semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ + else \ + new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ + fi; \ + printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ + replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ + git tag -a -m "v$$new_ver" "v$$new_ver" diff --git a/node_modules/is-callable/README.md b/node_modules/is-callable/README.md new file mode 100644 index 0000000000000..0cb65879972bf --- /dev/null +++ b/node_modules/is-callable/README.md @@ -0,0 +1,59 @@ +# is-callable [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +[![browser support][9]][10] + +Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag. + +## Example + +```js +var isCallable = require('is-callable'); +var assert = require('assert'); + +assert.notOk(isCallable(undefined)); +assert.notOk(isCallable(null)); +assert.notOk(isCallable(false)); +assert.notOk(isCallable(true)); +assert.notOk(isCallable([])); +assert.notOk(isCallable({})); +assert.notOk(isCallable(/a/g)); +assert.notOk(isCallable(new RegExp('a', 'g'))); +assert.notOk(isCallable(new Date())); +assert.notOk(isCallable(42)); +assert.notOk(isCallable(NaN)); +assert.notOk(isCallable(Infinity)); +assert.notOk(isCallable(new Number(42))); +assert.notOk(isCallable('foo')); +assert.notOk(isCallable(Object('foo'))); + +assert.ok(isCallable(function () {})); +assert.ok(isCallable(function* () {})); +assert.ok(isCallable(x => x * x)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-callable +[2]: http://versionbadg.es/ljharb/is-callable.svg +[3]: https://travis-ci.org/ljharb/is-callable.svg +[4]: https://travis-ci.org/ljharb/is-callable +[5]: https://david-dm.org/ljharb/is-callable.svg +[6]: https://david-dm.org/ljharb/is-callable +[7]: https://david-dm.org/ljharb/is-callable/dev-status.svg +[8]: https://david-dm.org/ljharb/is-callable#info=devDependencies +[9]: https://ci.testling.com/ljharb/is-callable.png +[10]: https://ci.testling.com/ljharb/is-callable +[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/is-callable.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/is-callable.svg +[downloads-url]: http://npm-stat.com/charts.html?package=is-callable diff --git a/node_modules/is-callable/index.js b/node_modules/is-callable/index.js new file mode 100644 index 0000000000000..d9820b51fd4ad --- /dev/null +++ b/node_modules/is-callable/index.js @@ -0,0 +1,37 @@ +'use strict'; + +var fnToStr = Function.prototype.toString; + +var constructorRegex = /^\s*class\b/; +var isES6ClassFn = function isES6ClassFunction(value) { + try { + var fnStr = fnToStr.call(value); + return constructorRegex.test(fnStr); + } catch (e) { + return false; // not a function + } +}; + +var tryFunctionObject = function tryFunctionToStr(value) { + try { + if (isES6ClassFn(value)) { return false; } + fnToStr.call(value); + return true; + } catch (e) { + return false; + } +}; +var toStr = Object.prototype.toString; +var fnClass = '[object Function]'; +var genClass = '[object GeneratorFunction]'; +var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; + +module.exports = function isCallable(value) { + if (!value) { return false; } + if (typeof value !== 'function' && typeof value !== 'object') { return false; } + if (typeof value === 'function' && !value.prototype) { return true; } + if (hasToStringTag) { return tryFunctionObject(value); } + if (isES6ClassFn(value)) { return false; } + var strClass = toStr.call(value); + return strClass === fnClass || strClass === genClass; +}; diff --git a/node_modules/is-callable/package.json b/node_modules/is-callable/package.json new file mode 100644 index 0000000000000..50531dfc90165 --- /dev/null +++ b/node_modules/is-callable/package.json @@ -0,0 +1,98 @@ +{ + "name": "is-callable", + "version": "1.1.4", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "description": "Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent security", + "tests-only": "npm run --silent test:stock && npm run --silent test:staging", + "test:stock": "node test.js", + "test:staging": "node --es-staging test.js", + "coverage": "npm run --silent istanbul", + "covert": "covert test.js", + "covert:quiet": "covert test.js --quiet", + "istanbul": "npm run --silent istanbul:clean && npm run --silent istanbul:std && npm run --silent istanbul:harmony && npm run --silent istanbul:merge && istanbul check", + "istanbul:clean": "rimraf coverage coverage-std coverage-harmony", + "istanbul:merge": "istanbul-merge --out coverage/coverage.raw.json coverage-harmony/coverage.raw.json coverage-std/coverage.raw.json && istanbul report html", + "istanbul:harmony": "node --harmony ./node_modules/istanbul/lib/cli.js cover test.js --dir coverage-harmony", + "istanbul:std": "istanbul cover test.js --report html --dir coverage-std", + "prelint": "editorconfig-tools check *", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js", + "eslint": "eslint *.js", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/is-callable.git" + }, + "keywords": [ + "Function", + "function", + "callable", + "generator", + "generator function", + "arrow", + "arrow function", + "ES6", + "toStringTag", + "@@toStringTag" + ], + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "editorconfig-tools": "^0.1.1", + "eslint": "^4.19.1", + "foreach": "^2.0.5", + "istanbul": "1.1.0-alpha.1", + "istanbul-merge": "^1.1.1", + "jscs": "^3.0.7", + "make-arrow-function": "^1.1.0", + "make-generator-function": "^1.1.0", + "nsp": "^3.2.1", + "rimraf": "^2.6.2", + "semver": "^5.5.0", + "tape": "^4.9.1" + }, + "testling": { + "files": "test.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz" +,"_integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" +,"_from": "is-callable@1.1.4" +} \ No newline at end of file diff --git a/node_modules/is-callable/test.js b/node_modules/is-callable/test.js new file mode 100644 index 0000000000000..f5be51d82e212 --- /dev/null +++ b/node_modules/is-callable/test.js @@ -0,0 +1,158 @@ +'use strict'; + +/* eslint no-magic-numbers: 1 */ + +var test = require('tape'); +var isCallable = require('./'); +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; +var genFn = require('make-generator-function'); +var arrowFn = require('make-arrow-function')(); +var weirdlyCommentedArrowFn; +var asyncFn; +var asyncArrowFn; +try { + /* eslint no-new-func: 0 */ + weirdlyCommentedArrowFn = Function('return cl/*/**/=>/**/ass - 1;')(); + asyncFn = Function('return async function foo() {};')(); + asyncArrowFn = Function('return async () => {};')(); +} catch (e) { /**/ } +var forEach = require('foreach'); + +var noop = function () {}; +var classFake = function classFake() { }; // eslint-disable-line func-name-matching +var returnClass = function () { return ' class '; }; +var return3 = function () { return 3; }; +/* for coverage */ +noop(); +classFake(); +returnClass(); +return3(); +/* end for coverage */ + +var invokeFunction = function invokeFunctionString(str) { + var result; + try { + /* eslint-disable no-new-func */ + var fn = Function(str); + /* eslint-enable no-new-func */ + result = fn(); + } catch (e) {} + return result; +}; + +var classConstructor = invokeFunction('"use strict"; return class Foo {}'); + +var commentedClass = invokeFunction('"use strict"; return class/*kkk*/\n//blah\n Bar\n//blah\n {}'); +var commentedClassOneLine = invokeFunction('"use strict"; return class/**/A{}'); +var classAnonymous = invokeFunction('"use strict"; return class{}'); +var classAnonymousCommentedOneLine = invokeFunction('"use strict"; return class/*/*/{}'); + +test('not callables', function (t) { + t.test('non-number/string primitives', function (st) { + st.notOk(isCallable(), 'undefined is not callable'); + st.notOk(isCallable(null), 'null is not callable'); + st.notOk(isCallable(false), 'false is not callable'); + st.notOk(isCallable(true), 'true is not callable'); + st.end(); + }); + + t.notOk(isCallable([]), 'array is not callable'); + t.notOk(isCallable({}), 'object is not callable'); + t.notOk(isCallable(/a/g), 'regex literal is not callable'); + t.notOk(isCallable(new RegExp('a', 'g')), 'regex object is not callable'); + t.notOk(isCallable(new Date()), 'new Date() is not callable'); + + t.test('numbers', function (st) { + st.notOk(isCallable(42), 'number is not callable'); + st.notOk(isCallable(Object(42)), 'number object is not callable'); + st.notOk(isCallable(NaN), 'NaN is not callable'); + st.notOk(isCallable(Infinity), 'Infinity is not callable'); + st.end(); + }); + + t.test('strings', function (st) { + st.notOk(isCallable('foo'), 'string primitive is not callable'); + st.notOk(isCallable(Object('foo')), 'string object is not callable'); + st.end(); + }); + + t.test('non-function with function in its [[Prototype]] chain', function (st) { + var Foo = function Bar() {}; + Foo.prototype = noop; + st.equal(true, isCallable(Foo), 'sanity check: Foo is callable'); + st.equal(false, isCallable(new Foo()), 'instance of Foo is not callable'); + st.end(); + }); + + t.end(); +}); + +test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { + var fakeFunction = { + toString: function () { return String(return3); }, + valueOf: return3 + }; + fakeFunction[Symbol.toStringTag] = 'Function'; + t.equal(String(fakeFunction), String(return3)); + t.equal(Number(fakeFunction), return3()); + t.notOk(isCallable(fakeFunction), 'fake Function with @@toStringTag "Function" is not callable'); + t.end(); +}); + +var typedArrayNames = [ + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array' +]; + +test('Functions', function (t) { + t.ok(isCallable(noop), 'function is callable'); + t.ok(isCallable(classFake), 'function with name containing "class" is callable'); + t.ok(isCallable(returnClass), 'function with string " class " is callable'); + t.ok(isCallable(isCallable), 'isCallable is callable'); + t.end(); +}); + +test('Typed Arrays', function (st) { + forEach(typedArrayNames, function (typedArray) { + /* istanbul ignore if : covered in node 0.6 */ + if (typeof global[typedArray] === 'undefined') { + st.comment('# SKIP typed array "' + typedArray + '" not supported'); + } else { + st.ok(isCallable(global[typedArray]), typedArray + ' is callable'); + } + }); + st.end(); +}); + +test('Generators', { skip: !genFn }, function (t) { + t.ok(isCallable(genFn), 'generator function is callable'); + t.end(); +}); + +test('Arrow functions', { skip: !arrowFn }, function (t) { + t.ok(isCallable(arrowFn), 'arrow function is callable'); + t.ok(isCallable(weirdlyCommentedArrowFn), 'weirdly commented arrow functions are callable'); + t.end(); +}); + +test('"Class" constructors', { skip: !classConstructor || !commentedClass || !commentedClassOneLine || !classAnonymous }, function (t) { + t.notOk(isCallable(classConstructor), 'class constructors are not callable'); + t.notOk(isCallable(commentedClass), 'class constructors with comments in the signature are not callable'); + t.notOk(isCallable(commentedClassOneLine), 'one-line class constructors with comments in the signature are not callable'); + t.notOk(isCallable(classAnonymous), 'anonymous class constructors are not callable'); + t.notOk(isCallable(classAnonymousCommentedOneLine), 'anonymous one-line class constructors with comments in the signature are not callable'); + t.end(); +}); + +test('`async function`s', { skip: !asyncFn }, function (t) { + t.ok(isCallable(asyncFn), '`async function`s are callable'); + t.ok(isCallable(asyncArrowFn), '`async` arrow functions are callable'); + t.end(); +}); diff --git a/node_modules/is-date-object/.jscs.json b/node_modules/is-date-object/.jscs.json new file mode 100644 index 0000000000000..040bb6806a566 --- /dev/null +++ b/node_modules/is-date-object/.jscs.json @@ -0,0 +1,122 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": "allButReserved", + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": true, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 1 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "validateOrderInObjectKeys": "asc-insensitive" +} + diff --git a/node_modules/is-date-object/.npmignore b/node_modules/is-date-object/.npmignore new file mode 100644 index 0000000000000..59d842baa84c8 --- /dev/null +++ b/node_modules/is-date-object/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/node_modules/is-date-object/.travis.yml b/node_modules/is-date-object/.travis.yml new file mode 100644 index 0000000000000..4c29ed58ba7fb --- /dev/null +++ b/node_modules/is-date-object/.travis.yml @@ -0,0 +1,58 @@ +language: node_js +node_js: + - "4.1" + - "4.0" + - "iojs-v3.3" + - "iojs-v3.2" + - "iojs-v3.1" + - "iojs-v3.0" + - "iojs-v2.5" + - "iojs-v2.4" + - "iojs-v2.3" + - "iojs-v2.2" + - "iojs-v2.1" + - "iojs-v2.0" + - "iojs-v1.8" + - "iojs-v1.7" + - "iojs-v1.6" + - "iojs-v1.5" + - "iojs-v1.4" + - "iojs-v1.3" + - "iojs-v1.2" + - "iojs-v1.1" + - "iojs-v1.0" + - "0.12" + - "0.11" + - "0.10" + - "0.9" + - "0.8" + - "0.6" + - "0.4" +before_install: + - '[ "${TRAVIS_NODE_VERSION}" = "0.6" ] || npm install -g npm@1.4.28 && npm install -g npm' +sudo: false +matrix: + fast_finish: true + allow_failures: + - node_js: "4.0" + - node_js: "iojs-v3.2" + - node_js: "iojs-v3.1" + - node_js: "iojs-v3.0" + - node_js: "iojs-v2.4" + - node_js: "iojs-v2.3" + - node_js: "iojs-v2.2" + - node_js: "iojs-v2.1" + - node_js: "iojs-v2.0" + - node_js: "iojs-v1.7" + - node_js: "iojs-v1.6" + - node_js: "iojs-v1.5" + - node_js: "iojs-v1.4" + - node_js: "iojs-v1.3" + - node_js: "iojs-v1.2" + - node_js: "iojs-v1.1" + - node_js: "iojs-v1.0" + - node_js: "0.11" + - node_js: "0.9" + - node_js: "0.8" + - node_js: "0.6" + - node_js: "0.4" diff --git a/node_modules/is-date-object/CHANGELOG.md b/node_modules/is-date-object/CHANGELOG.md new file mode 100644 index 0000000000000..4a7eab61bb1b2 --- /dev/null +++ b/node_modules/is-date-object/CHANGELOG.md @@ -0,0 +1,10 @@ +1.0.1 / 2015-09-27 +================= + * [Fix] If `@@toStringTag` is not present, use the old-school `Object#toString` test + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Dev Deps] update `is`, `eslint`, `@ljharb/eslint-config`, `semver`, `tape`, `jscs`, `nsp`, `covert` + * [Tests] up to `io.js` `v3.3`, `node` `v4.1` + +1.0.0 / 2015-01-28 +================= + * Initial release. diff --git a/node_modules/is-date-object/LICENSE b/node_modules/is-date-object/LICENSE new file mode 100644 index 0000000000000..b43df444e5182 --- /dev/null +++ b/node_modules/is-date-object/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/node_modules/is-date-object/Makefile b/node_modules/is-date-object/Makefile new file mode 100644 index 0000000000000..b9e4fe1aab3dd --- /dev/null +++ b/node_modules/is-date-object/Makefile @@ -0,0 +1,61 @@ +# Since we rely on paths relative to the makefile location, abort if make isn't being run from there. +$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) + + # The files that need updating when incrementing the version number. +VERSIONED_FILES := *.js *.json README* + + +# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. +# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment +# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. +export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") +UTILS := semver +# Make sure that all required utilities can be located. +UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) + +# Default target (by virtue of being the first non '.'-prefixed in the file). +.PHONY: _no-target-specified +_no-target-specified: + $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) + +# Lists all targets defined in this makefile. +.PHONY: list +list: + @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort + +# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). +.PHONY: test +test: + @npm test + +.PHONY: _ensure-tag +_ensure-tag: +ifndef TAG + $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) +endif + +CHANGELOG_ERROR = $(error No CHANGELOG specified) +.PHONY: _ensure-changelog +_ensure-changelog: + @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) + +# Ensures that the git workspace is clean. +.PHONY: _ensure-clean +_ensure-clean: + @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } + +# Makes a release; invoke with `make TAG= release`. +.PHONY: release +release: _ensure-tag _ensure-changelog _ensure-clean + @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ + new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ + if printf "$$new_ver" | command grep -q '^[0-9]'; then \ + semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ + semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ + else \ + new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ + fi; \ + printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ + replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ + git tag -a -m "v$$new_ver" "v$$new_ver" diff --git a/node_modules/is-date-object/README.md b/node_modules/is-date-object/README.md new file mode 100644 index 0000000000000..55b0c59673e60 --- /dev/null +++ b/node_modules/is-date-object/README.md @@ -0,0 +1,53 @@ +# is-date-object [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +[![browser support][9]][10] + +Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isDate = require('is-date-object'); +var assert = require('assert'); + +assert.notOk(isDate(undefined)); +assert.notOk(isDate(null)); +assert.notOk(isDate(false)); +assert.notOk(isDate(true)); +assert.notOk(isDate(42)); +assert.notOk(isDate('foo')); +assert.notOk(isDate(function () {})); +assert.notOk(isDate([])); +assert.notOk(isDate({})); +assert.notOk(isDate(/a/g)); +assert.notOk(isDate(new RegExp('a', 'g'))); + +assert.ok(isDate(new Date())); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-date-object +[2]: http://versionbadg.es/ljharb/is-date-object.svg +[3]: https://travis-ci.org/ljharb/is-date-object.svg +[4]: https://travis-ci.org/ljharb/is-date-object +[5]: https://david-dm.org/ljharb/is-date-object.svg +[6]: https://david-dm.org/ljharb/is-date-object +[7]: https://david-dm.org/ljharb/is-date-object/dev-status.svg +[8]: https://david-dm.org/ljharb/is-date-object#info=devDependencies +[9]: https://ci.testling.com/ljharb/is-date-object.png +[10]: https://ci.testling.com/ljharb/is-date-object +[11]: https://nodei.co/npm/is-date-object.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/is-date-object.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/is-date-object.svg +[downloads-url]: http://npm-stat.com/charts.html?package=is-date-object diff --git a/node_modules/is-date-object/index.js b/node_modules/is-date-object/index.js new file mode 100644 index 0000000000000..fe0d7ecd7c145 --- /dev/null +++ b/node_modules/is-date-object/index.js @@ -0,0 +1,20 @@ +'use strict'; + +var getDay = Date.prototype.getDay; +var tryDateObject = function tryDateObject(value) { + try { + getDay.call(value); + return true; + } catch (e) { + return false; + } +}; + +var toStr = Object.prototype.toString; +var dateClass = '[object Date]'; +var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; + +module.exports = function isDateObject(value) { + if (typeof value !== 'object' || value === null) { return false; } + return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass; +}; diff --git a/node_modules/is-date-object/package.json b/node_modules/is-date-object/package.json new file mode 100644 index 0000000000000..20c0b95086f58 --- /dev/null +++ b/node_modules/is-date-object/package.json @@ -0,0 +1,66 @@ +{ + "name": "is-date-object", + "version": "1.0.1", + "author": "Jordan Harband", + "description": "Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "npm run lint && node --harmony --es-staging test.js && npm run security", + "coverage": "covert test.js", + "coverage-quiet": "covert test.js --quiet", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs test.js *.js", + "eslint": "eslint test.js *.js", + "security": "nsp package" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/is-date-object.git" + }, + "keywords": [ + "Date", + "ES6", + "toStringTag", + "@@toStringTag", + "Date object" + ], + "dependencies": {}, + "devDependencies": { + "foreach": "^2.0.5", + "is": "^3.1.0", + "tape": "^4.2.0", + "indexof": "^0.0.1", + "covert": "^1.1.0", + "jscs": "^2.1.1", + "nsp": "^1.1.0", + "eslint": "^1.5.1", + "@ljharb/eslint-config": "^1.2.0", + "semver": "^5.0.3" + }, + "testling": { + "files": "test.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz" +,"_integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" +,"_from": "is-date-object@1.0.1" +} \ No newline at end of file diff --git a/node_modules/is-date-object/test.js b/node_modules/is-date-object/test.js new file mode 100644 index 0000000000000..29f0917bc4a33 --- /dev/null +++ b/node_modules/is-date-object/test.js @@ -0,0 +1,33 @@ +'use strict'; + +var test = require('tape'); +var isDate = require('./'); +var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; + +test('not Dates', function (t) { + t.notOk(isDate(), 'undefined is not Date'); + t.notOk(isDate(null), 'null is not Date'); + t.notOk(isDate(false), 'false is not Date'); + t.notOk(isDate(true), 'true is not Date'); + t.notOk(isDate(42), 'number is not Date'); + t.notOk(isDate('foo'), 'string is not Date'); + t.notOk(isDate([]), 'array is not Date'); + t.notOk(isDate({}), 'object is not Date'); + t.notOk(isDate(function () {}), 'function is not Date'); + t.notOk(isDate(/a/g), 'regex literal is not Date'); + t.notOk(isDate(new RegExp('a', 'g')), 'regex object is not Date'); + t.end(); +}); + +test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { + var realDate = new Date(); + var fakeDate = { toString: function () { return String(realDate); }, valueOf: function () { return realDate.getTime(); } }; + fakeDate[Symbol.toStringTag] = 'Date'; + t.notOk(isDate(fakeDate), 'fake Date with @@toStringTag "Date" is not Date'); + t.end(); +}); + +test('Dates', function (t) { + t.ok(isDate(new Date()), 'new Date() is Date'); + t.end(); +}); diff --git a/node_modules/is-regex/.jscs.json b/node_modules/is-regex/.jscs.json new file mode 100644 index 0000000000000..3d099c4b1192c --- /dev/null +++ b/node_modules/is-regex/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 1 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/is-regex/.npmignore b/node_modules/is-regex/.npmignore new file mode 100644 index 0000000000000..a72b52ebe8977 --- /dev/null +++ b/node_modules/is-regex/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/node_modules/is-regex/.travis.yml b/node_modules/is-regex/.travis.yml new file mode 100644 index 0000000000000..41137a89a5919 --- /dev/null +++ b/node_modules/is-regex/.travis.yml @@ -0,0 +1,165 @@ +language: node_js +os: + - linux +node_js: + - "7.5" + - "6.9" + - "5.12" + - "4.7" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: PRETEST=true + - node_js: "node" + env: POSTTEST=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7" + env: TEST=true + os: osx + - node_js: "6" + env: TEST=true + os: osx + - node_js: "5" + env: TEST=true + os: osx + - node_js: "4" + env: TEST=true + os: osx + - node_js: "iojs" + env: TEST=true + os: osx + - node_js: "0.12" + env: TEST=true + os: osx + - node_js: "0.10" + env: TEST=true + os: osx + - node_js: "0.8" + env: TEST=true + os: osx + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/is-regex/CHANGELOG.md b/node_modules/is-regex/CHANGELOG.md new file mode 100644 index 0000000000000..6d73800022da3 --- /dev/null +++ b/node_modules/is-regex/CHANGELOG.md @@ -0,0 +1,27 @@ +1.0.4 / 2016-02-18 +================= + * [Fix] ensure that `lastIndex` is not mutated (#3) + * [Refactor] when try/catch is needed, bail early if the value lacks an own `lastIndex` data property + * [Refactor] use an early return instead of a ternary + * [Refactor] bail earlier when the value is falsy + * Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Dev Deps] update `tape`, `jscs`, `editorconfig-tools`, `eslint`, `semver`, `replace`, `nsp`, `covert`, `@ljharb/eslint-config` + * [Tests] on all the node and io.js versions; improve test matri + * [Tests] Fix tests for faked @@toStringTag + +1.0.3 / 2015-01-29 +================= + * If @@toStringTag is not present, use the old-school Object#toString test. + +1.0.2 / 2015-01-29 +================= + * Improve optimization by separating the try/catch, and bailing out early when not typeof "object". + +1.0.1 / 2015-01-28 +================= + * Update `jscs`, `tape`, `covert` + * Use RegExp#exec to test if something is a regex, which works even with ES6 @@toStringTag. + +1.0.0 / 2014-05-19 +================= + * Initial release. diff --git a/node_modules/is-regex/LICENSE b/node_modules/is-regex/LICENSE new file mode 100644 index 0000000000000..47b7b5078fce3 --- /dev/null +++ b/node_modules/is-regex/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jordan Harband + +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/node_modules/is-regex/Makefile b/node_modules/is-regex/Makefile new file mode 100644 index 0000000000000..b9e4fe1aab3dd --- /dev/null +++ b/node_modules/is-regex/Makefile @@ -0,0 +1,61 @@ +# Since we rely on paths relative to the makefile location, abort if make isn't being run from there. +$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) + + # The files that need updating when incrementing the version number. +VERSIONED_FILES := *.js *.json README* + + +# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. +# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment +# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. +export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") +UTILS := semver +# Make sure that all required utilities can be located. +UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) + +# Default target (by virtue of being the first non '.'-prefixed in the file). +.PHONY: _no-target-specified +_no-target-specified: + $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) + +# Lists all targets defined in this makefile. +.PHONY: list +list: + @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort + +# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). +.PHONY: test +test: + @npm test + +.PHONY: _ensure-tag +_ensure-tag: +ifndef TAG + $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) +endif + +CHANGELOG_ERROR = $(error No CHANGELOG specified) +.PHONY: _ensure-changelog +_ensure-changelog: + @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) + +# Ensures that the git workspace is clean. +.PHONY: _ensure-clean +_ensure-clean: + @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } + +# Makes a release; invoke with `make TAG= release`. +.PHONY: release +release: _ensure-tag _ensure-changelog _ensure-clean + @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ + new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ + if printf "$$new_ver" | command grep -q '^[0-9]'; then \ + semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ + semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ + else \ + new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ + fi; \ + printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ + replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ + git tag -a -m "v$$new_ver" "v$$new_ver" diff --git a/node_modules/is-regex/README.md b/node_modules/is-regex/README.md new file mode 100644 index 0000000000000..05baa0ebca339 --- /dev/null +++ b/node_modules/is-regex/README.md @@ -0,0 +1,54 @@ +#is-regex [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +[![browser support][9]][10] + +Is this value a JS regex? +This module works cross-realm/iframe, and despite ES6 @@toStringTag. + +## Example + +```js +var isRegex = require('is-regex'); +var assert = require('assert'); + +assert.notOk(isRegex(undefined)); +assert.notOk(isRegex(null)); +assert.notOk(isRegex(false)); +assert.notOk(isRegex(true)); +assert.notOk(isRegex(42)); +assert.notOk(isRegex('foo')); +assert.notOk(isRegex(function () {})); +assert.notOk(isRegex([])); +assert.notOk(isRegex({})); + +assert.ok(isRegex(/a/g)); +assert.ok(isRegex(new RegExp('a', 'g'))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-regex +[2]: http://versionbadg.es/ljharb/is-regex.svg +[3]: https://travis-ci.org/ljharb/is-regex.svg +[4]: https://travis-ci.org/ljharb/is-regex +[5]: https://david-dm.org/ljharb/is-regex.svg +[6]: https://david-dm.org/ljharb/is-regex +[7]: https://david-dm.org/ljharb/is-regex/dev-status.svg +[8]: https://david-dm.org/ljharb/is-regex#info=devDependencies +[9]: https://ci.testling.com/ljharb/is-regex.png +[10]: https://ci.testling.com/ljharb/is-regex +[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/is-regex.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/is-regex.svg +[downloads-url]: http://npm-stat.com/charts.html?package=is-regex + diff --git a/node_modules/is-regex/index.js b/node_modules/is-regex/index.js new file mode 100644 index 0000000000000..be6513390f7d3 --- /dev/null +++ b/node_modules/is-regex/index.js @@ -0,0 +1,39 @@ +'use strict'; + +var has = require('has'); +var regexExec = RegExp.prototype.exec; +var gOPD = Object.getOwnPropertyDescriptor; + +var tryRegexExecCall = function tryRegexExec(value) { + try { + var lastIndex = value.lastIndex; + value.lastIndex = 0; + + regexExec.call(value); + return true; + } catch (e) { + return false; + } finally { + value.lastIndex = lastIndex; + } +}; +var toStr = Object.prototype.toString; +var regexClass = '[object RegExp]'; +var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; + +module.exports = function isRegex(value) { + if (!value || typeof value !== 'object') { + return false; + } + if (!hasToStringTag) { + return toStr.call(value) === regexClass; + } + + var descriptor = gOPD(value, 'lastIndex'); + var hasLastIndexDataProperty = descriptor && has(descriptor, 'value'); + if (!hasLastIndexDataProperty) { + return false; + } + + return tryRegexExecCall(value); +}; diff --git a/node_modules/is-regex/package.json b/node_modules/is-regex/package.json new file mode 100644 index 0000000000000..697123805ac3e --- /dev/null +++ b/node_modules/is-regex/package.json @@ -0,0 +1,77 @@ +{ + "name": "is-regex", + "version": "1.0.4", + "description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag", + "author": "Jordan Harband", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "node --harmony --es-staging test.js", + "posttest": "npm run security", + "coverage": "covert test.js", + "coverage-quiet": "covert test.js --quiet", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js", + "eslint": "eslint test.js *.js", + "eccheck": "editorconfig-tools check *.js **/*.js > /dev/null", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/is-regex.git" + }, + "bugs": { + "url": "https://github.com/ljharb/is-regex/issues" + }, + "homepage": "https://github.com/ljharb/is-regex", + "keywords": [ + "regex", + "regexp", + "is", + "regular expression", + "regular", + "expression" + ], + "dependencies": { + "has": "^1.0.1" + }, + "devDependencies": { + "tape": "^4.6.3", + "covert": "^1.1.0", + "jscs": "^3.0.7", + "editorconfig-tools": "^0.1.1", + "nsp": "^2.6.2", + "eslint": "^3.15.0", + "@ljharb/eslint-config": "^11.0.0", + "semver": "^5.3.0", + "replace": "^0.3.0" + }, + "testling": { + "files": "test.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..12.0", + "opera/15.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz" +,"_integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=" +,"_from": "is-regex@1.0.4" +} \ No newline at end of file diff --git a/node_modules/is-regex/test.js b/node_modules/is-regex/test.js new file mode 100644 index 0000000000000..8d390038dae33 --- /dev/null +++ b/node_modules/is-regex/test.js @@ -0,0 +1,58 @@ +'use strict'; + +var test = require('tape'); +var isRegex = require('./'); +var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; + +test('not regexes', function (t) { + t.notOk(isRegex(), 'undefined is not regex'); + t.notOk(isRegex(null), 'null is not regex'); + t.notOk(isRegex(false), 'false is not regex'); + t.notOk(isRegex(true), 'true is not regex'); + t.notOk(isRegex(42), 'number is not regex'); + t.notOk(isRegex('foo'), 'string is not regex'); + t.notOk(isRegex([]), 'array is not regex'); + t.notOk(isRegex({}), 'object is not regex'); + t.notOk(isRegex(function () {}), 'function is not regex'); + t.end(); +}); + +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { + var regex = /a/g; + var fakeRegex = { + toString: function () { return String(regex); }, + valueOf: function () { return regex; } + }; + fakeRegex[Symbol.toStringTag] = 'RegExp'; + t.notOk(isRegex(fakeRegex), 'fake RegExp with @@toStringTag "RegExp" is not regex'); + t.end(); +}); + +test('regexes', function (t) { + t.ok(isRegex(/a/g), 'regex literal is regex'); + t.ok(isRegex(new RegExp('a', 'g')), 'regex object is regex'); + t.end(); +}); + +test('does not mutate regexes', function (t) { + t.test('lastIndex is a marker object', function (st) { + var regex = /a/; + var marker = {}; + regex.lastIndex = marker; + st.equal(regex.lastIndex, marker, 'lastIndex is the marker object'); + st.ok(isRegex(regex), 'is regex'); + st.equal(regex.lastIndex, marker, 'lastIndex is the marker object after isRegex'); + st.end(); + }); + + t.test('lastIndex is nonzero', function (st) { + var regex = /a/; + regex.lastIndex = 3; + st.equal(regex.lastIndex, 3, 'lastIndex is 3'); + st.ok(isRegex(regex), 'is regex'); + st.equal(regex.lastIndex, 3, 'lastIndex is 3 after isRegex'); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/is-symbol/.editorconfig b/node_modules/is-symbol/.editorconfig new file mode 100644 index 0000000000000..eaa214161f5cd --- /dev/null +++ b/node_modules/is-symbol/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/is-symbol/.jscs.json b/node_modules/is-symbol/.jscs.json new file mode 100644 index 0000000000000..b4d9b8b40aebf --- /dev/null +++ b/node_modules/is-symbol/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 1 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/is-symbol/.nvmrc b/node_modules/is-symbol/.nvmrc new file mode 100644 index 0000000000000..64f5a0a6813a4 --- /dev/null +++ b/node_modules/is-symbol/.nvmrc @@ -0,0 +1 @@ +node diff --git a/node_modules/is-symbol/.travis.yml b/node_modules/is-symbol/.travis.yml new file mode 100644 index 0000000000000..c671d5ea89c49 --- /dev/null +++ b/node_modules/is-symbol/.travis.yml @@ -0,0 +1,241 @@ +language: node_js +os: + - linux +node_js: + - "10.11" + - "9.11" + - "8.12" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "10.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - env: COVERAGE=true diff --git a/node_modules/is-symbol/CHANGELOG.md b/node_modules/is-symbol/CHANGELOG.md new file mode 100644 index 0000000000000..a7b8baf8db733 --- /dev/null +++ b/node_modules/is-symbol/CHANGELOG.md @@ -0,0 +1,12 @@ +1.0.2 / 2018-09-20 +================= + * [Refactor] use `has-symbols` and `object-inspect` + * [Tests] test on all the node minor versions + +1.0.1 / 2015-01-26 +================= + * Corrected description + +1.0.0 / 2015-01-24 +================= + * Initial release diff --git a/node_modules/is-symbol/LICENSE b/node_modules/is-symbol/LICENSE new file mode 100644 index 0000000000000..b43df444e5182 --- /dev/null +++ b/node_modules/is-symbol/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/node_modules/is-symbol/Makefile b/node_modules/is-symbol/Makefile new file mode 100644 index 0000000000000..b9e4fe1aab3dd --- /dev/null +++ b/node_modules/is-symbol/Makefile @@ -0,0 +1,61 @@ +# Since we rely on paths relative to the makefile location, abort if make isn't being run from there. +$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) + + # The files that need updating when incrementing the version number. +VERSIONED_FILES := *.js *.json README* + + +# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. +# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment +# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. +export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") +UTILS := semver +# Make sure that all required utilities can be located. +UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) + +# Default target (by virtue of being the first non '.'-prefixed in the file). +.PHONY: _no-target-specified +_no-target-specified: + $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) + +# Lists all targets defined in this makefile. +.PHONY: list +list: + @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort + +# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). +.PHONY: test +test: + @npm test + +.PHONY: _ensure-tag +_ensure-tag: +ifndef TAG + $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) +endif + +CHANGELOG_ERROR = $(error No CHANGELOG specified) +.PHONY: _ensure-changelog +_ensure-changelog: + @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) + +# Ensures that the git workspace is clean. +.PHONY: _ensure-clean +_ensure-clean: + @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } + +# Makes a release; invoke with `make TAG= release`. +.PHONY: release +release: _ensure-tag _ensure-changelog _ensure-clean + @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ + new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ + if printf "$$new_ver" | command grep -q '^[0-9]'; then \ + semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ + semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ + else \ + new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ + fi; \ + printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ + replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ + git tag -a -m "v$$new_ver" "v$$new_ver" diff --git a/node_modules/is-symbol/README.md b/node_modules/is-symbol/README.md new file mode 100644 index 0000000000000..8544c8c0937c1 --- /dev/null +++ b/node_modules/is-symbol/README.md @@ -0,0 +1,46 @@ +#is-symbol [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +[![browser support][9]][10] + +Is this an ES6 Symbol value? + +## Example + +```js +var isSymbol = require('is-symbol'); +assert(!isSymbol(function () {})); +assert(!isSymbol(null)); +assert(!isSymbol(function* () { yield 42; return Infinity; }); + +assert(isSymbol(Symbol.iterator)); +assert(isSymbol(Symbol('foo'))); +assert(isSymbol(Symbol.for('foo'))); +assert(isSymbol(Object(Symbol('foo')))); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-symbol +[2]: http://versionbadg.es/ljharb/is-symbol.svg +[3]: https://travis-ci.org/ljharb/is-symbol.svg +[4]: https://travis-ci.org/ljharb/is-symbol +[5]: https://david-dm.org/ljharb/is-symbol.svg +[6]: https://david-dm.org/ljharb/is-symbol +[7]: https://david-dm.org/ljharb/is-symbol/dev-status.svg +[8]: https://david-dm.org/ljharb/is-symbol#info=devDependencies +[9]: https://ci.testling.com/ljharb/is-symbol.png +[10]: https://ci.testling.com/ljharb/is-symbol +[11]: https://nodei.co/npm/is-symbol.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/is-symbol.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/is-symbol.svg +[downloads-url]: http://npm-stat.com/charts.html?package=is-symbol diff --git a/node_modules/is-symbol/index.js b/node_modules/is-symbol/index.js new file mode 100644 index 0000000000000..3d653e27f5fc6 --- /dev/null +++ b/node_modules/is-symbol/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var toStr = Object.prototype.toString; +var hasSymbols = require('has-symbols')(); + +if (hasSymbols) { + var symToStr = Symbol.prototype.toString; + var symStringRegex = /^Symbol\(.*\)$/; + var isSymbolObject = function isRealSymbolObject(value) { + if (typeof value.valueOf() !== 'symbol') { + return false; + } + return symStringRegex.test(symToStr.call(value)); + }; + + module.exports = function isSymbol(value) { + if (typeof value === 'symbol') { + return true; + } + if (toStr.call(value) !== '[object Symbol]') { + return false; + } + try { + return isSymbolObject(value); + } catch (e) { + return false; + } + }; +} else { + + module.exports = function isSymbol(value) { + // this environment does not support Symbols. + return false && value; + }; +} diff --git a/node_modules/is-symbol/package.json b/node_modules/is-symbol/package.json new file mode 100644 index 0000000000000..5e124e2194a73 --- /dev/null +++ b/node_modules/is-symbol/package.json @@ -0,0 +1,72 @@ +{ + "name": "is-symbol", + "version": "1.0.2", + "description": "Determine if a value is an ES6 Symbol or not.", + "main": "index.js", + "scripts": { + "prepublish": "safe-publish-latest", + "pretest": "npm run lint", + "tests-only": "node --es-staging --harmony test", + "test": "npm run tests-only", + "posttest": "npm run security", + "coverage": "covert test", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js */*.js", + "eslint": "eslint *.js */*.js", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/is-symbol.git" + }, + "keywords": [ + "symbol", + "es6", + "is", + "Symbol" + ], + "author": "Jordan Harband", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/is-symbol/issues" + }, + "dependencies": { + "has-symbols": "^1.0.0" + }, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "eslint": "^4.19.1", + "jscs": "^3.0.7", + "nsp": "^3.2.1", + "object-inspect": "^1.6.0", + "safe-publish-latest": "^1.1.2", + "semver": "^5.5.0", + "tape": "^4.9.0" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz" +,"_integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==" +,"_from": "is-symbol@1.0.2" +} \ No newline at end of file diff --git a/node_modules/is-symbol/test/index.js b/node_modules/is-symbol/test/index.js new file mode 100644 index 0000000000000..e01f035c8ca3a --- /dev/null +++ b/node_modules/is-symbol/test/index.js @@ -0,0 +1,92 @@ +'use strict'; + +var test = require('tape'); +var isSymbol = require('../index'); + +var forEach = function (arr, func) { + var i; + for (i = 0; i < arr.length; ++i) { + func(arr[i], i, arr); + } +}; + +var hasSymbols = require('has-symbols')(); +var inspect = require('object-inspect'); +var debug = function (v, m) { return inspect(v) + ' ' + m; }; + +test('non-symbol values', function (t) { + var nonSymbols = [ + true, + false, + Object(true), + Object(false), + null, + undefined, + {}, + [], + /a/g, + 'string', + 42, + new Date(), + function () {}, + NaN + ]; + t.plan(nonSymbols.length); + forEach(nonSymbols, function (nonSymbol) { + t.equal(false, isSymbol(nonSymbol), debug(nonSymbol, 'is not a symbol')); + }); + t.end(); +}); + +test('faked symbol values', function (t) { + t.test('real symbol valueOf', { skip: !hasSymbols }, function (st) { + var fakeSymbol = { valueOf: function () { return Symbol('foo'); } }; + st.equal(false, isSymbol(fakeSymbol), 'object with valueOf returning a symbol is not a symbol'); + st.end(); + }); + + t.test('faked @@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (st) { + var fakeSymbol = { valueOf: function () { return Symbol('foo'); } }; + fakeSymbol[Symbol.toStringTag] = 'Symbol'; + st.equal(false, isSymbol(fakeSymbol), 'object with fake Symbol @@toStringTag and valueOf returning a symbol is not a symbol'); + var notSoFakeSymbol = { valueOf: function () { return 42; } }; + notSoFakeSymbol[Symbol.toStringTag] = 'Symbol'; + st.equal(false, isSymbol(notSoFakeSymbol), 'object with fake Symbol @@toStringTag and valueOf not returning a symbol is not a symbol'); + st.end(); + }); + + var fakeSymbolString = { toString: function () { return 'Symbol(foo)'; } }; + t.equal(false, isSymbol(fakeSymbolString), 'object with toString returning Symbol(foo) is not a symbol'); + + t.end(); +}); + +test('Symbol support', { skip: !hasSymbols }, function (t) { + t.test('well-known Symbols', function (st) { + var isWellKnown = function filterer(name) { + return name !== 'for' && name !== 'keyFor' && !(name in filterer); + }; + var wellKnownSymbols = Object.getOwnPropertyNames(Symbol).filter(isWellKnown); + wellKnownSymbols.forEach(function (name) { + var sym = Symbol[name]; + st.equal(true, isSymbol(sym), debug(sym, ' is a symbol')); + }); + st.end(); + }); + + t.test('user-created symbols', function (st) { + var symbols = [ + Symbol(), + Symbol('foo'), + Symbol['for']('foo'), + Object(Symbol('object')) + ]; + symbols.forEach(function (sym) { + st.equal(true, isSymbol(sym), debug(sym, ' is a symbol')); + }); + st.end(); + }); + + t.end(); +}); + diff --git a/node_modules/object-keys/.editorconfig b/node_modules/object-keys/.editorconfig new file mode 100644 index 0000000000000..eaa214161f5cd --- /dev/null +++ b/node_modules/object-keys/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/object-keys/.jscs.json b/node_modules/object-keys/.jscs.json new file mode 100644 index 0000000000000..47828965125a0 --- /dev/null +++ b/node_modules/object-keys/.jscs.json @@ -0,0 +1,175 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 7 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/object-keys/.travis.yml b/node_modules/object-keys/.travis.yml new file mode 100644 index 0000000000000..767256c8dd484 --- /dev/null +++ b/node_modules/object-keys/.travis.yml @@ -0,0 +1,225 @@ +language: node_js +os: + - linux +node_js: + - "10.4" + - "9.11" + - "8.11" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - env: COVERAGE=true diff --git a/node_modules/object-keys/CHANGELOG.md b/node_modules/object-keys/CHANGELOG.md new file mode 100644 index 0000000000000..27123c475ef66 --- /dev/null +++ b/node_modules/object-keys/CHANGELOG.md @@ -0,0 +1,220 @@ +1.0.12 / 2018-06-18 +================= + * [Fix] avoid accessing `window.applicationCache`, to avoid issues with latest Chrome on HTTP (#46) + +1.0.11 / 2016-07-05 +================= + * [Fix] exclude keys regarding the style (eg. `pageYOffset`) on `window` to avoid reflow (#32) + +1.0.10 / 2016-07-04 +================= + * [Fix] exclude `height` and `width` keys on `window` to avoid reflow (#31) + * [Fix] In IE 6, `window.external` makes `Object.keys` throw + * [Tests] up to `node` `v6.2`, `v5.10`, `v4.4` + * [Tests] use pretest/posttest for linting/security + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` + * [Dev Deps] remove unused eccheck script + dep + +1.0.9 / 2015-10-19 +================= + * [Fix] Blacklist 'frame' property on window (#16, #17) + * [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` + +1.0.8 / 2015-10-14 +================= + * [Fix] wrap automation equality bug checking in try/catch, per [es5-shim#327](https://github.com/es-shims/es5-shim/issues/327) + * [Fix] Blacklist 'window.frameElement' per [es5-shim#322](https://github.com/es-shims/es5-shim/issues/322) + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Tests] up to `io.js` `v3.3`, `node` `v4.2` + * [Dev Deps] update `eslint`, `tape`, `@ljharb/eslint-config`, `jscs` + +1.0.7 / 2015-07-18 +================= + * [Fix] A proper fix for 176f03335e90d5c8d0d8125a99f27819c9b9cdad / https://github.com/es-shims/es5-shim/issues/275 that doesn't break dontEnum/constructor fixes in IE 8. + * [Fix] Remove deprecation message in Chrome by touching deprecated window properties (#15) + * [Tests] Improve test output for automation equality bugfix + * [Tests] Test on `io.js` `v2.4` + +1.0.6 / 2015-07-09 +================= + * [Fix] Use an object lookup rather than ES5's `indexOf` (#14) + * [Tests] ES3 browsers don't have `Array.isArray` + * [Tests] Fix `no-shadow` rule, as well as an IE 8 bug caused by engine NFE shadowing bugs. + +1.0.5 / 2015-07-03 +================= + * [Fix] Fix a flabbergasting IE 8 bug where `localStorage.constructor.prototype === localStorage` throws + * [Tests] Test up to `io.js` `v2.3` + * [Dev Deps] Update `nsp`, `eslint` + +1.0.4 / 2015-05-23 +================= + * Fix a Safari 5.0 bug with `Object.keys` not working with `arguments` + * Test on latest `node` and `io.js` + * Update `jscs`, `tape`, `eslint`, `nsp`, `is`, `editorconfig-tools`, `covert` + +1.0.3 / 2015-01-06 +================= + * Revert "Make `object-keys` more robust against later environment tampering" to maintain ES3 compliance + +1.0.2 / 2014-12-28 +================= + * Update lots of dev dependencies + * Tweaks to README + * Make `object-keys` more robust against later environment tampering + +1.0.1 / 2014-09-03 +================= + * Update URLs and badges in README + +1.0.0 / 2014-08-26 +================= + * v1.0.0 + +0.6.1 / 2014-08-25 +================= + * v0.6.1 + * Updating dependencies (tape, covert, is) + * Update badges in readme + * Use separate var statements + +0.6.0 / 2014-04-23 +================= + * v0.6.0 + * Updating dependencies (tape, covert) + * Make sure boxed primitives, and arguments objects, work properly in ES3 browsers + * Improve test matrix: test all node versions, but only latest two stables are a failure + * Remove internal foreach shim. + +0.5.1 / 2014-03-09 +================= + * 0.5.1 + * Updating dependencies (tape, covert, is) + * Removing forEach from the module (but keeping it in tests) + +0.5.0 / 2014-01-30 +================= + * 0.5.0 + * Explicitly returning the shim, instead of returning native Object.keys when present + * Adding a changelog. + * Cleaning up IIFE wrapping + * Testing on node 0.4 through 0.11 + +0.4.0 / 2013-08-14 +================== + + * v0.4.0 + * In Chrome 4-10 and Safari 4, typeof (new RegExp) === 'function' + * If it's a string, make sure to use charAt instead of brackets. + * Only use Function#call if necessary. + * Making sure the context tests actually run. + * Better function detection + * Adding the android browser + * Fixing testling files + * Updating tape + * Removing the "is" dependency. + * Making an isArguments shim. + * Adding a local forEach shim and tests. + * Updating paths. + * Moving the shim test. + * v0.3.0 + +0.3.0 / 2013-05-18 +================== + + * README tweak. + * Fixing constructor enum issue. Fixes [#5](https://github.com/ljharb/object-keys/issues/5). + * Adding a test for [#5](https://github.com/ljharb/object-keys/issues/5) + * Updating readme. + * Updating dependencies. + * Giving credit to lodash. + * Make sure that a prototype's constructor property is not enumerable. Fixes [#3](https://github.com/ljharb/object-keys/issues/3). + * Adding additional tests to handle arguments objects, and to skip "prototype" in functions. Fixes [#2](https://github.com/ljharb/object-keys/issues/2). + * Fixing a typo on this test for [#3](https://github.com/ljharb/object-keys/issues/3). + * Adding node 0.10 to travis. + * Adding an IE < 9 test per [#3](https://github.com/ljharb/object-keys/issues/3) + * Adding an iOS 5 mobile Safari test per [#2](https://github.com/ljharb/object-keys/issues/2) + * Moving "indexof" and "is" to be dev dependencies. + * Making sure the shim works with functions. + * Flattening the tests. + +0.2.0 / 2013-05-10 +================== + + * v0.2.0 + * Object.keys should work with arrays. + +0.1.8 / 2013-05-10 +================== + + * v0.1.8 + * Upgrading dependencies. + * Using a simpler check. + * Fixing a bug in hasDontEnumBug browsers. + * Using the newest tape! + * Fixing this error test. + * "undefined" is probably a reserved word in ES3. + * Better test message. + +0.1.7 / 2013-04-17 +================== + + * Upgrading "is" once more. + * The key "null" is breaking some browsers. + +0.1.6 / 2013-04-17 +================== + + * v0.1.6 + * Upgrading "is" + +0.1.5 / 2013-04-14 +================== + + * Bumping version. + * Adding more testling browsers. + * Updating "is" + +0.1.4 / 2013-04-08 +================== + + * Using "is" instead of "is-extended". + +0.1.3 / 2013-04-07 +================== + + * Using "foreach" instead of my own shim. + * Removing "tap"; I'll just wait for "tape" to fix its node 0.10 bug. + +0.1.2 / 2013-04-03 +================== + + * Adding dependency status; moving links to an index at the bottom. + * Upgrading is-extended; version 0.1.2 + * Adding an npm version badge. + +0.1.1 / 2013-04-01 +================== + + * Adding Travis CI. + * Bumping the version. + * Adding indexOf since IE sucks. + * Adding a forEach shim since older browsers don't have Array#forEach. + * Upgrading tape - 0.3.2 uses Array#map + * Using explicit end instead of plan. + * Can't test with Array.isArray in older browsers. + * Using is-extended. + * Fixing testling files. + * JSHint/JSLint-ing. + * Removing an unused object. + * Using strict mode. + +0.1.0 / 2013-03-30 +================== + + * Changing the exports should have meant a higher version bump. + * Oops, fixing the repo URL. + * Adding more tests. + * 0.0.2 + * Merge branch 'export_one_thing'; closes [#1](https://github.com/ljharb/object-keys/issues/1) + * Move shim export to a separate file. diff --git a/node_modules/object-keys/LICENSE b/node_modules/object-keys/LICENSE new file mode 100644 index 0000000000000..28553fdd06841 --- /dev/null +++ b/node_modules/object-keys/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2013 Jordan Harband + +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. \ No newline at end of file diff --git a/node_modules/object-keys/README.md b/node_modules/object-keys/README.md new file mode 100644 index 0000000000000..ed4c277023a8a --- /dev/null +++ b/node_modules/object-keys/README.md @@ -0,0 +1,76 @@ +#object-keys [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +An Object.keys shim. Invoke its "shim" method to shim Object.keys if it is unavailable. + +Most common usage: +```js +var keys = Object.keys || require('object-keys'); +``` + +## Example + +```js +var keys = require('object-keys'); +var assert = require('assert'); +var obj = { + a: true, + b: true, + c: true +}; + +assert.deepEqual(keys(obj), ['a', 'b', 'c']); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is not present */ +delete Object.keys; +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, keys); +assert.deepEqual(Object.keys(obj), keys(obj)); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is present */ +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, Object.keys); +assert.deepEqual(Object.keys(obj), keys(obj)); +``` + +## Source +Implementation taken directly from [es5-shim][es5-shim-url], with modifications, including from [lodash][lodash-url]. + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/object-keys +[npm-version-svg]: http://versionbadg.es/ljharb/object-keys.svg +[travis-svg]: https://travis-ci.org/ljharb/object-keys.svg +[travis-url]: https://travis-ci.org/ljharb/object-keys +[deps-svg]: https://david-dm.org/ljharb/object-keys.svg +[deps-url]: https://david-dm.org/ljharb/object-keys +[dev-deps-svg]: https://david-dm.org/ljharb/object-keys/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/object-keys#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/object-keys.png +[testling-url]: https://ci.testling.com/ljharb/object-keys +[es5-shim-url]: https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L542-589 +[lodash-url]: https://github.com/lodash/lodash +[npm-badge-png]: https://nodei.co/npm/object-keys.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/object-keys.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/object-keys.svg +[downloads-url]: http://npm-stat.com/charts.html?package=object-keys + diff --git a/node_modules/object-keys/index.js b/node_modules/object-keys/index.js new file mode 100644 index 0000000000000..3f2463eb8040c --- /dev/null +++ b/node_modules/object-keys/index.js @@ -0,0 +1,141 @@ +'use strict'; + +// modified from https://github.com/es-shims/es5-shim +var has = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); +var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); +var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' +]; +var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; +}; +var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true +}; +var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; +}()); +var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } +}; + +var keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; +}; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + return (Object.keys(arguments) || '').length === 2; + }(1, 2)); + if (!keysWorksWithArguments) { + var originalKeys = Object.keys; + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } else { + return originalKeys(object); + } + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; diff --git a/node_modules/object-keys/isArguments.js b/node_modules/object-keys/isArguments.js new file mode 100644 index 0000000000000..f2a2a9014d925 --- /dev/null +++ b/node_modules/object-keys/isArguments.js @@ -0,0 +1,17 @@ +'use strict'; + +var toStr = Object.prototype.toString; + +module.exports = function isArguments(value) { + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; + } + return isArgs; +}; diff --git a/node_modules/object-keys/package.json b/node_modules/object-keys/package.json new file mode 100644 index 0000000000000..e988c2db4cbc7 --- /dev/null +++ b/node_modules/object-keys/package.json @@ -0,0 +1,94 @@ +{ + "name": "object-keys", + "version": "1.0.12", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net" + }, + { + "name": "Ivan Starkov", + "email": "istarkov@gmail.com" + }, + { + "name": "Gary Katsevman", + "email": "git@gkatsev.com" + } + ], + "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim", + "license": "MIT", + "main": "index.js", + "scripts": { + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent security", + "tests-only": "node test/index.js", + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "lint": "npm run --silent jscs && npm run --silent eslint", + "jscs": "jscs test/*.js *.js", + "eslint": "eslint test/*.js *.js", + "security": "nsp check" + }, + "repository": { + "type": "git", + "url": "git://github.com/ljharb/object-keys.git" + }, + "keywords": [ + "Object.keys", + "keys", + "ES5", + "shim" + ], + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "eslint": "^4.19.1", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.2.1", + "jscs": "^3.0.7", + "nsp": "^3.2.1", + "tape": "^4.9.1" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + } + +,"_resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz" +,"_integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" +,"_from": "object-keys@1.0.12" +} \ No newline at end of file diff --git a/node_modules/object-keys/test/index.js b/node_modules/object-keys/test/index.js new file mode 100644 index 0000000000000..5402465a19b5b --- /dev/null +++ b/node_modules/object-keys/test/index.js @@ -0,0 +1,5 @@ +'use strict'; + +require('./isArguments'); + +require('./shim'); diff --git a/node_modules/object.getownpropertydescriptors/.editorconfig b/node_modules/object.getownpropertydescriptors/.editorconfig new file mode 100644 index 0000000000000..eaa214161f5cd --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/object.getownpropertydescriptors/.jscs.json b/node_modules/object.getownpropertydescriptors/.jscs.json new file mode 100644 index 0000000000000..3d099c4b1192c --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 1 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/object.getownpropertydescriptors/.npmignore b/node_modules/object.getownpropertydescriptors/.npmignore new file mode 100644 index 0000000000000..59d842baa84c8 --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/node_modules/object.getownpropertydescriptors/.travis.yml b/node_modules/object.getownpropertydescriptors/.travis.yml new file mode 100644 index 0000000000000..54ec28b3c4d85 --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/.travis.yml @@ -0,0 +1,96 @@ +language: node_js +node_js: + - "6.2" + - "6.1" + - "6.0" + - "5.12" + - "5.11" + - "5.10" + - "5.9" + - "5.8" + - "5.7" + - "5.6" + - "5.5" + - "5.4" + - "5.3" + - "5.2" + - "5.1" + - "5.0" + - "4.4" + - "4.3" + - "4.2" + - "4.1" + - "4.0" + - "iojs-v3.3" + - "iojs-v3.2" + - "iojs-v3.1" + - "iojs-v3.0" + - "iojs-v2.5" + - "iojs-v2.4" + - "iojs-v2.3" + - "iojs-v2.2" + - "iojs-v2.1" + - "iojs-v2.0" + - "iojs-v1.8" + - "iojs-v1.7" + - "iojs-v1.6" + - "iojs-v1.5" + - "iojs-v1.4" + - "iojs-v1.3" + - "iojs-v1.2" + - "iojs-v1.1" + - "iojs-v1.0" + - "0.12" + - "0.11" + - "0.10" + - "0.9" + - "0.8" + - "0.6" + - "0.4" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' +script: + - 'if [ "${TRAVIS_NODE_VERSION}" != "4.4" ]; then npm run tests-only ; else npm test ; fi' +sudo: false +matrix: + fast_finish: true + allow_failures: + - node_js: "6.1" + - node_js: "6.0" + - node_js: "5.11" + - node_js: "5.10" + - node_js: "5.9" + - node_js: "5.8" + - node_js: "5.7" + - node_js: "5.6" + - node_js: "5.5" + - node_js: "5.4" + - node_js: "5.3" + - node_js: "5.2" + - node_js: "5.1" + - node_js: "5.0" + - node_js: "4.3" + - node_js: "4.2" + - node_js: "4.1" + - node_js: "4.0" + - node_js: "iojs-v3.2" + - node_js: "iojs-v3.1" + - node_js: "iojs-v3.0" + - node_js: "iojs-v2.4" + - node_js: "iojs-v2.3" + - node_js: "iojs-v2.2" + - node_js: "iojs-v2.1" + - node_js: "iojs-v2.0" + - node_js: "iojs-v1.7" + - node_js: "iojs-v1.6" + - node_js: "iojs-v1.5" + - node_js: "iojs-v1.4" + - node_js: "iojs-v1.3" + - node_js: "iojs-v1.2" + - node_js: "iojs-v1.1" + - node_js: "iojs-v1.0" + - node_js: "0.11" + - node_js: "0.9" + - node_js: "0.6" + - node_js: "0.4" diff --git a/node_modules/object.getownpropertydescriptors/CHANGELOG.md b/node_modules/object.getownpropertydescriptors/CHANGELOG.md new file mode 100644 index 0000000000000..d7c2d15033b3d --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/CHANGELOG.md @@ -0,0 +1,51 @@ +2.0.3 / 2016-07-26 +================= + * [Fix] Update implementation to not return `undefined` descriptors + * [Deps] update `es-abstract` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `jscs`, `nsp`, `tape`, `semver` + * [Dev Deps] remove unused eccheck script + dep + * [Tests] up to `node` `v6.3`, `v5.12`, `v4.4` + * [Tests] use pretest/posttest for linting/security + * Update to stage 4 + +2.0.2 / 2016-01-27 +================= + * [Fix] ensure that `Object.getOwnPropertyDescriptors` does not fail when `Object.prototype` has a poisoned setter (#1, #2) + +2.0.1 / 2016-01-27 +================= + * [Deps] move `@es-shims/api` to dev deps + +2.0.0 / 2016-01-27 +================= + * [Breaking] implement the es-shims API + * [Deps] update `define-properties`, `es-abstract` + * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` + * [Tests] fix npm upgrades in older nodes + * [Tests] up to `node` `v5.5` + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + +1.0.4 / 2015-07-20 +================= + * [Tests] Test on `io.js` `v2.4` + * [Deps, Dev Deps] Update `define-properties`, `tape`, `eslint`, `semver` + +1.0.3 / 2015-06-28 +================= + * Increase robustness by caching `Array#{concat, reduce}` + * [Deps] Update `define_properties` + * [Dev Deps] Update `eslint`, `semver`, `nsp` + * [Tests] Test up to `io.js` `v2.3` + +1.0.2 / 2015-05-23 +================= + * Update `es-abstract`, `tape`, `eslint`, `jscs`, `semver`, `covert` + * Test up to `io.js` `v2.0` + +1.0.1 / 2015-03-20 +================= + * Update `es-abstract`, `editorconfig-tools`, `nsp`, `eslint`, `semver`, `replace` + +1.0.0 / 2015-02-17 +================= + * v1.0.0 diff --git a/node_modules/object.getownpropertydescriptors/LICENSE b/node_modules/object.getownpropertydescriptors/LICENSE new file mode 100644 index 0000000000000..b43df444e5182 --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jordan Harband + +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/node_modules/object.getownpropertydescriptors/Makefile b/node_modules/object.getownpropertydescriptors/Makefile new file mode 100644 index 0000000000000..b9e4fe1aab3dd --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/Makefile @@ -0,0 +1,61 @@ +# Since we rely on paths relative to the makefile location, abort if make isn't being run from there. +$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in)) + + # The files that need updating when incrementing the version number. +VERSIONED_FILES := *.js *.json README* + + +# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly. +# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment +# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests. +export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH") +UTILS := semver +# Make sure that all required utilities can be located. +UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS))) + +# Default target (by virtue of being the first non '.'-prefixed in the file). +.PHONY: _no-target-specified +_no-target-specified: + $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests) + +# Lists all targets defined in this makefile. +.PHONY: list +list: + @$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort + +# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS). +.PHONY: test +test: + @npm test + +.PHONY: _ensure-tag +_ensure-tag: +ifndef TAG + $(error Please invoke with `make TAG= release`, where is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number) +endif + +CHANGELOG_ERROR = $(error No CHANGELOG specified) +.PHONY: _ensure-changelog +_ensure-changelog: + @ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2) + +# Ensures that the git workspace is clean. +.PHONY: _ensure-clean +_ensure-clean: + @[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; } + +# Makes a release; invoke with `make TAG= release`. +.PHONY: release +release: _ensure-tag _ensure-changelog _ensure-clean + @old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \ + new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \ + if printf "$$new_ver" | command grep -q '^[0-9]'; then \ + semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \ + semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \ + else \ + new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ + fi; \ + printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ + replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \ + git tag -a -m "v$$new_ver" "v$$new_ver" diff --git a/node_modules/object.getownpropertydescriptors/README.md b/node_modules/object.getownpropertydescriptors/README.md new file mode 100644 index 0000000000000..0fc6c185a11d7 --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/README.md @@ -0,0 +1,99 @@ +#object.getownpropertydescriptors [![Version Badge][npm-version-svg]][package-url] + +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +[![browser support][testling-svg]][testling-url] + +An ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5. +Invoke its "shim" method to shim `Object.getOwnPropertyDescriptors` if it is unavailable, and if `Object.getOwnPropertyDescriptor` is available. + +This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://github.com/tc39/ecma262/pull/582). + +## Example + +```js +var getDescriptors = require('object.getownpropertydescriptors'); +var assert = require('assert'); +var obj = { normal: Infinity }; +var enumDescriptor = { + enumerable: false, + writable: false, + configurable: true, + value: true +}; +var writableDescriptor = { + enumerable: true, + writable: true, + configurable: true, + value: 42 +}; +var symbol = Symbol(); +var symDescriptor = { + enumerable: true, + writable: true, + configurable: false, + value: [symbol] +}; + +Object.defineProperty(obj, 'enumerable', enumDescriptor); +Object.defineProperty(obj, 'writable', writableDescriptor); +Object.defineProperty(obj, 'symbol', symDescriptor); + +var descriptors = getDescriptors(obj); + +assert.deepEqual(descriptors, { + normal: { + enumerable: true, + writable: true, + configurable: true, + value: Infinity + }, + enumerable: enumDescriptor, + writable: writableDescriptor, + symbol: symDescriptor +}); +``` + +```js +var getDescriptors = require('object.getownpropertydescriptors'); +var assert = require('assert'); +/* when Object.getOwnPropertyDescriptors is not present */ +delete Object.getOwnPropertyDescriptors; +var shimmedDescriptors = getDescriptors.shim(); +assert.equal(shimmedDescriptors, getDescriptors); +assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj)); +``` + +```js +var getDescriptors = require('object.getownpropertydescriptors'); +var assert = require('assert'); +/* when Object.getOwnPropertyDescriptors is present */ +var shimmedDescriptors = getDescriptors.shim(); +assert.notEqual(shimmedDescriptors, getDescriptors); +assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/object.getownpropertydescriptors +[npm-version-svg]: http://versionbadg.es/ljharb/object.getownpropertydescriptors.svg +[travis-svg]: https://travis-ci.org/ljharb/object.getownpropertydescriptors.svg +[travis-url]: https://travis-ci.org/ljharb/object.getownpropertydescriptors +[deps-svg]: https://david-dm.org/ljharb/object.getownpropertydescriptors.svg +[deps-url]: https://david-dm.org/ljharb/object.getownpropertydescriptors +[dev-deps-svg]: https://david-dm.org/ljharb/object.getownpropertydescriptors/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/object.getownpropertydescriptors#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/object.getownpropertydescriptors.png +[testling-url]: https://ci.testling.com/ljharb/object.getownpropertydescriptors +[npm-badge-png]: https://nodei.co/npm/object.getownpropertydescriptors.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/object.getownpropertydescriptors.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/object.getownpropertydescriptors.svg +[downloads-url]: http://npm-stat.com/charts.html?package=object.getownpropertydescriptors diff --git a/node_modules/object.getownpropertydescriptors/implementation.js b/node_modules/object.getownpropertydescriptors/implementation.js new file mode 100644 index 0000000000000..784c22c99ca3b --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/implementation.js @@ -0,0 +1,44 @@ +'use strict'; + +var ES = require('es-abstract/es7'); + +var defineProperty = Object.defineProperty; +var getDescriptor = Object.getOwnPropertyDescriptor; +var getOwnNames = Object.getOwnPropertyNames; +var getSymbols = Object.getOwnPropertySymbols; +var concat = Function.call.bind(Array.prototype.concat); +var reduce = Function.call.bind(Array.prototype.reduce); +var getAll = getSymbols ? function (obj) { + return concat(getOwnNames(obj), getSymbols(obj)); +} : getOwnNames; + +var isES5 = ES.IsCallable(getDescriptor) && ES.IsCallable(getOwnNames); + +var safePut = function put(obj, prop, val) { // eslint-disable-line max-params + if (defineProperty && prop in obj) { + defineProperty(obj, prop, { + configurable: true, + enumerable: true, + value: val, + writable: true + }); + } else { + obj[prop] = val; + } +}; + +module.exports = function getOwnPropertyDescriptors(value) { + ES.RequireObjectCoercible(value); + if (!isES5) { + throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor'); + } + + var O = ES.ToObject(value); + return reduce(getAll(O), function (acc, key) { + var descriptor = getDescriptor(O, key); + if (typeof descriptor !== 'undefined') { + safePut(acc, key, descriptor); + } + return acc; + }, {}); +}; diff --git a/node_modules/object.getownpropertydescriptors/index.js b/node_modules/object.getownpropertydescriptors/index.js new file mode 100644 index 0000000000000..bf2aec5d5006d --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var define = require('define-properties'); + +var implementation = require('./implementation'); +var getPolyfill = require('./polyfill'); +var shim = require('./shim'); + +define(implementation, { + getPolyfill: getPolyfill, + implementation: implementation, + shim: shim +}); + +module.exports = implementation; diff --git a/node_modules/object.getownpropertydescriptors/package.json b/node_modules/object.getownpropertydescriptors/package.json new file mode 100644 index 0000000000000..fb1bdfa934009 --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/package.json @@ -0,0 +1,107 @@ +{ + "_from": "object.getownpropertydescriptors@^2.0.3", + "_id": "object.getownpropertydescriptors@2.0.3", + "_inBundle": false, + "_integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "_location": "/object.getownpropertydescriptors", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "object.getownpropertydescriptors@^2.0.3", + "name": "object.getownpropertydescriptors", + "escapedName": "object.getownpropertydescriptors", + "rawSpec": "^2.0.3", + "saveSpec": null, + "fetchSpec": "^2.0.3" + }, + "_requiredBy": [ + "/util-promisify" + ], + "_resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "_shasum": "8758c846f5b407adab0f236e0986f14b051caa16", + "_spec": "object.getownpropertydescriptors@^2.0.3", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/util-promisify", + "author": { + "name": "Jordan Harband" + }, + "bugs": { + "url": "https://github.com/ljharb/object.getownpropertydescriptors/issues" + }, + "bundleDependencies": false, + "dependencies": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + }, + "deprecated": false, + "description": "ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.", + "devDependencies": { + "@es-shims/api": "^1.2.0", + "@ljharb/eslint-config": "^6.0.0", + "covert": "^1.1.0", + "eslint": "^3.1.1", + "jscs": "^3.0.7", + "nsp": "^2.6.1", + "replace": "^0.3.0", + "semver": "^5.3.0", + "tape": "^4.6.0" + }, + "engines": { + "node": ">= 0.8" + }, + "homepage": "https://github.com/ljharb/object.getownpropertydescriptors#readme", + "keywords": [ + "Object.getOwnPropertyDescriptors", + "descriptor", + "property descriptor", + "ES8", + "ES2017", + "shim", + "polyfill", + "getOwnPropertyDescriptor", + "es-shim API" + ], + "license": "MIT", + "main": "index.js", + "name": "object.getownpropertydescriptors", + "repository": { + "type": "git", + "url": "git://github.com/ljharb/object.getownpropertydescriptors.git" + }, + "scripts": { + "coverage": "covert test/*.js", + "coverage:quiet": "covert test/*.js --quiet", + "eslint": "eslint test/*.js *.js", + "jscs": "jscs test/*.js *.js", + "lint": "npm run --silent jscs && npm run --silent eslint", + "posttest": "npm run --silent security", + "pretest": "npm run --silent lint && es-shim-api", + "security": "nsp check", + "test": "npm run --silent tests-only", + "test:module": "node test/index.js", + "test:shimmed": "node test/shimmed.js", + "tests-only": "npm run --silent test:shimmed && npm run --silent test:module" + }, + "testling": { + "files": [ + "test/index.js", + "test/shimmed.js" + ], + "browsers": [ + "iexplore/9.0..latest", + "firefox/4.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/5.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/12.0..latest", + "opera/next", + "safari/5.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "version": "2.0.3" +} diff --git a/node_modules/object.getownpropertydescriptors/polyfill.js b/node_modules/object.getownpropertydescriptors/polyfill.js new file mode 100644 index 0000000000000..0424acfb1c862 --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/polyfill.js @@ -0,0 +1,7 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = function getPolyfill() { + return typeof Object.getOwnPropertyDescriptors === 'function' ? Object.getOwnPropertyDescriptors : implementation; +}; diff --git a/node_modules/object.getownpropertydescriptors/shim.js b/node_modules/object.getownpropertydescriptors/shim.js new file mode 100644 index 0000000000000..799c7d3c2477a --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/shim.js @@ -0,0 +1,14 @@ +'use strict'; + +var getPolyfill = require('./polyfill'); +var define = require('define-properties'); + +module.exports = function shimGetOwnPropertyDescriptors() { + var polyfill = getPolyfill(); + define( + Object, + { getOwnPropertyDescriptors: polyfill }, + { getOwnPropertyDescriptors: function () { return Object.getOwnPropertyDescriptors !== polyfill; } } + ); + return polyfill; +}; diff --git a/node_modules/object.getownpropertydescriptors/test/index.js b/node_modules/object.getownpropertydescriptors/test/index.js new file mode 100644 index 0000000000000..618a205064d93 --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/test/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var getDescriptors = require('../'); +var test = require('tape'); +var runTests = require('./tests'); + +test('as a function', function (t) { + t.test('bad object/this value', function (st) { + st.throws(function () { return getDescriptors(undefined); }, TypeError, 'undefined is not an object'); + st.throws(function () { return getDescriptors(null); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(getDescriptors, t); + + t.end(); +}); diff --git a/node_modules/object.getownpropertydescriptors/test/shimmed.js b/node_modules/object.getownpropertydescriptors/test/shimmed.js new file mode 100644 index 0000000000000..c9af4c1d3853f --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/test/shimmed.js @@ -0,0 +1,35 @@ +'use strict'; + +var getDescriptors = require('../'); +getDescriptors.shim(); + +var test = require('tape'); +var defineProperties = require('define-properties'); +var runTests = require('./tests'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var functionsHaveNames = function f() {}.name === 'f'; + +test('shimmed', function (t) { + t.equal(Object.getOwnPropertyDescriptors.length, 1, 'Object.getOwnPropertyDescriptors has a length of 1'); + t.test('Function name', { skip: !functionsHaveNames }, function (st) { + st.equal(Object.getOwnPropertyDescriptors.name, 'getOwnPropertyDescriptors', 'Object.getOwnPropertyDescriptors has name "getOwnPropertyDescriptors"'); + st.end(); + }); + + t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) { + et.equal(false, isEnumerable.call(Object, 'getOwnPropertyDescriptors'), 'Object.getOwnPropertyDescriptors is not enumerable'); + et.end(); + }); + + var supportsStrictMode = (function () { return typeof this === 'undefined'; }()); + + t.test('bad object/this value', { skip: !supportsStrictMode }, function (st) { + st.throws(function () { return getDescriptors(undefined, 'a'); }, TypeError, 'undefined is not an object'); + st.throws(function () { return getDescriptors(null, 'a'); }, TypeError, 'null is not an object'); + st.end(); + }); + + runTests(Object.getOwnPropertyDescriptors, t); + + t.end(); +}); diff --git a/node_modules/object.getownpropertydescriptors/test/tests.js b/node_modules/object.getownpropertydescriptors/test/tests.js new file mode 100644 index 0000000000000..b9aa29edf71cb --- /dev/null +++ b/node_modules/object.getownpropertydescriptors/test/tests.js @@ -0,0 +1,127 @@ +'use strict'; + +module.exports = function (getDescriptors, t) { + var enumDescriptor = { + configurable: true, + enumerable: false, + value: true, + writable: false + }; + var writableDescriptor = { + configurable: true, + enumerable: true, + value: 42, + writable: true + }; + + t.test('works with Object.prototype poisoned setter', { skip: !Object.defineProperty }, function (st) { + var key = 'foo'; + + var obj = {}; + obj[key] = 42; + + var expected = {}; + expected[key] = { + configurable: true, + enumerable: true, + value: 42, + writable: true + }; + + /* eslint-disable no-extend-native, accessor-pairs */ + Object.defineProperty(Object.prototype, key, { configurable: true, set: function (v) { throw new Error(v); } }); + /* eslint-enable no-extend-native, accessor-pairs */ + + var hasOwnNamesBug = false; + try { + Object.getOwnPropertyNames(obj); + } catch (e) { + // v8 in node 0.6 - 0.12 has a bug :-( + hasOwnNamesBug = true; + st.comment('SKIP: this engine has a bug with Object.getOwnPropertyNames: it can not handle a throwing setter on Object.prototype.'); + } + + if (!hasOwnNamesBug) { + st.doesNotThrow(function () { + var result = getDescriptors(obj); + st.deepEqual(result, expected, 'got expected descriptors'); + }); + } + + /* eslint-disable no-extend-native */ + delete Object.prototype[key]; + /* eslint-enable no-extend-native */ + st.end(); + }); + + t.test('gets all expected non-Symbol descriptors', function (st) { + var obj = { normal: Infinity }; + Object.defineProperty(obj, 'enumerable', enumDescriptor); + Object.defineProperty(obj, 'writable', writableDescriptor); + + var descriptors = getDescriptors(obj); + + st.deepEqual(descriptors, { + enumerable: enumDescriptor, + normal: { + configurable: true, + enumerable: true, + value: Infinity, + writable: true + }, + writable: writableDescriptor + }); + st.end(); + }); + + var supportsSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; + t.test('gets Symbol descriptors too', { skip: !supportsSymbols }, function (st) { + var symbol = Symbol(); + var symDescriptor = { + configurable: false, + enumerable: true, + value: [symbol], + writable: true + }; + var obj = { normal: Infinity }; + Object.defineProperty(obj, 'enumerable', enumDescriptor); + Object.defineProperty(obj, 'writable', writableDescriptor); + Object.defineProperty(obj, 'symbol', symDescriptor); + + var descriptors = getDescriptors(obj); + + st.deepEqual(descriptors, { + enumerable: enumDescriptor, + normal: { + configurable: true, + enumerable: true, + value: Infinity, + writable: true + }, + symbol: symDescriptor, + writable: writableDescriptor + }); + st.end(); + }); + + /* global Proxy */ + var supportsProxy = typeof Proxy === 'function'; + t.test('Proxies that return an undefined descriptor', { skip: !supportsProxy }, function (st) { + var obj = { foo: true }; + var fooDescriptor = Object.getOwnPropertyDescriptor(obj, 'foo'); + + var proxy = new Proxy(obj, { + getOwnPropertyDescriptor: function (target, key) { + return Object.getOwnPropertyDescriptor(target, key); + }, + ownKeys: function () { + return [ + 'foo', + 'bar' + ]; + } + }); + st.deepEqual(getDescriptors(proxy), { foo: fooDescriptor }, 'object has no descriptors'); + st.end(); + }); +}; diff --git a/node_modules/read-package-tree/README.md b/node_modules/read-package-tree/README.md index c8edffd2bcc2e..aa0cc934cf47e 100644 --- a/node_modules/read-package-tree/README.md +++ b/node_modules/read-package-tree/README.md @@ -29,6 +29,9 @@ rpt('/path/to/pkg/root', function (node, kidName) { // error: // } }) + +// or promise-style +rpt('/path/to/pkg/root').then(data => { ... }) ``` That's it. It doesn't figure out if dependencies are met, it doesn't diff --git a/node_modules/read-package-tree/package.json b/node_modules/read-package-tree/package.json index 948f096620033..2173171af80ff 100644 --- a/node_modules/read-package-tree/package.json +++ b/node_modules/read-package-tree/package.json @@ -1,8 +1,8 @@ { "_from": "read-package-tree@latest", - "_id": "read-package-tree@5.2.2", + "_id": "read-package-tree@5.3.1", "_inBundle": false, - "_integrity": "sha512-rW3XWUUkhdKmN2JKB4FL563YAgtINifso5KShykufR03nJ5loGFlkUMe1g/yxmqX073SoYYTsgXu7XdDinKZuA==", + "_integrity": "sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw==", "_location": "/read-package-tree", "_phantomChildren": {}, "_requested": { @@ -20,10 +20,10 @@ "/", "/licensee" ], - "_resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.2.2.tgz", - "_shasum": "4b6a0ef2d943c1ea36a578214c9a7f6b7424f7a8", + "_resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.3.1.tgz", + "_shasum": "a32cb64c7f31eb8a6f31ef06f9cedf74068fe636", "_spec": "read-package-tree@latest", - "_where": "/Users/zkat/Documents/code/work/npm", + "_where": "/Users/isaacs/dev/npm/cli", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -34,11 +34,9 @@ }, "bundleDependencies": false, "dependencies": { - "debuglog": "^1.0.1", - "dezalgo": "^1.0.0", - "once": "^1.3.0", "read-package-json": "^2.0.0", - "readdir-scoped-modules": "^1.0.0" + "readdir-scoped-modules": "^1.0.0", + "util-promisify": "^2.1.0" }, "deprecated": false, "description": "Read the contents of node_modules.", @@ -46,13 +44,14 @@ "archy": "^1.0.0", "mkdirp": "^0.5.1", "tacks": "^1.2.1", - "tap": "^12.5.2" + "tap": "^12.7.0" }, "directories": { "test": "test" }, "files": [ - "rpt.js" + "rpt.js", + "realpath.js" ], "homepage": "https://github.com/npm/read-package-tree", "license": "ISC", @@ -63,7 +62,14 @@ "url": "git+https://github.com/npm/read-package-tree.git" }, "scripts": { - "test": "tap test/*.js" + "postpublish": "git push origin --follow-tags", + "postversion": "npm publish", + "preversion": "npm test", + "snap": "TAP_SNAPSHOT=1 tap test/*.js --100", + "test": "tap test/*.js --100" }, - "version": "5.2.2" + "tap": { + "100": true + }, + "version": "5.3.1" } diff --git a/node_modules/read-package-tree/realpath.js b/node_modules/read-package-tree/realpath.js new file mode 100644 index 0000000000000..70c666064ec89 --- /dev/null +++ b/node_modules/read-package-tree/realpath.js @@ -0,0 +1,94 @@ +// look up the realpath, but cache stats to minimize overhead +// If the parent folder is in the realpath cache, then we just +// lstat the child, since there's no need to do a full realpath +// This is not a separate module, and is much simpler than Node's +// built-in fs.realpath, because we only care about symbolic links, +// so we can handle many fewer edge cases. + +const fs = require('fs') +/* istanbul ignore next */ +const promisify = require('util').promisify || require('util-promisify') +const readlink = promisify(fs.readlink) +const lstat = promisify(fs.lstat) +const { resolve, basename, dirname } = require('path') + +const realpathCached = (path, rpcache, stcache, depth) => { + // just a safety against extremely deep eloops + /* istanbul ignore next */ + if (depth > 2000) + throw eloop(path) + + path = resolve(path) + if (rpcache.has(path)) + return Promise.resolve(rpcache.get(path)) + + const dir = dirname(path) + const base = basename(path) + + if (base && rpcache.has(dir)) + return realpathChild(dir, base, rpcache, stcache, depth) + + // if it's the root, then we know it's real + if (!base) { + rpcache.set(dir, dir) + return Promise.resolve(dir) + } + + // the parent, what is that? + // find out, and then come back. + return realpathCached(dir, rpcache, stcache, depth + 1).then(() => + realpathCached(path, rpcache, stcache, depth + 1)) +} + +const lstatCached = (path, stcache) => { + if (stcache.has(path)) + return Promise.resolve(stcache.get(path)) + + const p = lstat(path).then(st => { + stcache.set(path, st) + return st + }) + stcache.set(path, p) + return p +} + +// This is a slight fib, as it doesn't actually occur during a stat syscall. +// But file systems are giant piles of lies, so whatever. +const eloop = path => + Object.assign(new Error( + `ELOOP: too many symbolic links encountered, stat '${path}'`), { + errno: -62, + syscall: 'stat', + code: 'ELOOP', + path: path, + }) + +const realpathChild = (dir, base, rpcache, stcache, depth) => { + const realdir = rpcache.get(dir) + // that unpossible + /* istanbul ignore next */ + if (typeof realdir === 'undefined') + throw new Error('in realpathChild without parent being in realpath cache') + + const realish = resolve(realdir, base) + return lstatCached(realish, stcache).then(st => { + if (!st.isSymbolicLink()) { + rpcache.set(resolve(dir, base), realish) + return realish + } + + let res + return readlink(realish).then(target => { + const resolved = res = resolve(realdir, target) + if (realish === resolved) + throw eloop(realish) + + return realpathCached(resolved, rpcache, stcache, depth + 1) + }).then(real => { + rpcache.set(resolve(dir, base), real) + return real + }) + }) +} + +module.exports = realpathCached diff --git a/node_modules/read-package-tree/rpt.js b/node_modules/read-package-tree/rpt.js index fd43be9c22c0c..b12a09dfb3b20 100644 --- a/node_modules/read-package-tree/rpt.js +++ b/node_modules/read-package-tree/rpt.js @@ -1,249 +1,169 @@ -var fs = require('fs') -var rpj = require('read-package-json') -var path = require('path') -var dz = require('dezalgo') -var once = require('once') -var readdir = require('readdir-scoped-modules') -var debug = require('debuglog')('rpt') - -function asyncForEach (items, todo, done) { - var remaining = items.length - if (remaining === 0) return done() - var seenErr - items.forEach(function (item) { - todo(item, handleComplete) - }) - function handleComplete (err) { - if (seenErr) return - if (err) { - seenErr = true - return done(err) - } - if (--remaining === 0) done() +const fs = require('fs') +/* istanbul ignore next */ +const promisify = require('util').promisify || require('util-promisify') +const { resolve, basename, dirname, join } = require('path') +const rpj = promisify(require('read-package-json')) +const readdir = promisify(require('readdir-scoped-modules')) +const realpath = require('./realpath.js') + +let ID = 0 +class Node { + constructor (pkg, logical, physical, er, cache) { + // should be impossible. + const cached = cache.get(physical) + /* istanbul ignore next */ + if (cached && !cached.then) + throw new Error('re-creating already instantiated node') + + cache.set(physical, this) + + const parent = basename(dirname(logical)) + if (parent.charAt(0) === '@') + this.name = `${parent}/${basename(logical)}` + else + this.name = basename(logical) + this.path = logical + this.realpath = physical + this.error = er + this.id = ID++ + this.package = pkg || {} + this.parent = null + this.isLink = false + this.children = [] } } -function dpath (p) { - if (!p) return '' - if (p.indexOf(process.cwd()) === 0) { - p = p.substr(process.cwd().length + 1) +class Link extends Node { + constructor (pkg, logical, physical, realpath, er, cache) { + super(pkg, logical, physical, er, cache) + + // if the target has started, but not completed, then + // a Promise will be in the cache to indicate this. + const cachedTarget = cache.get(realpath) + if (cachedTarget && cachedTarget.then) + cachedTarget.then(node => { + this.target = node + this.children = node.children + }) + + this.target = cachedTarget || new Node(pkg, logical, realpath, er, cache) + this.realpath = realpath + this.isLink = true + this.error = er + this.children = this.target.children } - return p -} - -module.exports = rpt - -rpt.Node = Node -rpt.Link = Link - -var ID = 0 -function Node (pkg, logical, physical, er, cache, fromLink) { - if (!(this instanceof Node)) { - return new Node(pkg, logical, physical, er, cache) - } - - var node = cache[physical] || this - if (fromLink && cache[physical]) return cache[physical] - - debug(node.constructor.name, dpath(physical), pkg && pkg._id) - - const parent = path.basename(path.dirname(logical)) - if (parent[0] === '@') { - node.name = parent + '/' + path.basename(logical) - } else { - node.name = path.basename(logical) - } - node.path = logical - node.realpath = physical - node.error = er - if (!cache[physical]) { - node.id = ID++ - node.package = pkg || {} - node.parent = null - node.isLink = false - node.children = [] - } - return cache[physical] = node } -Node.prototype.package = null -Node.prototype.path = '' -Node.prototype.realpath = '' -Node.prototype.children = null -Node.prototype.error = null - -function Link (pkg, logical, physical, realpath, er, cache) { - if (cache[physical]) return cache[physical] - - if (!(this instanceof Link)) { - return new Link(pkg, logical, physical, realpath, er, cache) - } - - cache[physical] = this - - debug(this.constructor.name, dpath(physical), pkg && pkg._id) - - const parent = path.basename(path.dirname(logical)) - if (parent[0] === '@') { - this.name = parent + '/' + path.basename(logical) - } else { - this.name = path.basename(logical) - } - this.id = ID++ - this.path = logical - this.realpath = realpath - this.package = pkg || {} - this.parent = null - this.target = new Node(this.package, logical, realpath, er, cache, true) - this.isLink = true - this.children = this.target.children - this.error = er -} - -Link.prototype = Object.create(Node.prototype, { - constructor: { value: Link } -}) -Link.prototype.target = null -Link.prototype.realpath = '' - -function loadNode (logical, physical, cache, cb) { - debug('loadNode', dpath(logical)) - return fs.realpath(physical, thenReadPackageJson) - - var realpath - function thenReadPackageJson (er, real) { - if (er) { - var node = new Node(null, logical, physical, er, cache) - return cb(null, node) - } - debug('realpath l=%j p=%j real=%j', dpath(logical), dpath(physical), dpath(real)) - var pj = path.join(real, 'package.json') - realpath = real - return rpj(pj, thenCreateNode) - } - function thenCreateNode (er, pkg) { - pkg = pkg || null - var node - if (physical === realpath) { - node = new Node(pkg, logical, physical, er, cache) - } else { - node = new Link(pkg, logical, physical, realpath, er, cache) - } - - cb(null, node) - } +// this is the way it is to expose a timing issue which is difficult to +// test otherwise. The creation of a Node may take slightly longer than +// the creation of a Link that targets it. If the Node has _begun_ its +// creation phase (and put a Promise in the cache) then the Link will +// get a Promise as its cachedTarget instead of an actual Node object. +// This is not a problem, because it gets resolved prior to returning +// the tree or attempting to load children. However, it IS remarkably +// difficult to get to happen in a test environment to verify reliably. +// Hence this kludge. +const newNode = (pkg, logical, physical, er, cache) => + process.env._TEST_RPT_SLOW_LINK_TARGET_ === '1' + ? new Promise(res => setTimeout(() => + res(new Node(pkg, logical, physical, er, cache)), 10)) + : new Node(pkg, logical, physical, er, cache) + +const loadNode = (logical, physical, cache, rpcache, stcache) => { + // cache temporarily holds a promise placeholder so we + // don't try to create the same node multiple times. + // this is very rare to encounter, given the aggressive + // caching on fs.realpath and fs.lstat calls, but + // it can happen in theory. + const cached = cache.get(physical) + /* istanbul ignore next */ + if (cached) + return Promise.resolve(cached) + + const p = realpath(physical, rpcache, stcache, 0).then(real => + rpj(join(real, 'package.json')) + .then(pkg => [pkg, null], er => [null, er]) + .then(([pkg, er]) => + physical === real ? newNode(pkg, logical, physical, er, cache) + : new Link(pkg, logical, physical, real, er, cache) + ), + // if the realpath fails, don't bother with the rest + er => new Node(null, logical, physical, er, cache)) + + cache.set(physical, p) + return p } -function loadChildren (node, cache, filterWith, cb) { - debug('loadChildren', dpath(node.path)) - // needed 'cause we process all kids async-like and errors - // short circuit, so we have to be sure that after an error - // the cbs from other kids don't result in calling cb a second - // (or more) time. - cb = once(cb) - var nm = path.join(node.path, 'node_modules') - var rm - return fs.realpath(path.join(node.path, 'node_modules'), thenReaddir) - - function thenReaddir (er, real_nm) { - if (er) return cb(null, node) - rm = real_nm - readdir(nm, thenLoadKids) - } - - function thenLoadKids (er, kids) { - // If there are no children, that's fine, just return - if (er) return cb(null, node) - - kids = kids.filter(function (kid) { - return kid[0] !== '.' && (!filterWith || filterWith(node, kid)) +const loadChildren = (node, cache, filterWith, rpcache, stcache) => { + // if a Link target has started, but not completed, then + // a Promise will be in the cache to indicate this. + // + // XXX When we can one day loadChildren on the link *target* instead of + // the link itself, to match real dep resolution, then we may end up with + // a node target in the cache that isn't yet done resolving when we get + // here. For now, though, this line will never be reached, so it's hidden + // + // if (node.then) + // return node.then(node => loadChildren(node, cache, filterWith, rpcache, stcache)) + + const nm = join(node.path, 'node_modules') + return realpath(nm, rpcache, stcache, 0) + .then(rm => readdir(rm).then(kids => [rm, kids])) + .then(([rm, kids]) => Promise.all( + kids.filter(kid => + kid.charAt(0) !== '.' && (!filterWith || filterWith(node, kid))) + .map(kid => loadNode(join(nm, kid), join(rm, kid), cache, rpcache, stcache))) + ).then(kidNodes => { + kidNodes.forEach(k => k.parent = node) + node.children.push.apply(node.children, kidNodes.sort((a, b) => + (a.package.name ? a.package.name.toLowerCase() : a.path) + .localeCompare( + (b.package.name ? b.package.name.toLowerCase() : b.path) + ))) + return node }) - - asyncForEach(kids, thenLoadNode, thenSortChildren) - } - function thenLoadNode (kid, done) { - var kidPath = path.join(nm, kid) - var kidRealPath = path.join(rm, kid) - loadNode(kidPath, kidRealPath, cache, andAddNode(done)) - } - function andAddNode (done) { - return function (er, kid) { - if (er) return done(er) - node.children.push(kid) - kid.parent = node - done() - } - } - function thenSortChildren (er) { - sortChildren(node) - cb(er, node) - } + .catch(() => node) } -function sortChildren (node) { - node.children = node.children.sort(function (a, b) { - a = a.package.name ? a.package.name.toLowerCase() : a.path - b = b.package.name ? b.package.name.toLowerCase() : b.path - return a > b ? 1 : -1 - }) +const loadTree = (node, did, cache, filterWith, rpcache, stcache) => { + // impossible except in pathological ELOOP cases + /* istanbul ignore next */ + if (did.has(node.realpath)) + return Promise.resolve(node) + + did.add(node.realpath) + + // load children on the target, not the link + return loadChildren(node, cache, filterWith, rpcache, stcache) + .then(node => Promise.all( + node.children + .filter(kid => !did.has(kid.realpath)) + .map(kid => loadTree(kid, did, cache, filterWith, rpcache, stcache)) + )).then(() => node) } -function loadTree (node, did, cache, filterWith, cb) { - debug('loadTree', dpath(node.path), !!cache[node.path]) - - if (did[node.realpath]) { - return dz(cb)(null, node) +// XXX Drop filterWith and/or cb in next semver major bump +const rpt = (root, filterWith, cb) => { + if (!cb && typeof filterWith === 'function') { + cb = filterWith + filterWith = null } - did[node.realpath] = true + const cache = new Map() + // we can assume that the cwd is real enough + const cwd = process.cwd() + const rpcache = new Map([[ cwd, cwd ]]) + const stcache = new Map() + const p = realpath(root, rpcache, stcache, 0) + .then(realRoot => loadNode(root, realRoot, cache, rpcache, stcache)) + .then(node => loadTree(node, new Set(), cache, filterWith, rpcache, stcache)) - // needed 'cause we process all kids async-like and errors - // short circuit, so we have to be sure that after an error - // the cbs from other kids don't result in calling cb a second - // (or more) time. - cb = once(cb) - return loadChildren(node, cache, filterWith, thenProcessChildren) - - function thenProcessChildren (er, node) { - if (er) return cb(er) - - var kids = node.children.filter(function (kid) { - return !did[kid.realpath] - }) + if (typeof cb === 'function') + p.then(tree => cb(null, tree), cb) - return asyncForEach(kids, loadTreeForKid, cb) - } - function loadTreeForKid (kid, done) { - loadTree(kid, did, cache, filterWith, done) - } + return p } -function rpt (root, filterWith, cb) { - if (!cb) { - cb = filterWith - filterWith = null - } - var cache = Object.create(null) - var topErr - var tree - return fs.realpath(root, thenLoadNode) - - function thenLoadNode (er, realRoot) { - if (er) return cb(er) - debug('rpt', dpath(realRoot)) - loadNode(root, realRoot, cache, thenLoadTree) - } - function thenLoadTree(er, node) { - // even if there's an error, it's fine, as long as we got a node - if (node) { - topErr = er - tree = node - loadTree(node, {}, cache, filterWith, thenHandleErrors) - } else { - cb(er) - } - } - function thenHandleErrors (er) { - cb(topErr && topErr.code !== 'ENOENT' ? topErr : er, tree) - } -} +rpt.Node = Node +rpt.Link = Link +module.exports = rpt diff --git a/node_modules/util-promisify/.npmignore b/node_modules/util-promisify/.npmignore new file mode 100644 index 0000000000000..3c3629e647f5d --- /dev/null +++ b/node_modules/util-promisify/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/util-promisify/.travis.yml b/node_modules/util-promisify/.travis.yml new file mode 100644 index 0000000000000..58e15d6302e26 --- /dev/null +++ b/node_modules/util-promisify/.travis.yml @@ -0,0 +1,8 @@ +sudo: false +language: node_js +node_js: + - 4 + - 5 + - 6 + - 7 + - 8 diff --git a/node_modules/util-promisify/LICENSE b/node_modules/util-promisify/LICENSE new file mode 100644 index 0000000000000..d17113b221c0c --- /dev/null +++ b/node_modules/util-promisify/LICENSE @@ -0,0 +1,1072 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. 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, 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 license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. 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, 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. +""" + +The Node.js license applies to all parts of Node.js that are not externally +maintained libraries. + +The externally maintained libraries used by Node.js are: + +- c-ares, located at deps/cares, is licensed as follows: + """ + Copyright 1998 by the Massachusetts Institute of Technology. + Copyright (C) 2007-2013 by Daniel Stenberg + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright + notice appear in all copies and that both that copyright + notice and this permission notice appear in supporting + documentation, and that the name of M.I.T. not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + M.I.T. makes no representations about the suitability of + this software for any purpose. It is provided "as is" + without express or implied warranty. + """ + +- HTTP Parser, located at deps/http_parser, is licensed as follows: + """ + http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright + Igor Sysoev. + + Additional changes are licensed under the same terms as NGINX and + copyright Joyent, Inc. and other Node contributors. 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, 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. + """ + +- ICU, located at deps/icu-small, is licensed as follows: + """ + COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later) + + Copyright © 1991-2016 Unicode, Inc. All rights reserved. + Distributed under the Terms of Use in http://www.unicode.org/copyright.html + + Permission is hereby granted, free of charge, to any person obtaining + a copy of the Unicode data files and any associated documentation + (the "Data Files") or Unicode software and any associated documentation + (the "Software") to deal in the Data Files or Software + without restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, and/or sell copies of + the Data Files or Software, and to permit persons to whom the Data Files + or Software are furnished to do so, provided that either + (a) this copyright and permission notice appear with all copies + of the Data Files or Software, or + (b) this copyright and permission notice appear in associated + Documentation. + + THE DATA FILES AND SOFTWARE ARE 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 THE DATA FILES OR 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 these Data Files or Software without prior + written authorization of the copyright holder. + + --------------------- + + 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. + + 1. ICU License - ICU 1.8.1 to ICU 57.1 + + COPYRIGHT AND PERMISSION NOTICE + + 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 + 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 + 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. + + 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. + + 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 BSD License + # http://opensource.org/licenses/bsd-license.php + # Copyright (C) 2006-2008, Google Inc. + # + # 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 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. + # + # + # 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. + # + # * IPADIC (Japanese) + # - http://chasen.aist-nara.ac.jp/chasen/distribution.html + # - Its license terms and conditions are shown below. + # + # ---------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. + # */ + # + # /* + # * 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 + # + # ---------------COPYING.libtabe-----END-------------------------------- + # + # + # ---------------COPYING.ipadic-----BEGIN------------------------------- + # + # 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. + # + # 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. + # + # 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 + # + # 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. + # + # 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. + # + # ---------------COPYING.ipadic-----END---------------------------------- + + 3. Lao Word Break Dictionary Data (laodict.txt) + + # Copyright (c) 2013 International Business Machines Corporation + # and others. All Rights Reserved. + # + # 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) + # + # 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: + # + # + # 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) 2013, LeRoy Benjamin Sharon + # 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 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. + # -------------------------------------------------------------------------- + + 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 + 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. + """ + +- libuv, located at deps/uv, is licensed as follows: + """ + libuv is part of the Node project: http://nodejs.org/ + libuv may be distributed alone under Node's license: + + ==== + + Copyright Joyent, Inc. and other Node contributors. 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, 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 license applies to all parts of libuv that are not externally + maintained libraries. + + The externally maintained libraries used by libuv are: + + - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license. + + - inet_pton and inet_ntop implementations, contained in src/inet.c, are + copyright the Internet Systems Consortium, Inc., and licensed under the ISC + license. + + - stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three + clause BSD license. + + - pthread-fixes.h, pthread-fixes.c, copyright Google Inc. and Sony Mobile + Communications AB. Three clause BSD license. + + - android-ifaddrs.h, android-ifaddrs.c, copyright Berkeley Software Design + Inc, Kenneth MacKay and Emergya (Cloud4all, FP7/2007-2013, grant agreement + n° 289016). Three clause BSD license. + """ + +- OpenSSL, located at deps/openssl, is licensed as follows: + """ + 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 + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. 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. + + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + + 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + + 5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + + THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + EXPRESSED 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 OpenSSL PROJECT OR + ITS 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 product includes cryptographic software written by Eric Young + (eay@cryptsoft.com). This product includes software written by Tim + Hudson (tjh@cryptsoft.com). + """ + +- Punycode.js, located at lib/punycode.js, is licensed as follows: + """ + Copyright Mathias Bynens + + 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. + """ + +- V8, located at deps/v8, is licensed as follows: + """ + This license applies to all parts of V8 that are not externally + maintained libraries. The externally maintained libraries used by V8 + are: + + - PCRE test suite, located in + test/mjsunit/third_party/regexp-pcre/regexp-pcre.js. This is based on the + test suite from PCRE-7.3, which is copyrighted by the University + of Cambridge and Google, Inc. The copyright notice and license + are embedded in regexp-pcre.js. + + - Layout tests, located in test/mjsunit/third_party/object-keys. These are + based on layout tests from webkit.org which are copyrighted by + Apple Computer, Inc. and released under a 3-clause BSD license. + + - Strongtalk assembler, the basis of the files assembler-arm-inl.h, + assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h, + assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h, + assembler-x64.cc, assembler-x64.h, assembler-mips-inl.h, + assembler-mips.cc, assembler-mips.h, assembler.cc and assembler.h. + This code is copyrighted by Sun Microsystems Inc. and released + under a 3-clause BSD license. + + - Valgrind client API header, located at third_party/valgrind/valgrind.h + This is release under the BSD license. + + These libraries have their own licenses; we recommend you read them, + as their terms may differ from the terms below. + + Further license information can be found in LICENSE files located in + sub-directories. + + Copyright 2014, the V8 project authors. 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 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. + """ + +- zlib, located at deps/zlib, is licensed as follows: + """ + zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.8, April 28th, 2013 + + Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + """ + +- npm, located at deps/npm, is licensed as follows: + """ + The npm application + Copyright (c) npm, Inc. and Contributors + Licensed on the terms of The Artistic License 2.0 + + Node package dependencies of the npm application + Copyright (c) their respective copyright owners + Licensed on their respective license terms + + The npm public registry at https://registry.npmjs.org + and the npm website at https://www.npmjs.com + Operated by npm, Inc. + Use governed by terms published on https://www.npmjs.com + + "Node.js" + Trademark Joyent, Inc., https://joyent.com + Neither npm nor npm, Inc. are affiliated with Joyent, Inc. + + The Node.js application + Project of Node Foundation, https://nodejs.org + + The npm Logo + Copyright (c) Mathias Pettersson and Brian Hammond + + "Gubblebum Blocky" typeface + Copyright (c) Tjarda Koster, https://jelloween.deviantart.com + Used with permission + + -------- + + The Artistic License 2.0 + + Copyright (c) 2000-2006, The Perl Foundation. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + This license establishes the terms under which a given free software + Package may be copied, modified, distributed, and/or redistributed. + The intent is that the Copyright Holder maintains some artistic + control over the development of that Package while still keeping the + Package available as open source and free software. + + You are always permitted to make arrangements wholly outside of this + license directly with the Copyright Holder of a given Package. If the + terms of this license do not permit the full use that you propose to + make of the Package, you should contact the Copyright Holder and seek + a different licensing arrangement. + + Definitions + + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and + configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + + Permission for Use and Modification Without Distribution + + (1) You are permitted to use the Standard Version and create and use + Modified Versions for any purpose without restriction, provided that + you do not Distribute the Modified Version. + + Permissions for Redistribution of the Standard Version + + (2) You may Distribute verbatim copies of the Source form of the + Standard Version of this Package in any medium without restriction, + either gratis or for a Distributor Fee, provided that you duplicate + all of the original copyright notices and associated disclaimers. At + your discretion, such verbatim copies may or may not include a + Compiled form of the Package. + + (3) You may apply any bug fixes, portability changes, and other + modifications made available from the Copyright Holder. The resulting + Package will still be considered the Standard Version, and as such + will be subject to the Original License. + + Distribution of Modified Versions of the Package as Source + + (4) You may Distribute your Modified Version as Source (either gratis + or for a Distributor Fee, and with or without a Compiled form of the + Modified Version) provided that you clearly document how it differs + from the Standard Version, including, but not limited to, documenting + any non-standard features, executables, or modules, and provided that + you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + + (i) the Original License or + + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + + Distribution of Compiled Forms of the Standard Version + or Modified Versions without the Source + + (5) You may Distribute Compiled forms of the Standard Version without + the Source, provided that you include complete instructions on how to + get the Source of the Standard Version. Such instructions must be + valid at the time of your distribution. If these instructions, at any + time while you are carrying out such distribution, become invalid, you + must provide new instructions on demand or cease further distribution. + If you provide valid instructions or cease distribution within thirty + days after you become aware that the instructions are invalid, then + you do not forfeit any of your rights under this license. + + (6) You may Distribute a Modified Version in Compiled form without + the Source, provided that you comply with Section 4 with respect to + the Source of the Modified Version. + + Aggregating or Linking the Package + + (7) You may aggregate the Package (either the Standard Version or + Modified Version) with other packages and Distribute the resulting + aggregation provided that you do not charge a licensing fee for the + Package. Distributor Fees are permitted, and licensing fees for other + components in the aggregation are permitted. The terms of this license + apply to the use and Distribution of the Standard or Modified Versions + as included in the aggregation. + + (8) You are permitted to link Modified and Standard Versions with + other works, to embed the Package in a larger work of your own, or to + build stand-alone binary or bytecode versions of applications that + include the Package, and Distribute the result without restriction, + provided the result does not expose a direct interface to the Package. + + Items That are Not Considered Part of a Modified Version + + (9) Works (including, but not limited to, modules and scripts) that + merely extend or make use of the Package, do not, by themselves, cause + the Package to be a Modified Version. In addition, such works are not + considered parts of the Package itself, and are not subject to the + terms of this license. + + General Provisions + + (10) Any use, modification, and distribution of the Standard or + Modified Versions is governed by this Artistic License. By using, + modifying or distributing the Package, you accept this license. Do not + use, modify, or distribute the Package, if you do not accept this + license. + + (11) If your Modified Version has been derived from a Modified + Version made by someone other than you, you are nevertheless required + to ensure that your Modified Version complies with the requirements of + this license. + + (12) This license does not grant you the right to use any trademark, + service mark, tradename, or logo of the Copyright Holder. + + (13) This license includes the non-exclusive, worldwide, + free-of-charge patent license to make, have made, use, offer to sell, + sell, import and otherwise transfer the Package with respect to any + patent claims licensable by the Copyright Holder that are necessarily + infringed by the Package. If you institute patent litigation + (including a cross-claim or counterclaim) against any party alleging + that the Package constitutes direct or contributory patent + infringement, then this Artistic License to you shall terminate on the + date that such litigation is filed. + + (14) Disclaimer of Warranty: + THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL + LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + -------- + """ + +- GYP, located at tools/gyp, is licensed as follows: + """ + Copyright (c) 2009 Google Inc. 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 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. + """ + +- marked, located at tools/doc/node_modules/marked, is licensed as follows: + """ + Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) + + 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. + """ + +- cpplint.py, located at tools/cpplint.py, is licensed as follows: + """ + Copyright (c) 2009 Google Inc. 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 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. + """ + +- ESLint, located at tools/eslint, is licensed as follows: + """ + ESLint + Copyright jQuery Foundation and other contributors, https://jquery.org/ + + 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. + """ + +- gtest, located at deps/gtest, is licensed as follows: + """ + Copyright 2008, Google Inc. + 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 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. + """ diff --git a/node_modules/util-promisify/README.md b/node_modules/util-promisify/README.md new file mode 100644 index 0000000000000..18c84207beacb --- /dev/null +++ b/node_modules/util-promisify/README.md @@ -0,0 +1,42 @@ + +# util-promisify + +Node 8's [`require('util').promisify`](https://nodejs.org/api/util.html#util_util_promisify_original) as a node module, so you can use it right now! + +Supports [all major node versions](https://github.com/nodejs/LTS#lts-schedule1). + +[![build status](https://travis-ci.org/juliangruber/util-promisify.svg?branch=master)](http://travis-ci.org/juliangruber/util-promisify) +[![downloads](https://img.shields.io/npm/dm/util-promisify.svg)](https://www.npmjs.org/package/util-promisify) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/util-promisify.svg)](https://greenkeeper.io/) + +## Usage + +```js +const promisify = require('util-promisify'); +const fs = require('fs'); + +const stat = promisify(fs.stat); + +stat('/tmp/').then(s => { + // ... +}); +``` + +## Installation + +```bash +$ npm install util-promisify +``` + +## API + +See `util.promisify`'s [API docs](https://nodejs.org/api/util.html#util_util_promisify_original). + +### promisify(original) +### (Symbol) promisify.custom + +If available, the Symbol is reexported from node core's `util` module. + +## License + +MIT diff --git a/node_modules/util-promisify/index.js b/node_modules/util-promisify/index.js new file mode 100644 index 0000000000000..2d2719ed1f794 --- /dev/null +++ b/node_modules/util-promisify/index.js @@ -0,0 +1,91 @@ +'use strict'; + +const ObjectGetOwnPropertyDescriptors = require('object.getownpropertydescriptors'); +const util = require('util'); +const timers = require('timers'); + +const kCustomPromisifiedSymbol = util.promisify && util.promisify.custom || Symbol('util.promisify.custom'); +//const kCustomPromisifyArgsSymbol = Symbol('customPromisifyArgs'); + +function promisify(orig) { + if (typeof orig !== 'function') { + //const errors = require('internal/errors'); + //throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function'); + var err = TypeError(`The "original" argument must be of type function`); + err.code = 'ERR_INVALID_ARG_TYPE'; + err.name = `TypeError [${err.code}]`; + throw err + } + + if (orig === timers.setTimeout || orig === timers.setImmediate) { + const _orig = orig + orig = function () { + var args = []; + for (var i = 0; i < arguments.length; i ++) args.push(arguments[i]); + const _cb = args.pop() + const cb = function () { + var args = []; + for (var i = 0; i < arguments.length; i ++) args.push(arguments[i]); + _cb.apply(null, [null].concat(args)) + } + _orig.apply(timers, [cb].concat(args)) + } + } + + if (orig[kCustomPromisifiedSymbol]) { + const fn = orig[kCustomPromisifiedSymbol]; + if (typeof fn !== 'function') { + throw new TypeError('The [util.promisify.custom] property must be ' + + 'a function'); + } + Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true + }); + return fn; + } + + // Names to create an object from in case the callback receives multiple + // arguments, e.g. ['stdout', 'stderr'] for child_process.exec. + //const argumentNames = orig[kCustomPromisifyArgsSymbol]; + + function fn() { + var args = []; + for (var i = 0; i < arguments.length; i ++) args.push(arguments[i]); + + let resolve, reject; + const promise = new Promise(function (_resolve, _reject) { + resolve = _resolve; + reject = _reject; + }); + try { + orig.apply(this, args.concat(function (err) { + var values = []; + for (var i = 1; i < arguments.length; i++) values.push(arguments[i]); + if (err) { + reject(err); + //} else if (argumentNames !== undefined && values.length > 1) { + // const obj = {}; + // for (var i = 0; i < argumentNames.length; i++) + // obj[argumentNames[i]] = values[i]; + // resolve(obj); + } else { + resolve(values[0]); + } + })); + } catch (err) { + reject(err); + } + return promise; + } + + Object.setPrototypeOf(fn, Object.getPrototypeOf(orig)); + + Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true + }); + return Object.defineProperties(fn, ObjectGetOwnPropertyDescriptors(orig)); +} + +promisify.custom = kCustomPromisifiedSymbol; + +module.exports = promisify; diff --git a/node_modules/util-promisify/package.json b/node_modules/util-promisify/package.json new file mode 100644 index 0000000000000..404bd92be6eba --- /dev/null +++ b/node_modules/util-promisify/package.json @@ -0,0 +1,45 @@ +{ + "_from": "util-promisify@^2.1.0", + "_id": "util-promisify@2.1.0", + "_inBundle": false, + "_integrity": "sha1-PCI2R2xNMsX/PEcAKt18E7moKlM=", + "_location": "/util-promisify", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "util-promisify@^2.1.0", + "name": "util-promisify", + "escapedName": "util-promisify", + "rawSpec": "^2.1.0", + "saveSpec": null, + "fetchSpec": "^2.1.0" + }, + "_requiredBy": [ + "/read-package-tree" + ], + "_resolved": "https://registry.npmjs.org/util-promisify/-/util-promisify-2.1.0.tgz", + "_shasum": "3c2236476c4d32c5ff3c47002add7c13b9a82a53", + "_spec": "util-promisify@^2.1.0", + "_where": "/Users/isaacs/dev/npm/cli/node_modules/read-package-tree", + "bugs": { + "url": "https://github.com/juliangruber/util-promisify/issues" + }, + "bundleDependencies": false, + "dependencies": { + "object.getownpropertydescriptors": "^2.0.3" + }, + "deprecated": false, + "description": "Node 8's util.promisify, as a node module", + "homepage": "https://github.com/juliangruber/util-promisify#readme", + "license": "MIT", + "name": "util-promisify", + "repository": { + "type": "git", + "url": "git+https://github.com/juliangruber/util-promisify.git" + }, + "scripts": { + "test": "node test" + }, + "version": "2.1.0" +} diff --git a/node_modules/util-promisify/test/common.js b/node_modules/util-promisify/test/common.js new file mode 100644 index 0000000000000..72262b7feb36a --- /dev/null +++ b/node_modules/util-promisify/test/common.js @@ -0,0 +1,56 @@ +const mustCallChecks = []; + +function runCallChecks(exitCode) { + if (exitCode !== 0) return; + + const failed = mustCallChecks.filter(function(context) { + return context.actual !== context.expected; + }); + + failed.forEach(function(context) { + console.log('Mismatched %s function calls. Expected %d, actual %d.', + context.name, + context.expected, + context.actual); + console.log(context.stack.split('\n').slice(2).join('\n')); + }); + + if (failed.length) process.exit(1); +} + +exports.mustCall = function(fn, expected) { + if (typeof fn === 'number') { + expected = fn; + fn = noop; + } else if (fn === undefined) { + fn = noop; + } + + if (expected === undefined) + expected = 1; + else if (typeof expected !== 'number') + throw new TypeError(`Invalid expected value: ${expected}`); + + const context = { + expected: expected, + actual: 0, + stack: (new Error()).stack, + name: fn.name || '' + }; + + // add the exit listener only once to avoid listener leak warnings + if (mustCallChecks.length === 0) process.on('exit', runCallChecks); + + mustCallChecks.push(context); + + return function() { + context.actual++; + return fn.apply(this, arguments); + }; +}; + +// Crash the process on unhandled rejections. +exports.crashOnUnhandledRejection = function() { + process.on('unhandledRejection', + (err) => process.nextTick(() => { throw err; })); +}; diff --git a/node_modules/util-promisify/test/index.js b/node_modules/util-promisify/test/index.js new file mode 100644 index 0000000000000..a8e8491628baa --- /dev/null +++ b/node_modules/util-promisify/test/index.js @@ -0,0 +1,194 @@ +'use strict'; + +const common = require('./common'); +const assert = require('assert'); +const fs = require('fs'); +const vm = require('vm'); +const promisify = require('..'); +//const customPromisifyArgs = require('..').customPromisifyArgs; + +const stat = promisify(fs.stat); + +{ + const promise = stat(__filename); + assert(promise instanceof Promise); + promise.then(common.mustCall((value) => { + assert.deepStrictEqual(value, fs.statSync(__filename)); + })); +} + +{ + const promise = stat('/dontexist'); + promise.catch(common.mustCall((error) => { + assert(error.message.includes('ENOENT: no such file or directory, stat')); + })); +} + +{ + function fn() {} + function promisifedFn() {} + fn[promisify.custom] = promisifedFn; + assert.strictEqual(promisify(fn), promisifedFn); + assert.strictEqual(promisify(promisify(fn)), promisifedFn); +} + +{ + function fn() {} + fn[promisify.custom] = 42; + assert.throws( + () => promisify(fn), + (err) => err instanceof TypeError && + err.message === 'The [util.promisify.custom] property must ' + + 'be a function'); +} + +/*{ + const firstValue = 5; + const secondValue = 17; + + function fn(callback) { + callback(null, firstValue, secondValue); + } + + fn[customPromisifyArgs] = ['first', 'second']; + + promisify(fn)().then(common.mustCall((obj) => { + assert.deepStrictEqual(obj, {first: firstValue, second: secondValue}); + })); +}*/ + +{ + const fn = vm.runInNewContext('(function() {})'); + assert.notStrictEqual(Object.getPrototypeOf(promisify(fn)), + Function.prototype); +} + +{ + function fn(callback) { + callback(null, 'foo', 'bar'); + } + promisify(fn)().then(common.mustCall((value) => { + assert.deepStrictEqual(value, 'foo'); + })); +} + +{ + function fn(callback) { + callback(null); + } + promisify(fn)().then(common.mustCall((value) => { + assert.strictEqual(value, undefined); + })); +} + +{ + function fn(callback) { + callback(); + } + promisify(fn)().then(common.mustCall((value) => { + assert.strictEqual(value, undefined); + })); +} + +{ + function fn(err, val, callback) { + callback(err, val); + } + promisify(fn)(null, 42).then(common.mustCall((value) => { + assert.strictEqual(value, 42); + })); +} + +{ + function fn(err, val, callback) { + callback(err, val); + } + promisify(fn)(new Error('oops'), null).catch(common.mustCall((err) => { + assert.strictEqual(err.message, 'oops'); + })); +} + +if (Number(process.version[1]) >= 7) eval` +{ + + function fn(err, val, callback) { + callback(err, val); + } + + (async () => { + const value = await promisify(fn)(null, 42); + assert.strictEqual(value, 42); + })(); +}` + +{ + const o = {}; + const fn = promisify(function(cb) { + + cb(null, this === o); + }); + + o.fn = fn; + + o.fn().then(common.mustCall(function(val) { + assert(val); + })); +} + +if (Number(process.version[1]) >= 7) eval` +{ + const err = new Error('Should not have called the callback with the error.'); + const stack = err.stack; + + const fn = promisify(function(cb) { + cb(null); + cb(err); + }); + + (async () => { + await fn(); + await Promise.resolve(); + return assert.strictEqual(stack, err.stack); + })(); +}` + +{ + function c() { } + const a = promisify(function() { }); + const b = promisify(a); + assert.notStrictEqual(c, a); + assert.strictEqual(a, b); +} + +{ + let errToThrow; + const thrower = promisify(function(a, b, c, cb) { + errToThrow = new Error(); + throw errToThrow; + }); + thrower(1, 2, 3) + .then(assert.fail) + .then(assert.fail, (e) => assert.strictEqual(e, errToThrow)); +} + +{ + const err = new Error(); + + const a = promisify((cb) => cb(err))(); + const b = promisify(() => { throw err; })(); + + Promise.all([ + a.then(assert.fail, function(e) { + assert.strictEqual(err, e); + }), + b.then(assert.fail, function(e) { + assert.strictEqual(err, e); + }) + ]); +} + +if (Number(process.version[1]) >= 8) +{ + const coreUtil = require('util'); + assert.strictEqual(coreUtil.promisify.custom, promisify.custom); +} diff --git a/node_modules/util-promisify/test/timers.js b/node_modules/util-promisify/test/timers.js new file mode 100644 index 0000000000000..de12be034d304 --- /dev/null +++ b/node_modules/util-promisify/test/timers.js @@ -0,0 +1,38 @@ +'use strict'; +const common = require('./common'); +const assert = require('assert'); +const timers = require('timers'); +const promisify = require('..'); + +common.crashOnUnhandledRejection(); + +const setTimeout = promisify(timers.setTimeout); +const setImmediate = promisify(timers.setImmediate); + +{ + const promise = setTimeout(1); + promise.then(common.mustCall((value) => { + assert.strictEqual(value, undefined); + })); +} + +{ + const promise = setTimeout(1, 'foobar'); + promise.then(common.mustCall((value) => { + assert.strictEqual(value, 'foobar'); + })); +} + +{ + const promise = setImmediate(); + promise.then(common.mustCall((value) => { + assert.strictEqual(value, undefined); + })); +} + +{ + const promise = setImmediate('foobar'); + promise.then(common.mustCall((value) => { + assert.strictEqual(value, 'foobar'); + })); +} diff --git a/package-lock.json b/package-lock.json index a75ed27ce173f..4621d5a0c0363 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1224,7 +1224,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -1433,7 +1432,6 @@ "version": "1.12.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, "requires": { "es-to-primitive": "^1.1.1", "function-bind": "^1.1.1", @@ -1446,7 +1444,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -2193,8 +2190,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "function-loop": { "version": "1.0.2", @@ -2416,7 +2412,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -2438,8 +2433,7 @@ "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" }, "has-unicode": { "version": "2.0.1", @@ -2671,8 +2665,7 @@ "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" }, "is-ci": { "version": "1.1.0", @@ -2700,8 +2693,7 @@ "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-fullwidth-code-point": { "version": "1.0.0", @@ -2753,7 +2745,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, "requires": { "has": "^1.0.1" } @@ -2778,7 +2769,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "dev": true, "requires": { "has-symbols": "^1.0.0" } @@ -4252,8 +4242,16 @@ "object-keys": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } }, "on-finished": { "version": "2.3.0", @@ -4898,15 +4896,13 @@ } }, "read-package-tree": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.2.2.tgz", - "integrity": "sha512-rW3XWUUkhdKmN2JKB4FL563YAgtINifso5KShykufR03nJ5loGFlkUMe1g/yxmqX073SoYYTsgXu7XdDinKZuA==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.3.1.tgz", + "integrity": "sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw==", "requires": { - "debuglog": "^1.0.1", - "dezalgo": "^1.0.0", - "once": "^1.3.0", "read-package-json": "^2.0.0", - "readdir-scoped-modules": "^1.0.0" + "readdir-scoped-modules": "^1.0.0", + "util-promisify": "^2.1.0" } }, "read-pkg": { @@ -6337,6 +6333,14 @@ "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz", "integrity": "sha1-p8IW0mdUUWljeztu3GypEZ4v+T8=" }, + "util-promisify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/util-promisify/-/util-promisify-2.1.0.tgz", + "integrity": "sha1-PCI2R2xNMsX/PEcAKt18E7moKlM=", + "requires": { + "object.getownpropertydescriptors": "^2.0.3" + } + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", diff --git a/package.json b/package.json index 94dd003ea50c9..5a2fa1812301f 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "read-cmd-shim": "~1.0.1", "read-installed": "~4.0.3", "read-package-json": "^2.0.13", - "read-package-tree": "^5.2.2", + "read-package-tree": "^5.3.1", "readable-stream": "^3.3.0", "readdir-scoped-modules": "^1.1.0", "request": "^2.88.0", diff --git a/test/tap/no-scan-full-global-dir.js b/test/tap/no-scan-full-global-dir.js index 4ec403ddcaa44..7856ff33f41f2 100644 --- a/test/tap/no-scan-full-global-dir.js +++ b/test/tap/no-scan-full-global-dir.js @@ -6,6 +6,9 @@ var requireInject = require('require-inject') var osenv = require('osenv') var npm = require('../../lib/npm.js') +// XXX update this when rpt's realpath.js is extracted out +var rptRealpath = require.resolve('read-package-tree/realpath.js') + const common = require('../common-tap.js') const pkg = common.pkg var packages = { @@ -41,6 +44,8 @@ mockFs.realpath = function (dir, cb) { return cb(null, dir) } +const mockRptRealpath = path => Promise.resolve(path) + test('setup', function (t) { npm.load(function () { t.pass('npm loaded') @@ -54,7 +59,8 @@ test('installer', function (t) { 'fs': mockFs, 'readdir-scoped-modules': mockReaddir, 'read-package-json': mockReadPackageJson, - 'mkdirp': function (path, cb) { cb() } + 'mkdirp': function (path, cb) { cb() }, + [rptRealpath]: mockRptRealpath }) var Installer = installer.Installer @@ -83,7 +89,8 @@ test('uninstaller', function (t) { 'fs': mockFs, 'readdir-scoped-modules': mockReaddir, 'read-package-json': mockReadPackageJson, - 'mkdirp': function (path, cb) { cb() } + 'mkdirp': function (path, cb) { cb() }, + [rptRealpath]: mockRptRealpath }) var Uninstaller = uninstaller.Uninstaller